• Enable modification of headers - specifically updating or assigning "t

    From Deon George@1:103/705 to GitLab note in main/sbbs on Sat May 14 06:43:48 2022
    https://gitlab.synchro.net/main/sbbs/-/issues/404#note_2579

    Hey @rswindell I thought I'd have a go and implementing this. Implementing header relocation (if it is possible) is way beyond my skill set, so I had a go at the second option - reserving some space during message add.Here is what I came up with:```diff --git a/src/smblib/smblib.c b/src/smblib/smblib.cindex 53b886392..37511ff95 100644--- a/src/smblib/smblib.c+++ b/src/smblib/smblib.c@@ -1603,6 +1603,7 @@ int smb_addmsghdr(smb_t* smb, smbmsg_t* msg, int storage) ulong hdrlen; off_t idxlen; size_t idxreclen = smb_idxreclen(smb);+ int tagsBuffer = 4; /* this should be determine from a system configuration item */ if(smb->shd_fp==NULL) { safe_snprintf(smb->last_error,sizeof(smb->last_error),"%s msgbase not open", __FUNCTION__);@@ -1612,6 +1613,24 @@ int smb_addmsghdr(smb_t* smb, smbmsg_t* msg, int storage) if(!smb->locked && smb_locksmbhdr(smb)!=SMB_SUCCESS) return(SMB_ERR_LOCK);+ /* Add a tags buffer if a tag doesnt exist. */+ if (tagsBuffer) {+ int hasTags = 0;++ for(i=0;i<msg->total_hfields;i++) {+ if (msg->hfield[i].type == SMB_TAGS)+ hasTags = 1;+ }+ if (! hasTags) {+ if (smb_hfield_add(msg,SMB_TAGS,tagsBuffer,"",TRUE) != SMB_SUCCESS) {+ safe_snprintf(smb->last_error,sizeof(smb->last_error)+ ,"%s error adding padding for TAG field", __FUNCTION__);+ smb_unlocksmbhdr(smb);+ return(i);+ }+ }+ }+ hdrlen=smb_getmsghdrlen(msg); if(hdrlen>SMB_MAX_HDR_LEN) { /* headers are limited to 64k in size */ smb_unlocksmbhdr(smb);```Have I implemented this correctly - ie: I'm hoping it wont cause any other issues? My (limited) testing seemed to work well and I didnt get any `ERROR:smb_putmsghdr illegal header length increase: ...` errors.What I didnt know what to do, was to implement the "configurable part" to this patch - ie: would you define it in scfg or in sbbsecho.ini (or somewhere else)? And while I could probably fumble my way around adding that configuration option, I dont know the best way to make that configuration option visible in that function (and thus ultimately the value of `tagsBuffer`).If it is simple enough, if you could provide some pointers, I'll happily have a go - otherwise if this patch doesnt have any side affects, I may run with it until this feature is implemented properly.
    --- SBBSecho 3.15-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sun May 7 23:30:02 2023
    close https://gitlab.synchro.net/main/sbbs/-/issues/404
    --- SBBSecho 3.20-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)