CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_11_05
Commit time: 2003-10-25 03:00:16 UTC
Modified files:
Tag: u2_10_11_05
ChangeLog ircd/gline.c
Log message:
Author: Isomer <[EMAIL PROTECTED]>
Log message:
Never dereference the "host" of a realname gline, it doesn't exist and causes
a nasty core.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.290.2.128.2.36 ircu2.10/ChangeLog:1.290.2.128.2.37
--- ircu2.10/ChangeLog:1.290.2.128.2.36 Wed Oct 15 08:14:44 2003
+++ ircu2.10/ChangeLog Fri Oct 24 20:00:01 2003
@@ -1,3 +1,7 @@
+2003-10-25 Isomer <[EMAIL PROTECTED]>
+ * ircd/gline.c: Make sure we never use the gl_host variable when we
+ are dealing with a realname (or other magical) gline.
+
2003-10-15 splidge <[EMAIL PROTECTED]>
* ircd/channel.c: Fixed buggy MODE +k handling (broke with '+k :').
Index: ircu2.10/ircd/gline.c
diff -u ircu2.10/ircd/gline.c:1.38.2.7.4.2 ircu2.10/ircd/gline.c:1.38.2.7.4.3
--- ircu2.10/ircd/gline.c:1.38.2.7.4.2 Sat Aug 30 04:49:16 2003
+++ ircu2.10/ircd/gline.c Fri Oct 24 20:00:04 2003
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: gline.c,v 1.38.2.7.4.2 2003/08/30 11:49:16 shad0w Exp $
+ * $Id: gline.c,v 1.38.2.7.4.3 2003/10/25 03:00:04 isomer Exp $
*/
#include "config.h"
@@ -88,8 +88,10 @@
{
struct Gline *gline, *sgline, *after = 0;
- if (!(flags & GLINE_BADCHAN)) { /* search for overlapping glines first */
-
+ if (!(flags & GLINE_BADCHAN)&&*user!='$') {
+ /* search for overlapping glines first, skipping badchans and
+ * special $ glines.
+ */
for (gline = GlobalGlineList; gline; gline = sgline) {
sgline = gline->gl_next;
@@ -129,9 +131,12 @@
BadChanGlineList = gline;
} else {
DupString(gline->gl_user, user); /* remember them... */
- DupString(gline->gl_host, host);
+ if (*user!='$')
+ DupString(gline->gl_host, host);
+ else
+ gline->gl_host = 0;
- if (check_if_ipmask(host)) { /* mark if it's an IP mask */
+ if (*user!='$' && check_if_ipmask(host)) { /* mark if it's an IP mask */
int class;
char ipname[16];
int ad[4] = { 0 };
@@ -301,16 +306,17 @@
if (gline->gl_lastmod)
sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
- GlineIsBadChan(gline)||GlineIsRealName(gline) ? "" : "@",
- GlineIsBadChan(gline)||GlineIsRealName(gline) ? "" :
gline->gl_host,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire - CurrentTime, gline->gl_lastmod,
gline->gl_reason);
else
sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
(GlineIsRemActive(gline) ?
"* +%s%s%s %Tu :%s" : "* -%s%s%s"),
- gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_user,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire - CurrentTime, gline->gl_reason);
return 0;
@@ -459,15 +465,15 @@
feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr) ?
cli_name(sptr) : cli_name((cli_user(sptr))->server),
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
- gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_user, gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset, gline->gl_reason);
log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
"%#C activating global %s for %s%s%s, expiring at %Tu: %s", sptr,
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
- GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset, gline->gl_reason);
if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
@@ -518,15 +524,15 @@
feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr) ?
cli_name(sptr) : cli_name((cli_user(sptr))->server),
msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
- gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_user, gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset, gline->gl_reason);
log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
"%#C %s %s for %s%s%s, expiring at %Tu: %s", sptr, msg,
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
- GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset, gline->gl_reason);
if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
@@ -584,12 +590,12 @@
(flags & GLINE_LASTMOD && !gline->gl_lastmod))
continue;
else if (flags & GLINE_EXACT) {
- if (ircd_strcmp(gline->gl_host, host) == 0 &&
+ if (gline->gl_host && ircd_strcmp(gline->gl_host, host) == 0 &&
((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
ircd_strcmp(gline->gl_user, user) == 0))
break;
} else {
- if (match(gline->gl_host, host) == 0 &&
+ if (gline->gl_host && match(gline->gl_host, host) == 0 &&
((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
match(gline->gl_user, user) == 0))
break;
@@ -678,8 +684,9 @@
else if (!GlineIsLocal(gline) && gline->gl_lastmod)
sendcmdto_one(&me, CMD_GLINE, cptr, "* [EMAIL PROTECTED] %Tu %Tu :%s",
GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
- gline->gl_host, gline->gl_expire - CurrentTime,
- gline->gl_lastmod, gline->gl_reason);
+ gline->gl_host ? gline->gl_host : "",
+ gline->gl_expire - CurrentTime, gline->gl_lastmod,
+ gline->gl_reason);
}
for (gline = BadChanGlineList; gline; gline = sgline) { /* all glines */
@@ -703,8 +710,8 @@
sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
- GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire - CurrentTime, gline->gl_lastmod,
gline->gl_reason);
@@ -724,7 +731,7 @@
/* send gline information along */
send_reply(sptr, RPL_GLIST, gline->gl_user,
GlineIsBadChan(gline) ? "" : "@",
- GlineIsBadChan(gline) ? "" : gline->gl_host,
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset,
GlineIsLocal(gline) ? cli_name(&me) : "*",
GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
@@ -735,7 +742,9 @@
if (gline->gl_expire <= CurrentTime)
gline_free(gline);
else
- send_reply(sptr, RPL_GLIST, gline->gl_user, "@", gline->gl_host,
+ send_reply(sptr, RPL_GLIST, gline->gl_user,
+ gline->gl_host ? "@" : "",
+ gline->gl_host ? gline->gl_host : "",
gline->gl_expire + TSoffset,
GlineIsLocal(gline) ? cli_name(&me) : "*",
GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
----------------------- End of diff -----------------------