From dd0c0c122623d83e762ad07958f31c05e76ee5a2 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Fri, 23 Apr 2021 23:23:20 -0700
Subject: [PATCH] Restore AUTHOR and AUTHOR_ORG SMB header fields removed
 Apri-19-2019

Going to use these to store SAUCE "AUTHOR" and "GROUP" fields for files.
---
 src/smblib/smbdefs.h | 5 +++++
 src/smblib/smblib.c  | 8 ++++++++
 src/smblib/smbstr.c  | 3 +++
 3 files changed, 16 insertions(+)

diff --git a/src/smblib/smbdefs.h b/src/smblib/smbdefs.h
index faf499bcc2..5f692adf18 100644
--- a/src/smblib/smbdefs.h
+++ b/src/smblib/smbdefs.h
@@ -168,6 +168,9 @@
 #define SENDERTIME			0x0d		/* authentication/connection time */
 #define SENDERSERVER		0x0e		/* server hostname that authenticated user */
 
+#define SMB_AUTHOR			0x10
+#define SMB_AUTHOR_ORG		0x16
+
 #define REPLYTO 			0x20		/* Name only */
 #define REPLYTOAGENT		0x21
 #define REPLYTONETTYPE		0x22
@@ -597,6 +600,8 @@ typedef struct {				/* Message or File */
 				*from_host,		/* From host name */
 				*from_prot,		/* From protocol (e.g. "Telnet", "NNTP", "HTTP", etc.) */
 				*from_port,		/* From TCP/UDP port number */
+				*author,		/* Author */
+				*author_org,	/* Author's organization */
 				*replyto,		/* Reply-to name */
 				*replyto_ext,	/* Reply-to extension */
 				*replyto_list,	/* Comma-separated list of mailboxes, RFC822-style */
diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c
index 103035e214..0ddccff1ed 100644
--- a/src/smblib/smblib.c
+++ b/src/smblib/smblib.c
@@ -776,6 +776,12 @@ static void set_convenience_ptr(smbmsg_t* msg, uint16_t hfield_type, void* hfiel
 		case SENDERPORT:
 			msg->from_port=(char*)hfield_dat;
 			break;
+		case SMB_AUTHOR:
+			msg->author=(char*)hfield_dat;
+			break;
+		case SMB_AUTHOR_ORG:
+			msg->author_org=(char*)hfield_dat;
+			break;
 		case REPLYTO:
 			msg->replyto=(char*)hfield_dat;
 			break;
@@ -926,6 +932,8 @@ static void clear_convenience_ptrs(smbmsg_t* msg)
 	msg->to_list=NULL;
 	memset(&msg->to_net,0,sizeof(net_t));
 
+	msg->author=NULL;
+	msg->author_org=NULL;
 	msg->cc_list=NULL;
 	msg->subj=NULL;
 	msg->summary=NULL;
diff --git a/src/smblib/smbstr.c b/src/smblib/smbstr.c
index 365b9b3b15..9d9e894e0f 100644
--- a/src/smblib/smbstr.c
+++ b/src/smblib/smbstr.c
@@ -43,6 +43,9 @@ char* smb_hfieldtype(uint16_t type)
 		case SENDERTIME:		return("SenderTime");
 		case SENDERSERVER:		return("SenderServer");
 
+		case SMB_AUTHOR:		return("Author");
+		case SMB_AUTHOR_ORG:		return("AuthorOrg");
+
 		case REPLYTO:			return("Reply-To");				/* RFC-compliant */
 		case REPLYTOAGENT:		return("Reply-ToAgent");
 		case REPLYTONETTYPE:	return("Reply-ToNetType");
-- 
GitLab