hostapd: Reject invalid macaddr_acl value

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>
This commit is contained in:
Jouni Malinen 2016-12-27 11:43:13 +02:00
parent 8628555f9b
commit 9266d00bf9
2 changed files with 9 additions and 6 deletions

View file

@ -2113,13 +2113,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "utf8_ssid") == 0) { } else if (os_strcmp(buf, "utf8_ssid") == 0) {
bss->ssid.utf8_ssid = atoi(pos) > 0; bss->ssid.utf8_ssid = atoi(pos) > 0;
} else if (os_strcmp(buf, "macaddr_acl") == 0) { } else if (os_strcmp(buf, "macaddr_acl") == 0) {
bss->macaddr_acl = atoi(pos); enum macaddr_acl acl = atoi(pos);
if (bss->macaddr_acl != ACCEPT_UNLESS_DENIED &&
bss->macaddr_acl != DENY_UNLESS_ACCEPTED && if (acl != ACCEPT_UNLESS_DENIED &&
bss->macaddr_acl != USE_EXTERNAL_RADIUS_AUTH) { acl != DENY_UNLESS_ACCEPTED &&
acl != USE_EXTERNAL_RADIUS_AUTH) {
wpa_printf(MSG_ERROR, "Line %d: unknown macaddr_acl %d", 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) { } else if (os_strcmp(buf, "accept_mac_file") == 0) {
if (hostapd_config_read_maclist(pos, &bss->accept_mac, if (hostapd_config_read_maclist(pos, &bss->accept_mac,
&bss->num_accept_mac)) { &bss->num_accept_mac)) {

View file

@ -293,7 +293,7 @@ struct hostapd_bss_config {
char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast char iapp_iface[IFNAMSIZ + 1]; /* interface used with IAPP broadcast
* frames */ * frames */
enum { enum macaddr_acl {
ACCEPT_UNLESS_DENIED = 0, ACCEPT_UNLESS_DENIED = 0,
DENY_UNLESS_ACCEPTED = 1, DENY_UNLESS_ACCEPTED = 1,
USE_EXTERNAL_RADIUS_AUTH = 2 USE_EXTERNAL_RADIUS_AUTH = 2