mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Tidy domain parsing, make --server=/*/1.2.3.4 equivalent to --server=1.2.3.4
This commit is contained in:
@@ -582,19 +582,24 @@ int add_update_server(int flags,
|
|||||||
struct server *serv = NULL;
|
struct server *serv = NULL;
|
||||||
char *alloc_domain;
|
char *alloc_domain;
|
||||||
|
|
||||||
if (!domain || strlen(domain) == 0)
|
if (!domain)
|
||||||
alloc_domain = whine_malloc(1);
|
domain = "";
|
||||||
else
|
|
||||||
|
/* .domain == domain, for historical reasons. */
|
||||||
|
if (*domain == '.')
|
||||||
|
while (*domain == '.') domain++;
|
||||||
|
else if (*domain == '*')
|
||||||
{
|
{
|
||||||
if (*domain == '*')
|
domain++;
|
||||||
{
|
if (domain != 0)
|
||||||
domain++;
|
flags |= SERV_WILDCARD;
|
||||||
flags |= SERV_WILDCARD;
|
|
||||||
}
|
|
||||||
if (!(alloc_domain = canonicalise((char *)domain, NULL)))
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*domain == 0)
|
||||||
|
alloc_domain = whine_malloc(1);
|
||||||
|
else if (!(alloc_domain = canonicalise((char *)domain, NULL)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* See if there is a suitable candidate, and unmark
|
/* See if there is a suitable candidate, and unmark
|
||||||
only do this for forwarding servers, not
|
only do this for forwarding servers, not
|
||||||
address or local, to avoid delays on large numbers. */
|
address or local, to avoid delays on large numbers. */
|
||||||
|
|||||||
@@ -2636,11 +2636,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
{
|
{
|
||||||
char *last;
|
char *last;
|
||||||
|
|
||||||
arg++;
|
domain = lastdomain = ++arg;
|
||||||
/* elide leading dots - they are implied in the search algorithm */
|
|
||||||
while (*arg == '.') arg++;
|
|
||||||
|
|
||||||
domain = lastdomain = arg;
|
|
||||||
|
|
||||||
while ((last = split_chr(arg, '/')))
|
while ((last = split_chr(arg, '/')))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user