$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.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
FILE *fp;
int i;
struct passwd *pw;
+ int from_header = 0;
+ int in_body = 0;
get_config();
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);
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