aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface_unix.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-11-23 15:05:47 (GMT)
committerJouni Malinen <j@w1.fi>2012-11-23 15:06:36 (GMT)
commitd49ea68284fdb8516d7e0903e526aac484c18c49 (patch)
treee1192acd64e32906544df05a2016c1df40ac8f63 /wpa_supplicant/ctrl_iface_unix.c
parentffa45a1343393603909cc14d1a7c693ef3457d60 (diff)
downloadhostap-d49ea68284fdb8516d7e0903e526aac484c18c49.zip
hostap-d49ea68284fdb8516d7e0903e526aac484c18c49.tar.gz
hostap-d49ea68284fdb8516d7e0903e526aac484c18c49.tar.bz2
Android: Force group access to ctrl_iface directory
wpa_supplicant is started from /init.*.rc on Android and that seems to be using umask 0077 which would leave the control interface directory without group access. This breaks things since Wi-Fi framework assumes that this directory can be accessed by other applications in the wifi group. Fix this by adding group access even if umask value would prevent this. In most cases, this issue was not hit since the control interface directory is normally created by that same init.*.rc file with suitable mode and wpa_supplicant is killed in the way that does not allow it to remove the file. However, if wpa_supplicant is allowed stop cleanly, it will remove the directory and the next start could result with the Wi-Fi framework not being able to use Wi-Fi (and GUI not showing Wi-Fi getting enabled). Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/ctrl_iface_unix.c')
-rw-r--r--wpa_supplicant/ctrl_iface_unix.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
index c106350..f792863 100644
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -305,6 +305,22 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
}
}
+#ifdef ANDROID
+ /*
+ * wpa_supplicant is started from /init.*.rc on Android and that seems
+ * to be using umask 0077 which would leave the control interface
+ * directory without group access. This breaks things since Wi-Fi
+ * framework assumes that this directory can be accessed by other
+ * applications in the wifi group. Fix this by adding group access even
+ * if umask value would prevent this.
+ */
+ if (chmod(dir, S_IRWXU | S_IRWXG) < 0) {
+ wpa_printf(MSG_ERROR, "CTRL: Could not chmod directory: %s",
+ strerror(errno));
+ /* Try to continue anyway */
+ }
+#endif /* ANDROID */
+
if (gid_str) {
grp = getgrnam(gid_str);
if (grp) {