From: Pontus Fuchs Date: Mon, 17 Dec 2012 14:30:44 +0000 (+0200) Subject: hostapd: Android: Force group access to ctrl_iface directory X-Git-Tag: hostap_2_0~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5bbf590a583609541cb257a6bc01bdcfc211bd3c;p=thirdparty%2Fhostap.git hostapd: Android: Force group access to ctrl_iface directory Same fix as d49ea68284fdb8516d7e0903e526aac484c18c49 in wpa_supplicant. From original commit: 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. Signed-hostap: Pontus Fuchs --- diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 1d4fe0de2..bd16b1792 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1003,6 +1003,21 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd) return -1; } +#ifdef ANDROID + /* + * Android is 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(hapd->conf->ctrl_interface, S_IRWXU | S_IRWXG) < 0) { + wpa_printf(MSG_ERROR, "CTRL: Could not chmod directory: %s", + strerror(errno)); + /* Try to continue anyway */ + } +#endif /* ANDROID */ + if (os_strlen(hapd->conf->ctrl_interface) + 1 + os_strlen(hapd->conf->iface) >= sizeof(addr.sun_path)) goto fail;