]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Don't chown control interface to root
authorPontus Fuchs <pontus.fuchs@gmail.com>
Mon, 17 Dec 2012 14:27:04 +0000 (16:27 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 17 Dec 2012 14:27:04 +0000 (16:27 +0200)
If ctrl_interface_group in the config file is set hostapd tries to
chown the dir and socket to uid 0. This causes the chown to fail
if hostapd is run as non-root.

Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>

hostapd/ctrl_iface.c

index ccc018ec9edd4e1b1f920231dd18660f05efe2a2..1d4fe0de20d88e574b565c928607772ec6597376 100644 (file)
@@ -997,7 +997,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
        }
 
        if (hapd->conf->ctrl_interface_gid_set &&
-           chown(hapd->conf->ctrl_interface, 0,
+           chown(hapd->conf->ctrl_interface, -1,
                  hapd->conf->ctrl_interface_gid) < 0) {
                perror("chown[ctrl_interface]");
                return -1;
@@ -1055,7 +1055,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
        }
 
        if (hapd->conf->ctrl_interface_gid_set &&
-           chown(fname, 0, hapd->conf->ctrl_interface_gid) < 0) {
+           chown(fname, -1, hapd->conf->ctrl_interface_gid) < 0) {
                perror("chown[ctrl_interface/ifname]");
                goto fail;
        }