mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Make --rebind-domain-ok work with IDN.
This commit is contained in:
@@ -609,6 +609,11 @@ struct serv_local {
|
||||
struct server *next;
|
||||
};
|
||||
|
||||
struct rebind_domain {
|
||||
char *domain;
|
||||
struct rebind_domain *next;
|
||||
};
|
||||
|
||||
struct ipsets {
|
||||
char **sets;
|
||||
char *domain;
|
||||
@@ -1105,7 +1110,8 @@ extern struct daemon {
|
||||
char *lease_change_command;
|
||||
struct iname *if_names, *if_addrs, *if_except, *dhcp_except, *auth_peers, *tftp_interfaces;
|
||||
struct bogus_addr *bogus_addr, *ignore_addr;
|
||||
struct server *servers, *servers_tail, *local_domains, **serverarray, *no_rebind;
|
||||
struct server *servers, *servers_tail, *local_domains, **serverarray;
|
||||
struct rebind_domain *no_rebind;
|
||||
int server_has_wildcard;
|
||||
int serverarraysz, serverarrayhwm;
|
||||
struct ipsets *ipsets;
|
||||
|
||||
@@ -151,11 +151,11 @@ static void server_send_log(struct server *server, int fd,
|
||||
|
||||
static int domain_no_rebind(char *domain)
|
||||
{
|
||||
struct server *serv;
|
||||
int dlen = (int)strlen(domain);
|
||||
struct rebind_domain *rbd;
|
||||
size_t tlen, dlen = strlen(domain);
|
||||
|
||||
for (serv = daemon->no_rebind; serv; serv = serv->next)
|
||||
if (dlen >= serv->domain_len && strcmp(serv->domain, &domain[dlen - serv->domain_len]) == 0)
|
||||
for (rbd = daemon->no_rebind; rbd; rbd = rbd->next)
|
||||
if (dlen >= (tlen = strlen(rbd->domain)) && strcmp(rbd->domain, &domain[dlen - tlen]) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -2715,7 +2715,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
|
||||
case LOPT_NO_REBIND: /* --rebind-domain-ok */
|
||||
{
|
||||
struct server *new;
|
||||
struct rebind_domain *new;
|
||||
|
||||
unhide_metas(arg);
|
||||
|
||||
@@ -2724,9 +2724,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
||||
|
||||
do {
|
||||
comma = split_chr(arg, '/');
|
||||
new = opt_malloc(sizeof(struct serv_local));
|
||||
new->domain = opt_string_alloc(arg);
|
||||
new->domain_len = strlen(arg);
|
||||
new = opt_malloc(sizeof(struct rebind_domain));
|
||||
new->domain = canonicalise_opt(arg);
|
||||
new->next = daemon->no_rebind;
|
||||
daemon->no_rebind = new;
|
||||
arg = comma;
|
||||
|
||||
Reference in New Issue
Block a user