diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2013-11-21 11:29:27 +0000 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2013-11-21 11:29:27 +0000 |
commit | c50f25a3ea4bced5318e59fb1bcc5ca968a4d3af (patch) | |
tree | 8280f21a9d1417c3f037d8a44183f9021bd9bd43 /src/auth.c | |
parent | f25e6c6d338325d68230b7ac6739a3e01e3f479f (diff) | |
download | dnsmasq-c50f25a3ea4bced5318e59fb1bcc5ca968a4d3af.tar.gz |
Allow empty subnet list in --auth-zone
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -18,7 +18,7 @@ #ifdef HAVE_AUTH -static struct addrlist *filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u) +static struct addrlist *find_subnet(struct auth_zone *zone, int flag, struct all_addr *addr_u) { struct addrlist *subnet; @@ -45,6 +45,15 @@ static struct addrlist *filter_zone(struct auth_zone *zone, int flag, struct all return NULL; } +static int filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u) +{ + /* No zones specified, no filter */ + if (!zone->subnet) + return 1; + + return find_subnet(zone, flag, addr_u) != NULL; +} + int in_zone(struct auth_zone *zone, char *name, char **cut) { size_t namelen = strlen(name); @@ -130,7 +139,7 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n if (!local_query) { for (zone = daemon->auth_zones; zone; zone = zone->next) - if ((subnet = filter_zone(zone, flag, &addr))) + if ((subnet = find_subnet(zone, flag, &addr))) break; if (!zone) |