version 1.242, 2013/10/23 05:40:58 |
version 1.243, 2013/10/24 00:51:48 |
|
|
static int |
static int |
match_cfg_line(char **condition, int line, struct connection_info *ci) |
match_cfg_line(char **condition, int line, struct connection_info *ci) |
{ |
{ |
int result = 1, port; |
int result = 1, attributes = 0, port; |
char *arg, *attrib, *cp = *condition; |
char *arg, *attrib, *cp = *condition; |
size_t len; |
size_t len; |
|
|
|
|
ci->laddress ? ci->laddress : "(null)", ci->lport); |
ci->laddress ? ci->laddress : "(null)", ci->lport); |
|
|
while ((attrib = strdelim(&cp)) && *attrib != '\0') { |
while ((attrib = strdelim(&cp)) && *attrib != '\0') { |
|
attributes++; |
|
if (strcasecmp(attrib, "all") == 0) { |
|
if (attributes != 1 || |
|
((arg = strdelim(&cp)) != NULL && *arg != '\0')) { |
|
error("'all' cannot be combined with other " |
|
"Match attributes"); |
|
return -1; |
|
} |
|
*condition = cp; |
|
return 1; |
|
} |
if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { |
if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { |
error("Missing Match criteria for %s", attrib); |
error("Missing Match criteria for %s", attrib); |
return -1; |
return -1; |
|
|
error("Unsupported Match attribute %s", attrib); |
error("Unsupported Match attribute %s", attrib); |
return -1; |
return -1; |
} |
} |
|
} |
|
if (attributes == 0) { |
|
error("One or more attributes required for Match"); |
|
return -1; |
} |
} |
if (ci != NULL) |
if (ci != NULL) |
debug3("match %sfound", result ? "" : "not "); |
debug3("match %sfound", result ? "" : "not "); |