Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 77324449 authored by rswindell's avatar rswindell

Do not parse SENDER* header fields from regular (non-Q-restricted) user's QWK headers.dat files.

parent 729c3cc3
......@@ -38,7 +38,7 @@
#include "sbbs.h"
#include "qwk.h"
static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers)
static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers, bool parse_sender_hfields)
{
char* p;
char zone[32];
......@@ -70,14 +70,18 @@ static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers)
if((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SUBJECT),value))!=NULL)
smb_hfield_str(msg,hfield_type,p);
if((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDER),value))!=NULL)
smb_hfield_str(msg,hfield_type,p);
if((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDER),value))!=NULL) {
if(parse_sender_hfields)
smb_hfield_str(msg,hfield_type,p);
}
if((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERNETADDR),value))!=NULL) {
smb_hfield_str(msg,hfield_type,p);
net_type=NET_UNKNOWN;
smb_hfield_netaddr(msg,hfield_type,p,&net_type);
smb_hfield_bin(msg,SENDERNETTYPE,net_type);
if(parse_sender_hfields) {
smb_hfield_str(msg,hfield_type,p);
net_type=NET_UNKNOWN;
smb_hfield_netaddr(msg,hfield_type,p,&net_type);
smb_hfield_bin(msg,SENDERNETTYPE,net_type);
}
}
if((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=RFC822MSGID),value))!=NULL)
......@@ -90,15 +94,22 @@ static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers)
smb_hfield_str(msg,hfield_type,p);
/* Trace header fields */
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERIPADDR),value))!=NULL)
smb_hfield_str(msg,hfield_type,p);
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERHOSTNAME),value))!=NULL)
smb_hfield_str(msg,hfield_type,p);
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERPROTOCOL),value))!=NULL)
smb_hfield_str(msg,hfield_type,p);
while((p=iniPopKey(headers,ROOT_SECTION,"Organization",value))!=NULL)
smb_hfield_str(msg,SENDERORG,p);
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERIPADDR),value))!=NULL) {
if(parse_sender_hfields)
smb_hfield_str(msg,hfield_type,p);
}
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERHOSTNAME),value))!=NULL) {
if(parse_sender_hfields)
smb_hfield_str(msg,hfield_type,p);
}
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=SENDERPROTOCOL),value))!=NULL) {
if(parse_sender_hfields)
smb_hfield_str(msg,hfield_type,p);
}
while((p=iniPopKey(headers,ROOT_SECTION,"Organization",value))!=NULL) {
if(parse_sender_hfields)
smb_hfield_str(msg,SENDERORG,p);
}
/* FidoNet header fields */
while((p=iniPopKey(headers,ROOT_SECTION,smb_hfieldtype(hfield_type=FIDOAREA),value))!=NULL)
......@@ -132,7 +143,7 @@ static void qwk_parse_header_list(smbmsg_t* msg, str_list_t* headers)
smb_hfield_str(msg,RFC822HEADER,(*headers)[i]);
}
void sbbs_t::qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t all_headers)
void sbbs_t::qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t all_headers, bool parse_sender_hfields)
{
char str[128];
str_list_t msg_headers;
......@@ -146,7 +157,7 @@ void sbbs_t::qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t al
msg->hdr.version=smb_ver();
if(msg_headers!=NULL)
qwk_parse_header_list(msg, &msg_headers);
qwk_parse_header_list(msg, &msg_headers, parse_sender_hfields);
/* Parse the QWK message header: */
if(msg->hdr.when_written.time==0) {
......@@ -169,7 +180,7 @@ void sbbs_t::qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t al
smb_hfield_str(msg,RECIPIENT,str);
}
if(msg->from==NULL) {
if(parse_sender_hfields && msg->from==NULL) {
sprintf(str,"%25.25s",hdrblk+46);
truncsp(str);
smb_hfield_str(msg,SENDER,str);
......
......@@ -735,7 +735,7 @@ public:
ulong msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum, int conf, FILE* hdrs_dat);
/* qwktomsg.cpp */
void qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t headers);
void qwk_new_msg(smbmsg_t* msg, char* hdrblk, long offset, str_list_t headers, bool parse_sender_hfields);
bool qwk_import_msg(FILE *qwk_fp, char *hdrblk, ulong blocks, char fromhub, uint subnum
,uint touser, smbmsg_t* msg);
......
......@@ -145,7 +145,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
/*********************************/
n=(uint)block[123]|(((uint)block[124])<<8); /* conference number */
qwk_new_msg(&msg,(char*)block,/*offset: */l,headers);
qwk_new_msg(&msg,(char*)block,/* offset: */l,headers,/* parse_sender_hfields: */true);
if(findstr_in_list(msg.from_ip,ip_can)) {
eprintf(LOG_NOTICE,"!Filtering message from %s due to blocked IP: %s"
......
......@@ -172,7 +172,7 @@ bool sbbs_t::unpack_rep(char* repfile)
blocks=1;
continue;
}
qwk_new_msg(&msg, block, /* offset: */l, headers);
qwk_new_msg(&msg, block, /* offset: */l, headers, /* parse_sender_hfields: */useron.rest&FLAG('Q') ? true:false);
if(findstr_in_list(msg.from_ip,ip_can)) {
SAFEPRINTF2(str,"!Filtering message from %s due to blocked IP: %s"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment