From 9797f0d3de2d4d8465b62c8866475a10f8b81b49 Mon Sep 17 00:00:00 2001 From: Perry Lorier Date: Sun, 26 May 2002 01:48:30 +0000 Subject: [PATCH] Author: Jeekay Log message: Patch to prevent local users joining channels with characters <=32 in their names. This closes bug #51. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@760 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 11 ++++++----- ircd/ircd.c | 2 +- ircd/m_join.c | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e3ffe0..b0d92d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2002-04-22 Alex Badea - - * ircd/m_stats.c (report_servers_verbose): include 'me' in the - server list as well - +2002-05-26 Jeekay + + * ircd/m_join.c (m_join,HasControlChars): check if a channel + name has any control chars (<=32) in it before allowing a + local user to join. + 2002-21-05 Andrew Miller * ircd/ircd_relay.c: stop an information leak about the the network topography from relayed messages. diff --git a/ircd/ircd.c b/ircd/ircd.c index e05d426..f6b0492 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -238,7 +238,7 @@ static void try_connections(struct Event* ev) { Debug((DEBUG_NOTICE, "Connection check at : %s", myctime(CurrentTime))); for (aconf = GlobalConfList; aconf; aconf = aconf->next) { /* Also when already connecting! (update holdtimes) --SRB */ - if (!(aconf->status & CONF_SERVER) || aconf->port == 0) + if (!(aconf->status & CONF_SERVER) || aconf->port == 0 || aconf->hold == 0) continue; /* Also skip juped servers */ diff --git a/ircd/m_join.c b/ircd/m_join.c index ef5c44a..ae7c537 100644 --- a/ircd/m_join.c +++ b/ircd/m_join.c @@ -101,6 +101,21 @@ #include #include +/* + * Helper function to see if there are any control characters + * in a given string + */ +static char * +HasControlChars(char *mstring) +{ + char *j; + for(j = mstring; *j ; j++) { + if(*j <= 32) { return j; } + } + + return 0; +} + /* * Helper function to find last 0 in a comma-separated list of * channel names. @@ -193,7 +208,7 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (join0(&join, cptr, sptr, name)) /* did client do a JOIN 0? */ continue; - if (!IsChannelName(name)) { /* bad channel name */ + if (!IsChannelName(name) || HasControlChars(name)) { /* bad channel name */ send_reply(sptr, ERR_NOSUCHCHANNEL, name); continue; } -- 2.20.1