dspam-users,
I'm not sure if anyone cares (anymore), but I still use dspam and it
works great.
I found one solution to the truncation of emails when dspamc (dspam
--client) is called (patch below).
When dspam in daemon mode receives a message from dspam client it is
sent to the daemon with dot stuffing/de-stuffing respectively, however,
on return from the daemon to the dspam client the message was not dot
stuffed/de-stuffed.
# cat ../SOURCES/dspam-stuffdot.patch
--- ./src/dspam.c 2012-04-11 12:48:33.000000000 -0600
+++ ./src/dspam.new.c 2021-04-12 13:21:58.919951576 -0600
@@ -103,6 +103,40 @@
#define USE_SMTP (_ds_read_attribute(agent_config,
"DeliveryProto") && !strcmp(_ds_read_attribute(agent_config,
"DeliveryProto"), "SMTP"))
#define LOOKUP(A, B) ((_ds_pref_val(A, "localStore")[0]) ?
_ds_pref_val(A, "localStore") : B)
+buffer * stuff_dot(char * message);
+/*
+** buffer * stuff_dot(char * message);
+**
+** DESCRIPTION
+** Stuff '.' where necessary for SMTP Protocol
+**
+** INPUT ARGUMENTS
+** char * message
+**
+** RETURN VALUES
+** Returns buffer * msg
+**
+** Author
+** Eric C. Broch
+**
+*/
+buffer * stuff_dot(char * message) {
+
+ buffer * msg;
+ int i = 0;
+
+ msg = buffer_create(NULL);
+ while(i<strlen(message)) {
+ if (buffer_ncat(msg,&message[i],1)) return NULL;
+ if (i == strlen(message)-1) break;
+ if ((message[i] == '\n') && (message[i + 1] && message[i + 1] ==
'.')) {
+ if (buffer_cat(msg,".")) return NULL;
+ if (buffer_ncat(msg,&message[++i],1)) return NULL;
+ }
+ i++;
+ }
+ return msg;
+}
int
main (int argc, char *argv[])
@@ -977,7 +1011,18 @@
(result == DSR_ISSPAM) ? "SPAM" : "INNOCENT");
if (mailer_args == NULL) {
- fputs (message, stream);
+ /* calling program: dspamc */
+ if (stream == ATX->sockfd) {
+ /* stuff dots before sending back to dspam client */
+ /* otherwise trunction of email can occur, Eric Broch 04-12-2021 */
+ buffer * msg = stuff_dot(message);
+ fputs(msg->data,stream);
+ buffer_destroy(msg);
+ }
+ /* calling program: dspam */
+ else {
+ fputs(message,stream);
+ }
return 0;
}
--- ./src/client.c 2012-04-11 12:48:33.000000000 -0600
+++ ./src/client.new.c 2021-04-12 13:14:45.152130732 -0600
@@ -228,6 +228,14 @@
exitcode = 99;
}
} else {
+ /* de-stuff dots from server, 04-12-2021, Eric C. Broch, 7 lines */
+ if((line[0] && line[0]=='.') && (line[1] && line[1]=='.')) {
+ size_t i, len = strlen(line);
+ for(i=0;i<len;i++){
+ line[i]=line[i+1];
+ }
+ line[len-1]=0;
+ }
printf("%s\n", line);
}
free(line);
Eric
On 9/3/2014 9:27 PM, Eric Broch wrote:
Hello Ken and Stevan,
I've done some investigation and below you can see the offending line
in the original email is line 002. Line 001 and line 003 are for
context. Per Stevan.
001 has low airflow of 92 cfm for exhaust down low which equates to .4
cfm/ft2=
002 .
003 <b>I suggest that this ducting be modified before I return.
Another low duc=
After the message is piped into dspamc it is processed by
‘client_process’ in the file client.c
Before the message is sent to the daemon ‘\r’ and ‘.’ are added where
necessary.
At this point line 002 is stuffed with a ‘.’ as seen below:
001 has low airflow of 92 cfm for exhaust down low which equates to .4
cfm/ft2=
002 ..
003 <b>I suggest that this ducting be modified before I return.
Another low duc=
The message is then sent to the daemon and received back.
Upon receiving the message back it is truncated after line 001.
When receiving the message back from the daemon, reception of the
returned message terminates on 1 of 2 conditions: 1) A single line
with a ‘.’ or 2) no more data from the daemon. In fact the daemon is
removing the stuffed '.'.
The ‘while’ loop responsible for terminating reception of the message
from the dspam daemon is coded in the following way: ‘while ( line !=
NULL && strcmp (line, ".") )’. I changed this code to ‘while ( line !=
NULL /* && strcmp (line, ".") */ )’ commenting out termination on the
‘.’ and received the full message back, line 002 back in its original
form:
001 has low airflow of 92 cfm for exhaust down low which equates to .4
cfm/ft2=
002 .
003 <b>I suggest that this ducting be modified before I return.
Another low duc=
Anyway, this is how things stand presently. I'm not sure how the
daemon works but will investigate that as well.
Eric
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Dspam-user mailing list
Dspam-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-user
_______________________________________________
Dspam-user mailing list
Dspam-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-user