Skip to content
Snippets Groups Projects
Commit d7920d69 authored by rswindell's avatar rswindell
Browse files

Don't create the security-related header fields if the assocated "client"

object/struct doesn't have any meaningful data. Prevent this from happening:
    SenderTime       19700101000000Z
    SenderIpAddr
    SenderHostName
    SenderPort       0
parent d251aa04
Branches
Tags
No related merge requests found
...@@ -359,18 +359,24 @@ extern "C" int DLLCALL msg_client_hfields(smbmsg_t* msg, client_t* client) ...@@ -359,18 +359,24 @@ extern "C" int DLLCALL msg_client_hfields(smbmsg_t* msg, client_t* client)
if(client->user!=NULL && (i=smb_hfield_str(msg,SENDERUSERID,client->user))!=SMB_SUCCESS) if(client->user!=NULL && (i=smb_hfield_str(msg,SENDERUSERID,client->user))!=SMB_SUCCESS)
return(i); return(i);
if((i=smb_hfield_str(msg,SENDERTIME,xpDateTime_to_isoDateTimeStr(gmtime_to_xpDateTime(client->time) if(client->time
&& (i=smb_hfield_str(msg,SENDERTIME,xpDateTime_to_isoDateTimeStr(gmtime_to_xpDateTime(client->time)
,/* separators: */"","","", /* precision: */0 ,/* separators: */"","","", /* precision: */0
,date,sizeof(date))))!=SMB_SUCCESS) ,date,sizeof(date))))!=SMB_SUCCESS)
return(i); return(i);
if((i=smb_hfield_str(msg,SENDERIPADDR,client->addr))!=SMB_SUCCESS) if(*client->addr
&& (i=smb_hfield_str(msg,SENDERIPADDR,client->addr))!=SMB_SUCCESS)
return(i); return(i);
if((i=smb_hfield_str(msg,SENDERHOSTNAME,client->host))!=SMB_SUCCESS) if(*client->host
&& (i=smb_hfield_str(msg,SENDERHOSTNAME,client->host))!=SMB_SUCCESS)
return(i); return(i);
if(client->protocol!=NULL && (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); return(i);
SAFEPRINTF(port,"%u",client->port); if(client->port) {
return smb_hfield_str(msg,SENDERPORT,port); SAFEPRINTF(port,"%u",client->port);
return smb_hfield_str(msg,SENDERPORT,port);
}
return SMB_SUCCESS;
} }
/* Note: support MSG_BODY only, no tails or other data fields (dfields) */ /* Note: support MSG_BODY only, no tails or other data fields (dfields) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment