summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-08-04 09:48:28 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-08-04 09:48:28 +0000
commit26f08471345c3acb83f0fd8c3c9c99c249e47bfe (patch)
tree300ad2411cd608568ea3fd240344e3215f57cd79
parent54b5937977a06e34c35f2d490a844c7daee907fe (diff)
Fix handling of empty entries at the end of an address list; avoids
always skipping the last address. ok beck@
-rw-r--r--libexec/spamd/sdl.c7
-rw-r--r--libexec/spamd/spamd.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/libexec/spamd/sdl.c b/libexec/spamd/sdl.c
index 16cf8f6a3f7..bfac803ee6e 100644
--- a/libexec/spamd/sdl.c
+++ b/libexec/spamd/sdl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdl.c,v 1.12 2004/02/26 08:18:56 deraadt Exp $ */
+/* $OpenBSD: sdl.c,v 1.13 2005/08/04 09:48:27 otto Exp $ */
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
@@ -75,11 +75,12 @@ sdl_add(char *sdname, char *sdstring, char ** addrs, int addrc)
}
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) {
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c
index 2f26d302a33..7eb37517800 100644
--- a/libexec/spamd/spamd.c
+++ b/libexec/spamd/spamd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamd.c,v 1.78 2005/05/23 21:08:43 frantzen Exp $ */
+/* $OpenBSD: spamd.c,v 1.79 2005/08/04 09:48:27 otto Exp $ */
/*
* Copyright (c) 2002 Theo de Raadt. All rights reserved.
@@ -231,13 +231,13 @@ parse_configline(char *line)
} 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: