On Thu, 11 Jan 2007, Steven Chan wrote:
> A patch against version 3.6.8 is attached. It makes changes to file
> dspam.c, in functions do_notifications() and send_notice().
>
> The author or authors of this submission hereby release any and all
> copyright interest in this code, documentation, or other materials
> included to the DSPAM project and its primary governors. We intend this
> relinquishment of copyright interest in perpetuity of all present and
> future rights to said submission under copyright law.
Apologies, but I forgot to attach the patch. Here it is.
--
Steven Chan
Vancouver Community Network
--- dspam.c.old 2007-01-06 17:22:53.000000000 -0800
+++ dspam.c 2007-01-07 00:15:08.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: dspam.c,v 1.1 2007/01/02 05:43:49 root Exp $ */
+/* $Id: dspam.c,v 1.2 2007/01/02 08:57:13 root Exp root $ */
/*
DSPAM
@@ -1476,6 +1476,9 @@
return EUNKNOWN;
}
+ snprintf(buf, sizeof(buf), "From DSPAM %s", ctime(&now));
+ buffer_cat(b, buf);
+
strftime(buf,sizeof(buf), "Date: %a, %d %b %Y %H:%M:%S %z\n",
localtime(&now));
buffer_cat(b, buf);
@@ -1493,8 +1496,13 @@
buffer_cat(b, s);
}
fclose(f);
- ret = deliver_message(ATX, b->data, mailer_args, username,
- stdout, DSR_ISINNOCENT);
+ ret = deliver_message(ATX, b->data,
+ (ATX->flags & DAF_STDOUT) ? NULL : ATX->mailer_args,
+ username,
+ ATX->sockfd ? ATX->sockfd : stdout,
+ DSR_ISINNOCENT);
+ if (ATX->sockfd && ATX->flags & DAF_STDOUT)
+ ATX->sockfd_output = 1;
buffer_destroy(b);
@@ -3875,11 +3883,13 @@
if (file == NULL) {
LOGDEBUG("sending firstrun.txt to %s (%s): %s",
CTX->username, filename, strerror(errno));
- send_notice(ATX, "firstrun.txt", ATX->mailer_args, CTX->username);
- file = fopen(filename, "w");
- if (file) {
- fprintf(file, "%ld\n", (long) time(NULL));
- fclose(file);
+ if (!send_notice(ATX, "firstrun.txt", ATX->mailer_args, CTX->username)) {
+ _ds_prepare_path_for(filename);
+ file = fopen(filename, "w");
+ if (file) {
+ fprintf(file, "%ld\n", (long) time(NULL));
+ fclose(file);
+ }
}
} else {
fclose(file);
@@ -3899,11 +3909,13 @@
if (file == NULL) {
LOGDEBUG("sending firstspam.txt to %s (%s): %s",
CTX->username, filename, strerror(errno));
- send_notice(ATX, "firstspam.txt", ATX->mailer_args, CTX->username);
- file = fopen(filename, "w");
- if (file) {
- fprintf(file, "%ld\n", (long) time(NULL));
- fclose(file);
+ if (!send_notice(ATX, "firstspam.txt", ATX->mailer_args, CTX->username))
{
+ _ds_prepare_path_for(filename);
+ file = fopen(filename, "w");
+ if (file) {
+ fprintf(file, "%ld\n", (long) time(NULL));
+ fclose(file);
+ }
}
} else {
fclose(file);
@@ -3924,13 +3936,13 @@
LOOKUP(ATX->PTX, CTX->username), "mboxwarn");
if (stat(qfile, &s)) {
FILE *f;
-
- f = fopen(qfile, "w");
- if (f != NULL) {
- fprintf(f, "%ld", (long) time(NULL));
- fclose(f);
-
- send_notice(ATX, "quarantinefull.txt", ATX->mailer_args,
CTX->username);
+ if (!send_notice(ATX, "quarantinefull.txt", ATX->mailer_args,
CTX->username)) {
+ _ds_prepare_path_for(qfile);
+ f = fopen(qfile, "w");
+ if (f != NULL) {
+ fprintf(f, "%ld", (long) time(NULL));
+ fclose(f);
+ }
}
}
}