/[svn]/ircd-hybrid/trunk/modules/m_webirc.c
ViewVC logotype

Diff of /ircd-hybrid/trunk/modules/m_webirc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2699 by michael, Sun Oct 27 18:56:53 2013 UTC revision 2700 by michael, Wed Dec 18 12:39:14 2013 UTC
# Line 34  Line 34 
34  #include "modules.h"  #include "modules.h"
35  #include "conf.h"  #include "conf.h"
36  #include "hostmask.h"  #include "hostmask.h"
37    #include "s_user.h"
38    
39    
 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;  
 }  
   
40  /*  /*
41   * mr_webirc   * mr_webirc
42   *      parv[0] = sender prefix   *      parv[0] = sender prefix
# Line 74  mr_webirc(struct Client *client_p, struc Line 53  mr_webirc(struct Client *client_p, struc
53    
54    assert(source_p == client_p);    assert(source_p == client_p);
55    
56    if (invalid_hostname(parv[4]))    if (!valid_hostname(parv[3]))
57    {    {
58      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,
59                 source_p->name[0] ? source_p->name : "*");                 source_p->name[0] ? source_p->name : "*");
60      return;      return;
61    }    }
# Line 132  mr_webirc(struct Client *client_p, struc Line 111  mr_webirc(struct Client *client_p, struc
111    freeaddrinfo(res);    freeaddrinfo(res);
112    
113    strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));    strlcpy(source_p->sockhost, parv[4], sizeof(source_p->sockhost));
114      strlcpy(source_p->host, parv[3], sizeof(source_p->host));
   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));  
115    
116    /* Check dlines now, k/glines will be checked on registration */    /* Check dlines now, k/glines will be checked on registration */
117    if ((conf = find_dline_conf(&client_p->localClient->ip,    if ((conf = find_dline_conf(&client_p->localClient->ip,

Legend:
Removed from v.2699  
changed lines
  Added in v.2700

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28