From d8b90a4670799bb7296a7cfafa9bde1ff6627dd4 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 1 Sep 2004 09:24:06 +0000 Subject: [PATCH] Created smb_hfield_addlist() to add a list of header fields to an smbmsg_t. --- src/smblib/smblib.c | 19 +++++++++++++++++++ src/smblib/smblib.h | 1 + 2 files changed, 20 insertions(+) diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c index 58a717dfdf..2c4bd44d7c 100644 --- a/src/smblib/smblib.c +++ b/src/smblib/smblib.c @@ -1213,6 +1213,25 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data) return(SMB_SUCCESS); } +/****************************************************************************/ +/* Adds a list of header fields to the 'msg' structure (in memory only) */ +/****************************************************************************/ +int SMBCALL smb_hfield_addlist(smbmsg_t* msg, hfield_t** hfield_list, void** hfield_dat) +{ + int retval; + unsigned n; + + if(hfield_list==NULL) + return(SMB_FAILURE); + + for(n=0;hfield_list[n]!=NULL;n++) + if((retval=smb_hfield(msg + ,hfield_list[n]->type,hfield_list[n]->length,hfield_dat[n]))!=SMB_SUCCESS) + return(retval); + + return(SMB_SUCCESS); +} + /****************************************************************************/ /* Convenience function to add an ASCIIZ string header field */ /****************************************************************************/ diff --git a/src/smblib/smblib.h b/src/smblib/smblib.h index 65cd11c5fe..7f09f9fda5 100644 --- a/src/smblib/smblib.h +++ b/src/smblib/smblib.h @@ -131,6 +131,7 @@ SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, vo SMBEXPORT int SMBCALL smb_hfield_str(smbmsg_t* msg, ushort type, const char* str); SMBEXPORT int SMBCALL smb_hfield_append(smbmsg_t* msg, ushort type, size_t length, void* data); SMBEXPORT int SMBCALL smb_hfield_append_str(smbmsg_t* msg, ushort type, const char* data); +SMBEXPORT int SMBCALL smb_hfield_addlist(smbmsg_t* msg, hfield_t** hfield_list, void** hfield_dat); SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, ulong length); SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield); SMBEXPORT char* SMBCALL smb_hfieldtype(ushort type); -- GitLab