On Fri, 17 Jun 2005, Otto Moerbeek wrote:

> This looks ok. I suggest you setup a local blacklist with an IP you
> can use to connect to the mail machine. After that, use "nc mailserver
> 25" from that IP to connect to the machine and you'll see what is
> going on.

While playing with this myself, I found that spamd has an off-by one:
the last entry in a blacklist does not get handled properly. This is
supposed to fix it, diff against -current.

        -Otto

Index: sdl.c
===================================================================
RCS file: /cvs/src/libexec/spamd/sdl.c,v
retrieving revision 1.12
diff -u -r1.12 sdl.c
--- sdl.c       26 Feb 2004 08:18:56 -0000      1.12
+++ sdl.c       17 Jun 2005 18:54:51 -0000
@@ -75,11 +75,12 @@
        }
        if (index != -1) {
                if (debug > 0)
-                       printf("replacing list %s\n", blacklists[index].tag);
+                       printf("replacing list %s; %d new entries\n",
+                           blacklists[index].tag, addrc);
                sdl_free(&blacklists[index]);
        } else {
                if (debug > 0)
-                       printf("adding list %s\n", sdname);
+                       printf("adding list %s; %d entries\n", sdname, addrc);
                index = blu;
        }
        if (index == blu && blu == blc) {
Index: spamd.c
===================================================================
RCS file: /cvs/src/libexec/spamd/spamd.c,v
retrieving revision 1.78
diff -u -r1.78 spamd.c
--- spamd.c     23 May 2005 21:08:43 -0000      1.78
+++ spamd.c     17 Jun 2005 18:54:51 -0000
@@ -231,13 +231,10 @@
        } while ((av[au++] = strsep(&cp, ";")) != NULL);
 
        /* toss empty last entry to allow for trailing ; */
-       if (av[au - 1][0] == '\0');
+       while (au > 0 && (av[au - 1] == NULL || av[au - 1][0] == '\0'))
                au--;
 
-       if (au < 1)
-               goto parse_error;
-       else
-               sdl_add(name, msg, av, au - 1);
+       sdl_add(name, msg, av, au);
        return (0);
 
 parse_error:

Reply via email to