Skip to content

Commit 154bbfd

Browse files
committed
Port without a protocol should be valid
1 parent d649d7e commit 154bbfd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/conf.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,7 @@ _parse_firewall_rule(const char *ruleset, char *leftover)
531531
}
532532

533533
/* Get the optional port or port range */
534-
if (strncmp(leftover, "port", 4) == 0) {
535-
if(protocol == NULL ||
536-
!(strncmp(protocol, "tcp", 3) == 0 || strncmp(protocol, "udp", 3) == 0)) {
537-
debug(LOG_ERR, "ERROR: wifidog config file, section FirewallRuleset %s. Port without tcp or udp protocol.", ruleset);
538-
return -3; /*< Fail */
539-
}
534+
if (strncmp(leftover, "port", 4) == 0) {
540535
TO_NEXT_WORD(leftover, finished);
541536
/* Get port now */
542537
port = leftover;
@@ -545,7 +540,8 @@ _parse_firewall_rule(const char *ruleset, char *leftover)
545540
if (!isdigit((unsigned char)*(port + i)) && ((unsigned char)*(port + i) != ':'))
546541
all_nums = 0; /*< No longer only digits */
547542
if (!all_nums) {
548-
debug(LOG_ERR, "ERROR: wifidog config file, section FirewallRuleset %s. Invalid port %s", ruleset, port);
543+
debug(LOG_ERR, "ERROR: wifidog config file, section FirewallRuleset %s. "
544+
"Invalid port %s", ruleset, port);
549545
return -3; /*< Fail */
550546
}
551547
}

0 commit comments

Comments
 (0)