]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/s_user.c
Allow / in spoofed hosts
[irc/rqf/shadowircd.git] / src / s_user.c
index 7ba25c34a26d4b859e8737ac155d36a7e1bbce5e..71c9b8d32ff4a5c42d7be4b6bb33877fed488b91 100644 (file)
@@ -712,7 +712,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
 int
 valid_hostname(const char *hostname)
 {
-       const char *p = hostname;
+       const char *p = hostname, *last_slash = 0;
        int found_sep = 0;
 
        s_assert(NULL != p);
@@ -720,7 +720,7 @@ valid_hostname(const char *hostname)
        if(hostname == NULL)
                return NO;
 
-       if('.' == *p || ':' == *p)
+       if('.' == *p || ':' == *p || '/' == *p)
                return NO;
 
        while (*p)
@@ -729,13 +729,21 @@ valid_hostname(const char *hostname)
                        return NO;
                 if(*p == '.' || *p == ':')
                        found_sep++;
+               else if(*p == '/')
+               {
+                       found_sep++;
+                       last_slash = p;
+               }
                p++;
        }
 
        if(found_sep == 0)
-               return(NO);
+               return NO;
 
-       return (YES);
+       if(last_slash && IsDigit(last_slash[1]))
+               return NO;
+
+       return YES;
 }
 
 /*