m_webirc: use rb_inet_ntop_sock to populate sockhost

This commit is contained in:
Simon Arlott 2017-06-27 20:45:02 +01:00
parent 62c0ac4124
commit 51d65d191a
No known key found for this signature in database
GPG key ID: B98AF2C7BD763505

View file

@ -80,8 +80,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
struct rb_sockaddr_storage addr;
if ((!strchr(parv[4], '.') && !strchr(parv[4], ':')) ||
strlen(parv[4]) + (*parv[4] == ':') >=
sizeof(source_p->sockhost))
strlen(parv[4]) >= sizeof(source_p->sockhost))
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
@ -125,16 +124,6 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
return 0;
}
if (*parv[4] == ':')
{
source_p->sockhost[0] = '0';
rb_strlcpy(source_p->sockhost + 1, parv[4],
sizeof(source_p->sockhost) - 1);
}
else
rb_strlcpy(source_p->sockhost, parv[4],
sizeof(source_p->sockhost));
if(strlen(parv[3]) <= HOSTLEN)
rb_strlcpy(source_p->host, parv[3], sizeof(source_p->host));
else
@ -142,6 +131,8 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
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)))