1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 09:43:12 +02:00

CHGNAME and SETNAME: if a remote user used a realname that was banned

on this server then we could possibly crash. (Fortunately most networks
use the same ban realname blocks on all their servers)
This commit is contained in:
Bram Matthys
2019-02-10 14:54:28 +01:00
parent 3712fad891
commit 1f03dbdd05
2 changed files with 32 additions and 23 deletions
+10 -7
View File
@@ -116,14 +116,17 @@ CMD_FUNC(m_chgname)
/* set the realname to make ban checking work */
ircsnprintf(acptr->info, sizeof(acptr->info), "%s", parv[2]);
/* only check for realname bans if the person who's name is being changed is NOT an oper */
if (!ValidatePermissionsForPath("immune:server-ban:ban-realname",acptr,NULL,NULL,NULL) &&
((bconf = Find_ban(NULL, acptr->info, CONF_BAN_REALNAME))))
if (MyClient(acptr))
{
int xx = banned_client(acptr, "realname", bconf->reason?bconf->reason:"", 0, 0);
if (sptr == acptr)
return xx; /* we just killed ourselves */
return 0;
/* only check for realname bans if the person who's name is being changed is NOT an oper */
if (!ValidatePermissionsForPath("immune:server-ban:ban-realname",acptr,NULL,NULL,NULL) &&
((bconf = Find_ban(NULL, acptr->info, CONF_BAN_REALNAME))))
{
int xx = banned_client(acptr, "realname", bconf->reason?bconf->reason:"", 0, 0);
if (sptr == acptr)
return xx; /* we just killed ourselves */
return 0;
}
}
sendto_server(cptr, 0, 0, ":%s CHGNAME %s :%s",
+22 -16
View File
@@ -82,24 +82,30 @@ CMD_FUNC(m_setname)
return 0;
}
/* set temp info for spamfilter check*/
strcpy(tmpinfo, sptr->info);
/* set the new name before we check, but don't send to servers unless it is ok */
strcpy(sptr->info, parv[1]);
spamfilter_build_user_string(spamfilter_user, sptr->name, sptr);
xx = dospamfilter(sptr, spamfilter_user, SPAMF_USER, NULL, 0, NULL);
if (xx < 0)
if (MyClient(sptr))
{
if (xx != FLUSH_BUFFER)
strcpy(sptr->info, tmpinfo); /* restore (if client wasn't killed already, that is) */
return xx;
}
/* set temp info for spamfilter check*/
strcpy(tmpinfo, sptr->info);
/* set the new name before we check, but don't send to servers unless it is ok */
strcpy(sptr->info, parv[1]);
spamfilter_build_user_string(spamfilter_user, sptr->name, sptr);
xx = dospamfilter(sptr, spamfilter_user, SPAMF_USER, NULL, 0, NULL);
if (xx < 0)
{
if (xx != FLUSH_BUFFER)
strcpy(sptr->info, tmpinfo); /* restore (if client wasn't killed already, that is) */
return xx;
}
/* Check for realname bans here too */
if (!ValidatePermissionsForPath("immune:server-ban:ban-realname",sptr,NULL,NULL,NULL) &&
((bconf = Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))))
{
return banned_client(sptr, "realname", bconf->reason?bconf->reason:"", 0, 0);
/* Check for realname bans here too */
if (!ValidatePermissionsForPath("immune:server-ban:ban-realname",sptr,NULL,NULL,NULL) &&
((bconf = Find_ban(NULL, sptr->info, CONF_BAN_REALNAME))))
{
return banned_client(sptr, "realname", bconf->reason?bconf->reason:"", 0, 0);
}
} else {
/* remote user */
strcpy(sptr->info, parv[1]);
}
sendto_server(cptr, 0, 0, ":%s SETNAME :%s", sptr->name, parv[1]);