From 9768680a8b4c4c1cb894775b38a48e00aac771c6 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 12 Jul 2002 09:27:19 +0000
Subject: [PATCH] Created smb_get_hfield() function - searches for specific
 header field by type. Added support for USENET path and newsgroups header
 fields.

---
 src/smblib/smblib.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c
index 55c1ee9736..04c13c1330 100644
--- a/src/smblib/smblib.c
+++ b/src/smblib/smblib.c
@@ -799,6 +799,12 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
 			case RFC822REPLYID:
 				msg->reply_id=msg->hfield_dat[i];
 				break;
+			case USENETPATH:
+				msg->path=msg->hfield_dat[i];
+				break;
+			case USENETNEWSGROUPS:
+				msg->newsgroups=msg->hfield_dat[i];
+				break;
 			case FIDOMSGID:
 				msg->ftn_msgid=msg->hfield_dat[i];
 				break;
@@ -929,6 +935,22 @@ int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data)
 	return(0);
 }
 
+/****************************************************************************/
+/* Searches for a specific header field (by type) and returns it			*/
+/****************************************************************************/
+void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
+{
+	int i;
+
+	for(i=0;i<msg->total_hfields;i++)
+		if(msg->hfield[i].type == type) {
+			hfield = &msg->hfield[i];
+			return(msg->hfield_dat[i]);
+		}
+
+	return(NULL);
+}
+
 /****************************************************************************/
 /* Adds a data field to the 'msg' structure (in memory only)                */
 /* Automatically figures out the offset into the data buffer from existing	*/
-- 
GitLab