From 39bedc61c523e84a3b7c2d01ebb4fd2e075d02db Mon Sep 17 00:00:00 2001 From: venaas Date: Thu, 29 Jan 2009 14:08:41 +0000 Subject: small fix to allow IPv6 prefixes git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@465 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- hostport.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'hostport.c') diff --git a/hostport.c b/hostport.c index b934626..9360299 100644 --- a/hostport.c +++ b/hostport.c @@ -45,7 +45,7 @@ static int parsehostport(struct hostportres *hp, char *hostport, char *default_p ipv6 = 1; } else { field = p; - for (; *p && *p != ':' && *p != ' ' && *p != '\t' && *p != '\n'; p++); + for (; *p && *p != ':' && *p != '/' && *p != ' ' && *p != '\t' && *p != '\n'; p++); } if (field == p) { debug(DBG_ERR, "missing host/address"); @@ -55,7 +55,7 @@ static int parsehostport(struct hostportres *hp, char *hostport, char *default_p hp->host = stringcopy(field, p - field); if (ipv6) { p++; - if (*p && *p != ':' && *p != ' ' && *p != '\t' && *p != '\n') { + if (*p && *p != ':' && *p != '/' && *p != ' ' && *p != '\t' && *p != '\n') { debug(DBG_ERR, "unexpected character after ]"); return 0; } @@ -94,7 +94,7 @@ struct hostportres *newhostport(char *hostport, char *default_port, uint8_t pref hp->host = NULL; } - slash = hp->host ? strchr(hp->host, '/') : NULL; + slash = hostport ? strchr(hostport, '/') : NULL; if (slash) { if (!prefixok) { debug(DBG_WARN, "newhostport: prefix not allowed here", hp->host); @@ -116,7 +116,6 @@ struct hostportres *newhostport(char *hostport, char *default_port, uint8_t pref goto errexit; } hp->prefixlen = plen; - *slash = '\0'; } else hp->prefixlen = 255; return hp; -- cgit v1.1