Commit eaf462b2 authored by Chen Wei's avatar Chen Wei

ignore wrong config option --xxxx=/./1.2.3.4

parent 2b4294fd
...@@ -2214,7 +2214,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -2214,7 +2214,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
char *start_addr, *s; char *start_addr, *s;
char *err; char *err;
struct server newserv; struct server newserv;
struct dict_node *np; struct dict_node *np = NULL;
struct special_domain *obj; struct special_domain *obj;
memset (&newserv, 0, sizeof (struct server)); memset (&newserv, 0, sizeof (struct server));
...@@ -2319,6 +2319,10 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -2319,6 +2319,10 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
while (*arg == '.') while (*arg == '.')
arg++; arg++;
// wrong config option --xxxx=/./1.2.3.4
if (strlen (arg) == 0)
continue;
// --address=/#/1.2.3.4 // --address=/#/1.2.3.4
// use label in the root node to mark #(match all domains) // use label in the root node to mark #(match all domains)
if (strcmp (arg, "#") == 0) if (strcmp (arg, "#") == 0)
...@@ -2327,15 +2331,19 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -2327,15 +2331,19 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
free(np->label); free(np->label);
np->label = strdup("#"); np->label = strdup("#");
} }
else if (strlen (arg) != 0 && !(domain = canonicalise_opt (arg))) else if (!(domain = canonicalise_opt (arg)))
{ {
option = '?'; option = '?';
} }
else if (domain != NULL) else
{ {
np = add_or_lookup_domain(daemon->dh_special_domains, domain); np = add_or_lookup_domain(daemon->dh_special_domains, domain);
} }
// domain unrecognizable
if (np == NULL)
continue;
if (np->obj == NULL) if (np->obj == NULL)
{ {
obj = opt_malloc (sizeof (struct special_domain)); obj = opt_malloc (sizeof (struct special_domain));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment