1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 10:23:13 +02:00

- Fixed ~c not working properly with * and ?'s in channel names.. Now you just need to

escape them like in all bans (eg: to ban #* you need to +b ~c:#\*). As an additional
  bonus, real wildcards are now accepted and processed (eg: +b ~c:#*sex*, just don't
  forget to specify the #). Reported by PhantasyX (#2605).
- Sidenote on above: ~c:*chan* is not supported (use ~c:#*chan* instead) because it would
  cause "hidden bans", therefore it now prints a message (which is useful anyway), but
  does accept such remote bans. In 3.2.5 or so we could enable support for it, it's
  not that important though... ;)
- Added ifdefs for mass closing of file descriptors on start, can now be disabled by
  adding -DNOCLOSEFD as a compile option. Useful for valgrind w/--db-attach=yes, mpatrol,
  and some other debugging tools (not useful for anyone normally running a server).
- Fixed a read-after-free: sptr->serv->aconf was freed but not NULL'ed in exit_client,
  causing close_connection to read from it (when deciding on doing a quick reconnect).
  Could have caused a crash, although nobody ever reported one...
- Removed useless strncpyzt with dest==src.
This commit is contained in:
Bram Matthys
2005-08-19 15:14:30 +00:00
parent df37fc9d5e
commit b340844aed
5 changed files with 54 additions and 5 deletions
+15
View File
@@ -817,3 +817,18 @@
enabled by default even without -Wall (!?) on GCC4.
- Fixed a bug where allow channel::channel generated a warning when specified multiple times
(#0002427) reported by matridom.
- Fixed ~c not working properly with * and ?'s in channel names.. Now you just need to
escape them like in all bans (eg: to ban #* you need to +b ~c:#\*). As an additional
bonus, real wildcards are now accepted and processed (eg: +b ~c:#*sex*, just don't
forget to specify the #). Reported by PhantasyX (#2605).
- Sidenote on above: ~c:*chan* is not supported (use ~c:#*chan* instead) because it would
cause "hidden bans", therefore it now prints a message (which is useful anyway), but
does accept such remote bans. In 3.2.5 or so we could enable support for it, it's
not that important though... ;)
- Added ifdefs for mass closing of file descriptors on start, can now be disabled by
adding -DNOCLOSEFD as a compile option. Useful for valgrind w/--db-attach=yes, mpatrol,
and some other debugging tools (not useful for anyone normally running a server).
- Fixed a read-after-free: sptr->serv->aconf was freed but not NULL'ed in exit_client,
causing close_connection to read from it (when deciding on doing a quick reconnect).
Could have caused a crash, although nobody ever reported one...
- Removed useless strncpyzt with dest==src.
+27 -2
View File
@@ -163,7 +163,8 @@ char *chan, *p, symbol='\0';
if ((*chan == '+') || (*chan == '%') || (*chan == '%') ||
(*chan == '@') || (*chan == '&') || (*chan == '~'))
chan++;
if (*chan != '#')
if ((*chan != '#') && (*chan != '*') && (*chan != '?'))
return NULL;
if (strlen(chan) > CHANNELLEN)
@@ -175,6 +176,29 @@ char *chan, *p, symbol='\0';
/* on a sidenote '#' is allowed because it's a valid channel (atm) */
return retbuf;
}
/* The only purpose of this function is a temporary workaround to prevent a desynch.. pfff */
int extban_modec_is_ok(aClient *sptr, aChannel *chptr, char *para, int checkt, int what, int what2)
{
char *p;
if ((checkt == EXBCHK_PARAM) && MyClient(sptr) && (what == MODE_ADD) && (strlen(para) > 3))
{
p = para + 3;
if ((*p == '+') || (*p == '%') || (*p == '%') ||
(*p == '@') || (*p == '&') || (*p == '~'))
p++;
if (*p != '#')
{
sendnotice(sptr, "Please use a # in the channelname (eg: ~c:#*blah*)");
return 0;
}
}
return 1;
}
static int extban_modec_compareflags(char symbol, int flags)
{
int require=0;
@@ -206,7 +230,7 @@ char *p = ban+3, symbol = '\0';
}
for (lp = sptr->user->channel; lp; lp = lp->next)
{
if (!strcasecmp(lp->chptr->chname, p))
if (!match(p, lp->chptr->chname))
{
/* Channel matched, check symbol if needed (+/%/@/etc) */
if (symbol)
@@ -315,6 +339,7 @@ void extban_init(void)
req.flag = 'c';
req.conv_param = extban_modec_conv_param;
req.is_banned = extban_modec_is_banned;
req.is_ok = extban_modec_is_ok;
ExtbanAdd(NULL, req);
req.flag = 'q';
req.conv_param = extban_conv_param_nuh;
-2
View File
@@ -866,8 +866,6 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
else /* Failsafe point, don't let the user define their
own hostname via the USER command --Cabal95 */
strncpyzt(user->realhost, sptr->sockhost, HOSTLEN + 1);
strncpyzt(user->realhost, user->realhost,
sizeof(user->realhost));
/*
* I do not consider *, ~ or ! 'hostile' in usernames,
* as it is easy to differentiate them (Use \*, \? and \\)
+11 -1
View File
@@ -615,16 +615,20 @@ char logbuf[BUFSIZ];
# endif
#endif
#ifndef _WIN32
#ifndef NOCLOSEFD
for (fd = 3; fd < MAXCONNECTIONS; fd++)
{
(void)close(fd);
}
(void)close(1);
#endif
if (bootopt & BOOT_TTY) /* debugging is going to a tty */
goto init_dgram;
#ifndef NOCLOSEFD
if (!(bootopt & BOOT_DEBUG))
(void)close(2);
#endif
if ((bootopt & BOOT_CONSOLE) || isatty(0))
{
@@ -637,7 +641,9 @@ if ((bootopt & BOOT_CONSOLE) || isatty(0))
if ((fd = open("/dev/tty", O_RDWR)) >= 0)
{
(void)ioctl(fd, TIOCNOTTY, (char *)NULL);
#ifndef NOCLOSEFD
(void)close(fd);
#endif
}
#endif
@@ -647,15 +653,19 @@ if ((bootopt & BOOT_CONSOLE) || isatty(0))
#else
(void)setpgrp(0, (int)getpid());
#endif
#ifndef NOCLOSEFD
(void)close(0); /* fd 0 opened by inetd */
#endif
local[0] = NULL;
}
init_dgram:
#else
#ifndef NOCLOSEFD
close(fileno(stdin));
close(fileno(stdout));
if (!(bootopt & BOOT_DEBUG))
close(fileno(stderr));
#endif
memset(local, 0, sizeof(aClient*) * MAXCONNECTIONS);
LastSlot = -1;
@@ -902,7 +912,7 @@ void close_connection(aClient *cptr)
* the SQUIT flag has been set, then we don't schedule a fast
* reconnect. Pisses off too many opers. :-) -Cabal95
*/
if (IsServer(cptr) && !(cptr->flags & FLAGS_SQUIT) &&
if (IsServer(cptr) && !(cptr->flags & FLAGS_SQUIT) && cptr->serv->conf &&
(!cptr->serv->conf->flag.temporary &&
(cptr->serv->conf->options & CONNECT_AUTO)))
{
+1
View File
@@ -476,6 +476,7 @@ int exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
{
Debug((DEBUG_ERROR, "deleting temporary block %s", sptr->serv->conf->servername));
delete_linkblock(sptr->serv->conf);
sptr->serv->conf = NULL;
}
}
if (IsServer(sptr))