From 9d7c65294f7c44323fd441327d6f2ee1e72f3b72 Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Tue, 1 Aug 2017 22:42:56 +0100 Subject: [PATCH] m_webirc: set sockhost before potentially using it to set host Remove extra IP check, it's not necessary. --- extensions/m_webirc.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/extensions/m_webirc.c b/extensions/m_webirc.c index d3572580..75381294 100644 --- a/extensions/m_webirc.c +++ b/extensions/m_webirc.c @@ -79,13 +79,6 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char const char *encr; struct rb_sockaddr_storage addr; - if ((!strchr(parv[4], '.') && !strchr(parv[4], ':')) || - strlen(parv[4]) >= sizeof(source_p->sockhost)) - { - sendto_one(source_p, "NOTICE * :Invalid IP"); - return 0; - } - aconf = find_address_conf(client_p->host, client_p->sockhost, IsGotId(client_p) ? client_p->username : "webirc", IsGotId(client_p) ? client_p->username : "webirc", @@ -124,15 +117,15 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } + source_p->localClient->ip = addr; + + rb_inet_ntop_sock((struct sockaddr *)&source_p->localClient->ip, source_p->sockhost, sizeof(source_p->sockhost)); + if(strlen(parv[3]) <= HOSTLEN) rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host)); else rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host)); - source_p->localClient->ip = addr; - - rb_inet_ntop_sock((struct sockaddr *)&source_p->localClient->ip, source_p->sockhost, sizeof(source_p->sockhost)); - /* Check dlines now, klines will be checked on registration */ if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip, source_p->localClient->ip.ss_family)))