summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-12-14 00:04:29 +0000
committerNick Mathewson <nickm@torproject.org>2003-12-14 00:04:29 +0000
commitfb95d99f79c511178f0d60a707534687d86acc87 (patch)
treefecbbb67cabdb593be98c149622ab32707aecb1c
parent78a7de300c000bdc7cccd9187721e0d4eb18423a (diff)
downloadtor-fb95d99f79c511178f0d60a707534687d86acc87.tar.gz
tor-fb95d99f79c511178f0d60a707534687d86acc87.zip
Accept 1.2.3.4/x as a synonym for 1.2.3.4/x:* .
svn:r912
-rw-r--r--src/or/routerlist.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index daed36aad8..87a063e33c 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -911,11 +911,13 @@ static int router_add_exit_policy(routerinfo_t *router,
address = arg;
mask = strchr(arg,'/');
port = strchr(mask?mask:arg,':');
- if(!port)
- goto policy_read_failed;
+ /* Break 'arg' into separate strings. 'arg' was already strdup'd by
+ * _router_get_next_token, so it's safe to modify.
+ */
if (mask)
*mask++ = 0;
- *port++ = 0;
+ if (port)
+ *port++ = 0;
if (strcmp(address, "*") == 0) {
newe->addr = 0;
@@ -945,7 +947,7 @@ static int router_add_exit_policy(routerinfo_t *router,
goto policy_read_failed;
}
}
- if (strcmp(port, "*") == 0) {
+ if (!port || strcmp(port, "*") == 0) {
newe->prt_min = 1;
newe->prt_max = 65535;
} else {