diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-03-13 19:02:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-13 19:02:46 +0000 |
commit | 1676253479d71d63eb248cbdb6b2cdc5f69bd4e1 (patch) | |
tree | 8bff25e469417a9bd8ebe6d4067b3ec7c307ea6f | |
parent | 8b0b5ed2aaa7e8572c4d30b3f66e34bd136e444d (diff) | |
parent | 5040fa9ac57eef80d2bd6faa74c9df3298a33747 (diff) | |
download | wpa_supplicant_8-1676253479d71d63eb248cbdb6b2cdc5f69bd4e1.tar.gz |
Merge "[wpa_supplicant] Revert patch b686745c from wpa_ctrl.c"
-rw-r--r-- | src/common/wpa_ctrl.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c index 8722b199..944b6e35 100644 --- a/src/common/wpa_ctrl.c +++ b/src/common/wpa_ctrl.c @@ -11,8 +11,6 @@ #ifdef CONFIG_CTRL_IFACE #ifdef CONFIG_CTRL_IFACE_UNIX -#include <sys/stat.h> -#include <fcntl.h> #include <sys/un.h> #include <unistd.h> #include <fcntl.h> @@ -143,19 +141,6 @@ try_again: return NULL; } tries++; -#ifdef ANDROID - /* Set client socket file permissions so that bind() creates the client - * socket with these permissions and there is no need to try to change - * them with chmod() after bind() which would have potential issues with - * race conditions. These permissions are needed to make sure the server - * side (wpa_supplicant or hostapd) can reply to the control interface - * messages. - * - * The lchown() calls below after bind() are also part of the needed - * operations to allow the response to go through. Those are using the - * no-deference-symlinks version to avoid races. */ - fchmod(ctrl->s, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -#endif /* ANDROID */ if (bind(ctrl->s, (struct sockaddr *) &ctrl->local, sizeof(ctrl->local)) < 0) { if (errno == EADDRINUSE && tries < 2) { @@ -175,6 +160,7 @@ try_again: #ifdef ANDROID /* Set group even if we do not have privileges to change owner */ + chmod(ctrl->local.sun_path, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); grp_wifi = getgrnam("wifi"); gid_wifi = grp_wifi ? grp_wifi->gr_gid : 0; pwd_system = getpwnam("system"); @@ -185,8 +171,8 @@ try_again: os_free(ctrl); return NULL; } - lchown(ctrl->local.sun_path, -1, gid_wifi); - lchown(ctrl->local.sun_path, uid_system, gid_wifi); + chown(ctrl->local.sun_path, -1, gid_wifi); + chown(ctrl->local.sun_path, uid_system, gid_wifi); if (os_strncmp(ctrl_path, "@android:", 9) == 0) { if (socket_local_client_connect( |