Hello,
i don't know if it is the right place to report bugs...
Distribution: Gentoo
Version: mail-filter/dspam-3.8.0-r7
Patches applied: dspam-eol.patch, dspam-tempfail.diff, patch-src__dspam.c
(Also patches seems to be harmless and help (at least one) dspam to play
well with qmail)
Environment: qmail, vpopmail
[code]
cat .qmail-default
| strace -o /var/tmp/strace.$$.log /usr/bin/dspam --deliver=innocent
--user [EMAIL PROTECTED] --process --debug --stdout |
/var/vpopmail/bin/vdelivermail '' bounce-no-mailbox
[/code]
Problem:
Randomly, dspam segfaults at
dspam[12393]: segfault at 00000014 eip b7b5cb17 esp bf8720dc error 4
dspam[12432]: segfault at 6c697a67 eip b7f44c10 esp bf92c650 error 4
dspam[12450]: segfault at 00000014 eip b7b87b17 esp bfa12a5c error 4
dspam[12817]: segfault at 0000000c eip b7b84b17 esp bfba009c error 4
i used strace, to figure out where the problem could be. Here is the
output before dspam will crash,
writev(2, [{"*** glibc detected *** ", 23}, {"/usr/bin/dspam", 14}, {":
", 2}, {"free(): invalid pointer", 23}, {": 0x", 4}, {"080ed350", 8}, {"
***\n", 5}], 7) = 79
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=147944, ...}) = 0
mmap2(NULL, 147944, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb78ed000
close(3) = 0
open("/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1", O_RDONLY) = 3
read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\30\0\0004\0\0\0"...,
512) = 512
mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
-1, 0) = 0xb769e000
munmap(0xb769e000, 401408) = 0
munmap(0xb7800000, 647168) = 0
mprotect(0xb7700000, 135168, PROT_READ|PROT_WRITE) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=42348, ...}) = 0
mmap2(NULL, 45508, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
= 0xb7f4d000
mmap2(0xb7f57000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9) = 0xb7f57000
close(3) = 0
munmap(0xb78ed000, 147944) = 0
futex(0xb7cad9fc, FUTEX_WAKE, 2147483647) = 0
futex(0xb7f580a4, FUTEX_WAKE, 2147483647) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(13069, 13069, SIGABRT) = 0
--- SIGABRT (Aborted) @ 0 (0) ---
+++ killed by SIGABRT +++
and the email get lost :(
I "hope" it is reproducible for you. That would certainly ease the tracing.
Also, i'm using sys-libs/glibc-2.6.1 libraries, gcc 4.1.2 and kernel 2.6.23
Jj
diff -ur dspam-3.6.8/src/client.c dspam-3.6.8-eol/src/client.c
--- dspam-3.6.8/src/client.c 2006-05-30 10:03:51.000000000 -0500
+++ dspam-3.6.8-eol/src/client.c 2006-11-08 12:11:44.000000000 -0600
@@ -678,6 +678,7 @@
char *ident = _ds_read_attribute(agent_config, "DeliveryIdent");
int exitcode = EFAILURE;
int msglen, code;
+ int buflen;
char *inp;
int i;
@@ -791,13 +792,34 @@
i = 0;
msglen = strlen(msg);
while(i<msglen) {
- int r = send(TTX.sockfd, msg+i, msglen - i, 0);
- if (r <= 0) {
- LOG(LOG_ERR, ERR_CLIENT_SEND_FAILED);
- STATUS(ERR_CLIENT_SEND_FAILED);
- goto BAIL;
+ int r;
+ int t;
+
+ /* fill buf with partial msg, replacing \n with \r\n */
+ buflen = 0;
+ while (buflen < (sizeof(buf) - 1) && i < msglen) {
+ /* only replace \n and not \r\n */
+ if (i > 0 && msg[i] == '\n' && msg[i - 1] != '\r') {
+ buf[buflen] = '\r';
+ buflen++;
+ }
+
+ buf[buflen] = msg[i];
+ buflen++;
+ i++;
+ }
+
+ /* send buf */
+ t = 0;
+ while (t < buflen) {
+ r = send(TTX.sockfd, buf+t, buflen - t, 0);
+ if (r <= 0) {
+ LOG(LOG_ERR, ERR_CLIENT_SEND_FAILED);
+ STATUS(ERR_CLIENT_SEND_FAILED);
+ goto BAIL;
+ }
+ t += r;
}
- i += r;
}
if (msg[strlen(msg)-1]!= '\n') {
--- src/dspam.c.dist Sat Oct 28 04:16:43 2006
+++ src/dspam.c Sat Oct 28 04:17:04 2006
@@ -2321,8 +2321,8 @@
while (user != NULL)
{
- if (!strcmp (user, username) || user[0] == '*' ||
- (!strncmp(user, "*@", 2) && !strcmp(user+2, strchr(username,'@'))))
+ if (!strcmp (user, username) || (user[0] == '*' && strncmp(user, "*@", 2)) ||
+ (!strncmp(user, "*@", 2) && !strcmp(user+1, strchr(username,'@'))))
{
/* If we're reporting a spam, report it as a spam to all other
diff -u -b -r dspam-3.6.8/src/client.c dspam-3.6.8p1/src/client.c
--- dspam-3.6.8/src/client.c 2006-05-30 11:03:51.000000000 -0400
+++ dspam-3.6.8p1/src/client.c 2006-11-02 15:32:34.000000000 -0500
@@ -56,6 +56,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#include <sysexits.h>
#include "client.h"
#include "dspam.h"
@@ -819,6 +820,8 @@
code = client_getcode(&TTX, err, sizeof(err));
if (code < 200 || code >= 300) {
LOG(LOG_ERR, ERR_CLIENT_RESPONSE, code, "message data", err);
+ if (code >= 400 && code < 500)
+ exitcode = EX_TEMPFAIL;
if (code >= 500)
exitcode = EINVAL;
chomp(err);
@@ -835,6 +838,9 @@
QUIT:
send_socket(&TTX, "QUIT");
client_getcode(&TTX, err, sizeof(err));
+ buffer_destroy(TTX.packet_buffer);
+ close(TTX.sockfd);
+ return exitcode;
BAIL:
LOG(LOG_ERR, ERR_CLIENT_DELIVERY_FAILED);
--- dspam-3.6.8/src/dspam.c 2006-05-30 11:03:55.000000000 -0400
+++ dspam-3.6.8p1/src/dspam.c 2006-11-02 15:28:45.000000000 -0500
@@ -51,6 +51,7 @@
#include <sys/stat.h>
#include <netdb.h>
#include <sys/socket.h>
+#include <sysexits.h>
#ifdef _WIN32
#include <io.h>
@@ -1994,11 +1995,11 @@
nt_add(ATX->results, presult);
else
free(presult);
- LOGDEBUG ("DSPAM Instance Shutdown. Exit Code: %d", return_code);
+ LOGDEBUG ("DSPAM Instance Shutdown. Exit Code: %d", retcode);
buffer_destroy(parse_message);
}
- return return_code;
+ return retcode;
}
// break
// load_agg