
Some htonl calls were missing when checking for the 0.0.0.1 IP address, which indicates that a non-IPv4 address was passed through a server that does not have the NICKIPSTR capability. Also ensure that the hostip field is correctly set for numeric IP addresses. --- src/s_user.c | 9 +++++++-- src/struct.c | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/s_user.c b/src/s_user.c index 6e582bb..dd55f9b 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -2167,10 +2167,15 @@ do_user(char *nick, aClient *cptr, aClient *sptr, char *username, char *host, unsigned long l; l = ntohl(strtoul(ip, &end, 10)); - if (*ip != '\0' && *end == '\0' && l != 1) + if (*ip != '\0' && *end == '\0') { - sptr->ip_family = AF_INET; + if (l != htonl(1)) + sptr->ip_family = AF_INET; + else + sptr->ip_family = 0; + sptr->ip.ip4.s_addr = l; + ip = inetntoa((char *)&sptr->ip); } else sptr->ip_family = 0; diff --git a/src/struct.c b/src/struct.c index a3d705e..55107d7 100644 --- a/src/struct.c +++ b/src/struct.c @@ -128,7 +128,11 @@ struct in_addr ac_ip(aClient *cptr) if (cptr->ip_family == AF_INET) return cptr->ip.ip4; else - return (struct in_addr){1}; + { + int ip = htonl(1); + + return (struct in_addr){ip}; + } } char *ac_hostip(aClient *cptr) -- 1.7.2.3