[IRCServices] ircservices dev

Andrew Church achurch at achurch.org
Fri Nov 3 15:49:54 PST 2006


>(gdb) bt
>#0  0x0805551e in sstrdup (s=0x0) at memory.c:89
>#1  0x0805e4a1 in match_usermask (mask=0x0, user=0x85a15a0) at users.c:696
>#2  0x007156f1 in check_kick (user=0x85a15a0, chan=0xbffe16d1 "#latinchat",

     That's odd; there shouldn't be any NULL entries in the autokick list.
I don't know why you'd have such, but try the patch below which works
around the problem.

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/

---------------------------------------------------------------------------

Index: users.c
===================================================================
RCS file: /var/local/cvsroot/ircservices/users.c,v
retrieving revision 2.71
diff -u -r2.71 users.c
--- users.c	6 Jun 2006 04:45:29 -0000	2.71
+++ users.c	3 Nov 2006 06:48:33 -0000
@@ -693,10 +693,15 @@
 
 int match_usermask(const char *mask, const User *user)
 {
-    char *mask2 = sstrdup(mask);
+    char *mask2;
     char *nick, *username, *host;
     int match_user, match_host, result;
 
+    if (!mask || !user) {
+        log_debug(1, "match_usermask: NULL %s!", !mask ? "mask" : "user");
+        return 0;
+    }
+    mask2 = sstrdup(mask);
     if (strchr(mask2, '!')) {
         nick = strtok(mask2, "!");
         username = strtok(NULL, "@");
Index: modules/chanserv/check.c
===================================================================
RCS file: /var/local/cvsroot/ircservices/modules/chanserv/check.c,v
retrieving revision 2.84
diff -u -r2.84 check.c
--- modules/chanserv/check.c	5 Oct 2006 18:00:53 -0000	2.84
+++ modules/chanserv/check.c	3 Nov 2006 06:48:33 -0000
@@ -371,6 +371,12 @@
     }
 
     ARRAY_FOREACH (i, ci->akick) {
+        if (!ci->akick[i].mask) {
+            log_debug(1, "%s autokick %d has NULL mask, deleting", ci->name,i);
+            ARRAY_REMOVE(ci->akick, i);
+            i--;
+            continue;
+        }
         if (match_usermask(ci->akick[i].mask, user)) {
             module_log_debug(2, "%s matched akick %s",
                              user->nick, ci->akick[i].mask);