From 0edb6b1cbe8c22218c541e274775be7d973bac52 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 25 Aug 2002 22:29:02 +0000
Subject: [PATCH] smb_get_hfield() can be called with a NULL hfield pointer
 argument to query the existance of a specified header file type.

---
 src/smblib/smblib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c
index ff0e0715a0..1ada197181 100644
--- a/src/smblib/smblib.c
+++ b/src/smblib/smblib.c
@@ -399,7 +399,8 @@ int SMBCALL smb_locksmbhdr(smb_t* smb)
 			if(time(NULL)-start>=(time_t)smb->retry_time) 
 				break;						
 		/* In case we've already locked it */
-		unlock(fileno(smb->shd_fp),0L,sizeof(smbhdr_t)+sizeof(smbstatus_t)); 
+		if(unlock(fileno(smb->shd_fp),0L,sizeof(smbhdr_t)+sizeof(smbstatus_t))==0)
+			smb->locked=0;	/* FALSE */
 		SLEEP(smb->retry_delay);
 	}
 	sprintf(smb->last_error,"timeout locking header");
@@ -951,7 +952,8 @@ void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
 
 	for(i=0;i<msg->total_hfields;i++)
 		if(msg->hfield[i].type == type) {
-			hfield = &msg->hfield[i];
+			if(hfield != NULL)
+				hfield = &msg->hfield[i];
 			return(msg->hfield_dat[i]);
 		}
 
-- 
GitLab