]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Reject invalid macaddr_acl value
authorJouni Malinen <j@w1.fi>
Tue, 27 Dec 2016 09:43:13 +0000 (11:43 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 27 Dec 2016 09:43:13 +0000 (11:43 +0200)
Previously, this was noted in error log, but the invalid value was
stored in the configuration without rejecting it.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/config_file.c
src/ap/ap_config.h

index ada660132a518f76da78a848081b75342f653c46..6077dc93b50fcd1930a2915f216b724dda62a712 100644 (file)
@@ -2113,13 +2113,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
        } else if (os_strcmp(buf, "utf8_ssid") == 0) {
                bss->ssid.utf8_ssid = atoi(pos) > 0;
        } else if (os_strcmp(buf, "macaddr_acl") == 0) {
-               bss->macaddr_acl = atoi(pos);
-               if (bss->macaddr_acl != ACCEPT_UNLESS_DENIED &&
-                   bss->macaddr_acl != DENY_UNLESS_ACCEPTED &&
-                   bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) {
+               enum macaddr_acl acl = atoi(pos);
+
+               if (acl != ACCEPT_UNLESS_DENIED &&
+                   acl != DENY_UNLESS_ACCEPTED &&
+                   acl != USE_EXTERNAL_RADIUS_AUTH) {
                        wpa_printf(MSG_ERROR, "Line %d: unknown macaddr_acl %d",
-                                  line, bss->macaddr_acl);
+                                  line, acl);
+                       return 1;
                }
+               bss->macaddr_acl = acl;
        } else if (os_strcmp(buf, "accept_mac_file") == 0) {
                if (hostapd_config_read_maclist(pos, &bss->accept_mac,
                                                &bss->num_accept_mac)) {
index c9cc22a2f34275e19fea40613d37db4978b3cbde..69801d35ea8678998b8965bf8638964b6c08b1e0 100644 (file)
@@ -293,7 +293,7 @@ struct hostapd_bss_config {
        char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
                                        * frames */
 
-       enum {
+       enum macaddr_acl {
                ACCEPT_UNLESS_DENIED = 0,
                DENY_UNLESS_ACCEPTED = 1,
                USE_EXTERNAL_RADIUS_AUTH = 2