From 15036e4105019af481eab5a053d54df4033d8d1d Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 13 Apr 2005 20:42:45 +0000 Subject: [PATCH] * citmail.c: changes to citmail to make it usable as a /usr/sbin/sendmail replacement; i.e. /bin/mail calls /usr/sbin/sendmail which sends mail through Citadel. --- citadel/ChangeLog | 6 ++++++ citadel/citmail.c | 13 ++++++++++++- citadel/serv_smtp.c | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index ee0b43eea..501bb3e8e 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 645.4 2005/04/13 20:42:44 ajc + * citmail.c: changes to citmail to make it usable as a /usr/sbin/sendmail + replacement; i.e. /bin/mail calls /usr/sbin/sendmail which sends mail + through Citadel. + Revision 645.3 2005/04/13 17:03:07 ajc * Reverted database changes because the cull_logs function wasn't working with the separate log directory. @@ -6591,3 +6596,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citmail.c b/citadel/citmail.c index e51428187..50704818d 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -173,6 +173,8 @@ int main(int argc, char **argv) { FILE *fp; int i; struct passwd *pw; + int from_header = 0; + int in_body = 0; get_config(); @@ -185,10 +187,19 @@ int main(int argc, char **argv) { config.c_fqdn ); while (fgets(buf, 1024, stdin) != NULL) { - fprintf(fp, "%s", buf); + if ( ( (buf[0] == 13) || (buf[0] == 10)) && (in_body == 0) ) { + in_body = 1; + if (from_header == 0) { + fprintf(fp, "%s%s", fromline, buf); + } + } if (!strncasecmp(buf, "From:", 5)) { strcpy(fromline, buf); + if (in_body == 0) { + from_header = 1; + } } + fprintf(fp, "%s", buf); } strip_trailing_nonprint(fromline); diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index c628aa4d9..6c46264e9 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -519,7 +519,9 @@ void smtp_mail(char *argbuf) { strcpy(SMTP->from, &argbuf[5]); striplt(SMTP->from); - stripallbut(SMTP->from, '<', '>'); + if (haschar(SMTP->from, '<') > 0) { + stripallbut(SMTP->from, '<', '>'); + } /* We used to reject empty sender names, until it was brought to our * attention that RFC1123 5.2.9 requires that this be allowed. So now -- 2.39.2