diff options
author | venaas <venaas> | 2009-01-29 14:08:41 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2009-01-29 14:08:41 +0000 |
commit | 39bedc61c523e84a3b7c2d01ebb4fd2e075d02db (patch) | |
tree | 7fc9924345536e479ea67a948b43562de9e9ac35 /hostport.c | |
parent | 392c109abc2a14421f4e56f587b8d24a6fb3d6c3 (diff) |
small fix to allow IPv6 prefixes
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@465 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'hostport.c')
-rw-r--r-- | hostport.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; |