From patchwork Fri Dec 14 11:58:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pontus Fuchs X-Patchwork-Id: 206412 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 0A0BA2C008D for ; Fri, 14 Dec 2012 22:58:47 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B6F7F9C1B6; Fri, 14 Dec 2012 06:58:39 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iTnoOfqIMpAS; Fri, 14 Dec 2012 06:58:39 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6E40A9C11F; Fri, 14 Dec 2012 06:58:30 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 894309C1C0 for ; Fri, 14 Dec 2012 06:58:29 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EUS61FsbRGGG for ; Fri, 14 Dec 2012 06:58:24 -0500 (EST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 024A29C15C for ; Fri, 14 Dec 2012 06:58:21 -0500 (EST) Received: by mail-la0-f44.google.com with SMTP id d3so2742156lah.17 for ; Fri, 14 Dec 2012 03:58:20 -0800 (PST) Received: by 10.112.87.97 with SMTP id w1mr2119996lbz.91.1355486300673; Fri, 14 Dec 2012 03:58:20 -0800 (PST) Received: from localhost.localdomain (host-95-199-27-205.mobileonline.telia.com. [95.199.27.205]) by mx.google.com with ESMTPS id pz9sm1755640lab.11.2012.12.14.03.58.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 03:58:19 -0800 (PST) From: Pontus Fuchs To: hostap@lists.shmoo.com Subject: [PATCH] hostapd: Android: Force group access to ctrl_iface directory Date: Fri, 14 Dec 2012 12:58:01 +0100 Message-Id: <1355486281-23143-2-git-send-email-pontus.fuchs@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355486281-23143-1-git-send-email-pontus.fuchs@gmail.com> References: <1355486281-23143-1-git-send-email-pontus.fuchs@gmail.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com 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 --- hostapd/ctrl_iface.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 1d4fe0d..bd16b17 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;