diff --git a/src/sbbs3/bulkmail.cpp b/src/sbbs3/bulkmail.cpp index 45300a70fcf61f0d314aa86ba1804a0c9b3aabc9..c6184cafe56de45c448a5f07e7b2d9078403cb07 100644 --- a/src/sbbs3/bulkmail.cpp +++ b/src/sbbs3/bulkmail.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -110,7 +110,7 @@ bool sbbs_t::bulkmail(uchar *ar) memset(&smb,0,sizeof(smb)); smb.subnum=INVALID_SUB; /* mail database */ - i=savemsg(&cfg, &smb, &msg, &client, msgbuf); + i=savemsg(&cfg, &smb, &msg, &client, startup->host_name, msgbuf); free(msgbuf); if(i!=0) { smb_close(&smb); diff --git a/src/sbbs3/email.cpp b/src/sbbs3/email.cpp index 9b15e1dd6ea49fe88f9668f41bc67610b32b9610..785d0019a7e4b668ec3e234f1abeaaa3544b53fc 100644 --- a/src/sbbs3/email.cpp +++ b/src/sbbs3/email.cpp @@ -306,6 +306,7 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode) /* Security logging */ msg_client_hfields(&msg,&client); + smb_hfield_str(&msg,SENDERSERVER,startup->host_name); smb_hfield_str(&msg,SUBJECT,title); diff --git a/src/sbbs3/js_msgbase.c b/src/sbbs3/js_msgbase.c index 82185eb5cffc85f4f21729234215f67d2d876e25..f658aa722e52838a4094744bd593aa2608647986 100644 --- a/src/sbbs3/js_msgbase.c +++ b/src/sbbs3/js_msgbase.c @@ -1517,7 +1517,7 @@ js_save_msg(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) if(body[0]) truncsp(body); - if((p->status=savemsg(scfg, &(p->smb), &msg, client, body))==SMB_SUCCESS) { + if((p->status=savemsg(scfg, &(p->smb), &msg, client, /* ToDo server hostname: */NULL, body))==SMB_SUCCESS) { *rval = JSVAL_TRUE; if(rcpt_list!=NULL) { /* Sending to a list of recipients */ diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index a08a9e56ea4f2aff0cd5c1a460d628a374f8e833..92ff5ac338242392a266537bba7fb3ca0034561a 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -558,13 +558,16 @@ static ulong sockmimetext(SOCKET socket, smbmsg_t* msg, char* msgtxt, ulong maxl if(!sockprintf(socket,"In-Reply-To: %s",msg->reply_id)) return(0); - /* non-standard, but documented in draft-newman-msgheader-originfo-05 */ - sockprintf(socket,"Originator-Info: account=%s; ip-address=%s; hostname=%s; protocol=%s; port=%s" + /* non-standard, but documented (mostly) in draft-newman-msgheader-originfo-05 */ + sockprintf(socket,"Originator-Info: account=%s; login-id=%s; server=%s; client=%s; addr=%s; prot=%s; port=%s; time=%s" ,msg->from_ext - ,smb_get_hfield(msg,SENDERIPADDR,NULL) + ,smb_get_hfield(msg,SENDERUSERID,NULL) + ,smb_get_hfield(msg,SENDERSERVER,NULL) ,smb_get_hfield(msg,SENDERHOSTNAME,NULL) + ,smb_get_hfield(msg,SENDERIPADDR,NULL) ,smb_get_hfield(msg,SENDERPROTOCOL,NULL) ,smb_get_hfield(msg,SENDERPORT,NULL) + ,smb_get_hfield(msg,SENDERTIME,NULL) ); for(i=0;i<msg->total_hfields;i++) { @@ -2881,7 +2884,7 @@ static void smtp_thread(void* arg) smb_hfield_str(&msg, RECIPIENT, rcpt_name); smb.subnum=subnum; - if((i=savemsg(&scfg, &smb, &msg, &client, msgbuf))!=SMB_SUCCESS) { + if((i=savemsg(&scfg, &smb, &msg, &client, startup->host_name, msgbuf))!=SMB_SUCCESS) { lprintf(LOG_WARNING,"%04d !SMTP ERROR %d (%s) saving message" ,socket,i,smb.last_error); sockprintf(socket, "452 ERROR %d (%s) saving message" @@ -2983,7 +2986,7 @@ static void smtp_thread(void* arg) /* E-mail */ smb.subnum=INVALID_SUB; /* creates message data, but no header or index records (since msg.to==NULL) */ - i=savemsg(&scfg, &smb, &msg, &client, msgbuf); + i=savemsg(&scfg, &smb, &msg, &client, startup->host_name, msgbuf); free(msgbuf); if(i!=SMB_SUCCESS) { smb_close(&smb); diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp index 4dd7e54707fc8925544a16e5e59a36a4d9dfdfd8..d919ef010b5837740272ce8028bde6dfa847ee7d 100644 --- a/src/sbbs3/netmail.cpp +++ b/src/sbbs3/netmail.cpp @@ -256,6 +256,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode) /* Security logging */ msg_client_hfields(&msg,&client); + smb_hfield_str(&msg,SENDERSERVER,startup->host_name); smb_hfield_str(&msg,SUBJECT,title); @@ -463,6 +464,7 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode) /* Security logging */ msg_client_hfields(&msg,&client); + smb_hfield_str(&msg,SENDERSERVER,startup->host_name); smb_hfield_str(&msg,SUBJECT,title); diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp index fe79e8a9b09c3e8699c81c67b2f9b8f006b7e6d1..f609a0fa2d6ef94d659e47a926f4c667e27e65dc 100644 --- a/src/sbbs3/postmsg.cpp +++ b/src/sbbs3/postmsg.cpp @@ -344,6 +344,7 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode) /* Security logging */ msg_client_hfields(&msg,&client); + smb_hfield_str(&msg,SENDERSERVER,startup->host_name); smb_hfield_str(&msg,SUBJECT,title); @@ -409,21 +410,28 @@ extern "C" int DLLCALL msg_client_hfields(smbmsg_t* msg, client_t* client) { int i; char port[16]; + char date[64]; if(client==NULL) return(-1); + if(client->user!=NULL && (i=smb_hfield_str(msg,SENDERUSERID,client->user))!=SMB_SUCCESS) + return(i); + if((i=smb_hfield_str(msg,SENDERTIME,xpDateTime_to_isoDateTimeStr(gmtime_to_xpDateTime(client->time) + ,/* separators: */"","","", /* precision: */0 + ,date,sizeof(date))))!=SMB_SUCCESS) + return(i); if((i=smb_hfield_str(msg,SENDERIPADDR,client->addr))!=SMB_SUCCESS) return(i); if((i=smb_hfield_str(msg,SENDERHOSTNAME,client->host))!=SMB_SUCCESS) return(i); - if((i=smb_hfield_str(msg,SENDERPROTOCOL,client->protocol))!=SMB_SUCCESS) + if(client->protocol!=NULL && (i=smb_hfield_str(msg,SENDERPROTOCOL,client->protocol))!=SMB_SUCCESS) return(i); SAFEPRINTF(port,"%u",client->port); return smb_hfield_str(msg,SENDERPORT,port); } -extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t* client, char* msgbuf) +extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t* client, const char* server, char* msgbuf) { char pid[128]; char msg_id[256]; @@ -519,6 +527,8 @@ extern "C" int DLLCALL savemsg(scfg_t* cfg, smb_t* smb, smbmsg_t* msg, client_t* if(client!=NULL) msg_client_hfields(msg,client); + if(server!=NULL) + smb_hfield_str(msg,SENDERSERVER,server); /* Generate RFC-822 Message-id */ if(msg->id==NULL) { diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index 6afa8aeefd0dd913a5edbf6227c082c864c8eef8..e9319c63fe2aa7731ce85c6eb6467390fc9f228e 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -836,7 +836,7 @@ extern "C" { DLLEXPORT void DLLCALL delfattach(scfg_t*, smbmsg_t*); /* postmsg.cpp */ - DLLEXPORT int DLLCALL savemsg(scfg_t*, smb_t*, smbmsg_t*, client_t*, char* msgbuf); + DLLEXPORT int DLLCALL savemsg(scfg_t*, smb_t*, smbmsg_t*, client_t*, const char* server, char* msgbuf); DLLEXPORT void DLLCALL signal_sub_sem(scfg_t*, uint subnum); DLLEXPORT int DLLCALL msg_client_hfields(smbmsg_t*, client_t*); DLLEXPORT char* DLLCALL msg_program_id(char* pid); diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp index dbf20551b9dc6d8f9d964d21df479b9d8cf45d42..6e765ac40e8dac1b48d339323fe7ef98eb86bacd 100644 --- a/src/sbbs3/writemsg.cpp +++ b/src/sbbs3/writemsg.cpp @@ -1146,6 +1146,7 @@ void sbbs_t::forwardmail(smbmsg_t *msg, int usernumber) /* Security logging */ msg_client_hfields(msg,&client); + smb_hfield_str(msg,SENDERSERVER,startup->host_name); username(&cfg,usernumber,touser); smb_hfield_str(msg,RECIPIENT,touser);