Allow / in spoofed hosts
This commit is contained in:
parent
cb9345dcd1
commit
59bb80930d
|
@ -57,6 +57,7 @@ static int
|
||||||
clean_host(const char *host)
|
clean_host(const char *host)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
const char *last_slash = 0;
|
||||||
|
|
||||||
if (*host == '\0' || *host == ':')
|
if (*host == '\0' || *host == ':')
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -67,11 +68,16 @@ clean_host(const char *host)
|
||||||
|
|
||||||
if(!IsHostChar(*host))
|
if(!IsHostChar(*host))
|
||||||
return 0;
|
return 0;
|
||||||
|
if(*host == '/')
|
||||||
|
last_slash = host;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(len > HOSTLEN)
|
if(len > HOSTLEN)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if(last_slash && IsDigit(last_slash[1]))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,7 @@ const unsigned int CharAttrs[] = {
|
||||||
/* , */ PRINT_C | NONEOS_C,
|
/* , */ PRINT_C | NONEOS_C,
|
||||||
/* - */ PRINT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_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 | 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,
|
/* 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,
|
/* 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,
|
/* 2 */ PRINT_C | DIGIT_C | NICK_C | CHAN_C | NONEOS_C | USER_C | HOST_C,
|
||||||
|
|
16
src/s_user.c
16
src/s_user.c
|
@ -712,7 +712,7 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User *
|
||||||
int
|
int
|
||||||
valid_hostname(const char *hostname)
|
valid_hostname(const char *hostname)
|
||||||
{
|
{
|
||||||
const char *p = hostname;
|
const char *p = hostname, *last_slash = 0;
|
||||||
int found_sep = 0;
|
int found_sep = 0;
|
||||||
|
|
||||||
s_assert(NULL != p);
|
s_assert(NULL != p);
|
||||||
|
@ -720,7 +720,7 @@ valid_hostname(const char *hostname)
|
||||||
if(hostname == NULL)
|
if(hostname == NULL)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
if('.' == *p || ':' == *p)
|
if('.' == *p || ':' == *p || '/' == *p)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
while (*p)
|
while (*p)
|
||||||
|
@ -729,13 +729,21 @@ valid_hostname(const char *hostname)
|
||||||
return NO;
|
return NO;
|
||||||
if(*p == '.' || *p == ':')
|
if(*p == '.' || *p == ':')
|
||||||
found_sep++;
|
found_sep++;
|
||||||
|
else if(*p == '/')
|
||||||
|
{
|
||||||
|
found_sep++;
|
||||||
|
last_slash = p;
|
||||||
|
}
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(found_sep == 0)
|
if(found_sep == 0)
|
||||||
return(NO);
|
return NO;
|
||||||
|
|
||||||
return (YES);
|
if(last_slash && IsDigit(last_slash[1]))
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue