diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-12-18 12:39:02 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-12-18 12:39:02 +0000 |
commit | 540c99433ff91359001a9951e2c4218e9c53ea5a (patch) | |
tree | 9cd1417f6d138763692399d92d75f5ecee79a2e8 /modules/m_webirc.c | |
parent | 25ef0ab0d91481d4d4e927c2ebd0b391f7181552 (diff) |
- m_webirc.c:mr_webirc(): fixed bug where parv[3] isn't tested for
a valid hostname. Spotted by Adam.
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2699 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/m_webirc.c')
-rw-r--r-- | modules/m_webirc.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/modules/m_webirc.c b/modules/m_webirc.c index 1fbe4c6..9981eaa 100644 --- a/modules/m_webirc.c +++ b/modules/m_webirc.c @@ -34,30 +34,9 @@ #include "modules.h" #include "conf.h" #include "hostmask.h" +#include "s_user.h" -static int -invalid_hostname(const char *hostname) -{ - const char *p = hostname; - unsigned int has_sep = 0; - - assert(p != NULL); - - if (*p == '.' || *p == ':') - return 1; - - for (; *p; ++p) - { - if (!IsHostChar(*p)) - return 1; - if (*p == '.' || *p == ':') - ++has_sep; - } - - return !has_sep; -} - /* * mr_webirc * parv[0] = sender prefix @@ -74,9 +53,9 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, char *parv assert(source_p == client_p); - if (invalid_hostname(parv[4])) + if (!valid_hostname(parv[3])) { - sendto_one(source_p, ":%s NOTICE %s :CGI:IRC: Invalid IP", me.name, + sendto_one(source_p, ":%s NOTICE %s :CGI:IRC: Invalid hostname", me.name, source_p->name[0] ? source_p->name : "*"); return; } @@ -132,11 +111,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, char *parv freeaddrinfo(res); strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost)); - - if (strlen(parv[3]) <= HOSTLEN) - strlcpy(source_p->host, parv[3], sizeof(source_p->host)); - else - strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host)); + strlcpy(source_p->host, parv[3], sizeof(source_p->host)); /* Check dlines now, k/glines will be checked on registration */ if ((conf = find_dline_conf(&client_p->localClient->ip, |