svn commit: samba r5153 - in trunk/source/smbd: .

jra at samba.org jra at samba.org
Tue Feb 1 02:05:44 GMT 2005


Author: jra
Date: 2005-02-01 02:05:44 +0000 (Tue, 01 Feb 2005)
New Revision: 5153

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5153

Log:
Tidy up interface a little.
Jeremy.

Modified:
   trunk/source/smbd/dir.c
   trunk/source/smbd/reply.c
   trunk/source/smbd/trans2.c


Changeset:
Modified: trunk/source/smbd/dir.c
===================================================================
--- trunk/source/smbd/dir.c	2005-02-01 00:28:20 UTC (rev 5152)
+++ trunk/source/smbd/dir.c	2005-02-01 02:05:44 UTC (rev 5153)
@@ -196,13 +196,15 @@
  Returns 0 on ok, 1 on fail.
 ****************************************************************************/
 
-BOOL dptr_set_wcard_and_attributes(int key, char *wcard, uint16 attr)
+BOOL dptr_set_wcard_and_attributes(int key, const char *wcard, uint16 attr)
 {
 	struct dptr_struct *dptr = dptr_get(key, False);
 
 	if (dptr) {
 		dptr->attr = attr;
-		dptr->wcard = wcard;
+		dptr->wcard = SMB_STRDUP(wcard);
+		if (!dptr->wcard)
+			return False;
 		dptr->has_wild = ms_has_wild(wcard);
 		return True;
 	}

Modified: trunk/source/smbd/reply.c
===================================================================
--- trunk/source/smbd/reply.c	2005-02-01 00:28:20 UTC (rev 5152)
+++ trunk/source/smbd/reply.c	2005-02-01 02:05:44 UTC (rev 5153)
@@ -899,7 +899,10 @@
 				END_PROFILE(SMBsearch);
 				return ERROR_DOS(ERRDOS,ERRnofids);
 			}
-			dptr_set_wcard_and_attributes(dptr_num, SMB_STRDUP(mask), dirtype);
+			if (!dptr_set_wcard_and_attributes(dptr_num, mask, dirtype)) {
+				END_PROFILE(SMBsearch);
+				return ERROR_DOS(ERRDOS,ERRnomem);
+			}
 		} else {
 			dirtype = dptr_attr(dptr_num);
 		}

Modified: trunk/source/smbd/trans2.c
===================================================================
--- trunk/source/smbd/trans2.c	2005-02-01 00:28:20 UTC (rev 5152)
+++ trunk/source/smbd/trans2.c	2005-02-01 02:05:44 UTC (rev 5153)
@@ -1437,13 +1437,11 @@
 	/* Save the wildcard match and attribs we are using on this directory - 
 		needed as lanman2 assumes these are being saved between calls */
 
-	if(!(wcard = SMB_STRDUP(mask))) {
+	if (!dptr_set_wcard_and_attributes(dptr_num, mask, dirtype)) {
 		dptr_close(&dptr_num);
 		return ERROR_DOS(ERRDOS,ERRnomem);
 	}
 
-	dptr_set_wcard_and_attributes(dptr_num, wcard, dirtype);
-
 	DEBUG(4,("dptr_num is %d, wcard = %s, attr = %d\n",dptr_num, wcard, dirtype));
 
 	/* We don't need to check for VOL here as this is returned by 



More information about the samba-cvs mailing list