diff --git a/modules/m_chghost.c b/modules/m_chghost.c index 57bffa9..647ee68 100644 --- a/modules/m_chghost.c +++ b/modules/m_chghost.c @@ -57,6 +57,7 @@ static int clean_host(const char *host) { int len = 0; + const char *last_slash = 0; if (*host == '\0' || *host == ':') return 0; @@ -67,11 +68,16 @@ clean_host(const char *host) if(!IsHostChar(*host)) return 0; + if(*host == '/') + last_slash = host; } if(len > HOSTLEN) return 0; + if(last_slash && IsDigit(last_slash[1])) + return 0; + return 1; } diff --git a/src/match.c b/src/match.c index d0b9831..a0509c4 100644 --- a/src/match.c +++ b/src/match.c @@ -702,7 +702,7 @@ const unsigned int CharAttrs[] = { /* , */ PRINT_C | NONEOS_C, /* - */ PRINT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C, /* . */ PRINT_C | KWILD_C | CHAN_C | NONEOS_C | USER_C | HOST_C | SERV_C, -/* / */ PRINT_C | CHAN_C | NONEOS_C, +/* / */ PRINT_C | CHAN_C | NONEOS_C | HOST_C, /* 0 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C, /* 1 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C, /* 2 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C, diff --git a/src/s_user.c b/src/s_user.c index 7ba25c3..71c9b8d 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -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; } /*