svn commit: samba r6994 - in branches/SAMBA_3_0/source/libsmb: .

jra at samba.org jra at samba.org
Thu May 26 19:39:43 GMT 2005


Author: jra
Date: 2005-05-26 19:39:40 +0000 (Thu, 26 May 2005)
New Revision: 6994

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

Log:
Fix for bugid #2729 - it turns out resume keys are *mandatory* for
a search when listing a W2K and above server from a FATxx filesystem
only. Thanks to Steve Langasek <vorlon at debian.org> for giving me the
essential info that allowed me to reproduce and thus fix this.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clilist.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clilist.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clilist.c	2005-05-26 19:39:35 UTC (rev 6993)
+++ branches/SAMBA_3_0/source/libsmb/clilist.c	2005-05-26 19:39:40 UTC (rev 6994)
@@ -32,7 +32,7 @@
 ****************************************************************************/
 
 static size_t interpret_long_filename(struct cli_state *cli,
-				   int level,char *p,file_info *finfo)
+				   int level,char *p,file_info *finfo, uint32 *p_resume_key)
 {
 	file_info finfo2;
 	int len;
@@ -40,6 +40,7 @@
 
 	if (!finfo) finfo = &finfo2;
 
+	*p_resume_key = 0;
 	memcpy(finfo,&def_finfo,sizeof(*finfo));
 
 	switch (level) {
@@ -85,6 +86,8 @@
 		{
 			size_t namelen, slen;
 			p += 4; /* next entry offset */
+
+			*p_resume_key = IVAL(p,0);
 			p += 4; /* fileindex */
 				
 			/* these dates appear to arrive in a
@@ -146,7 +149,7 @@
 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, 
 		 void (*fn)(const char *, file_info *, const char *, void *), void *state)
 {
-#if 0
+#if 1
 	int max_matches = 1366; /* Match W2k - was 512. */
 #else
 	int max_matches = 512;
@@ -170,6 +173,7 @@
 	uint16 setup;
 	pstring param;
 	const char *mnt;
+	uint32 resume_key = 0;
 
 	/* NT uses 260, OS/2 uses 2. Both accept 1. */
 	info_level = (cli->capabilities&CAP_NT_SMBS)?260:1;
@@ -204,7 +208,9 @@
 			SSVAL(param,0,ff_dir_handle);
 			SSVAL(param,2,max_matches); /* max count */
 			SSVAL(param,4,info_level); 
-			SIVAL(param,6,0); /* ff_resume_key */
+			/* For W2K servers serving out FAT filesystems we *must* set the
+			   resume key. If it's not FAT then it's returned as zero. */
+			SIVAL(param,6,resume_key); /* ff_resume_key */
 			/* NB. *DON'T* use continue here. If you do it seems that W2K and bretheren
 			   can miss filenames. Use last filename continue instead. JRA */
 			SSVAL(param,10,(FLAG_TRANS2_FIND_REQUIRE_RESUME|FLAG_TRANS2_FIND_CLOSE_IF_END));	/* resume required + close on end */
@@ -277,7 +283,7 @@
 				/* Last entry - fixup the last offset length. */
 				SIVAL(p2,0,PTR_DIFF((rdata + data_len),p2));
 			}
-			p2 += interpret_long_filename(cli,info_level,p2,&finfo);
+			p2 += interpret_long_filename(cli,info_level,p2,&finfo,&resume_key);
 		}
 
 		if (ff_lastname > 0) {
@@ -317,7 +323,7 @@
 	mnt = cli_cm_get_mntpoint( cli );
 
 	for (p=dirlist,i=0;i<total_received;i++) {
-		p += interpret_long_filename(cli,info_level,p,&finfo);
+		p += interpret_long_filename(cli,info_level,p,&finfo,&resume_key);
 		fn( mnt,&finfo, Mask, state );
 	}
 



More information about the samba-cvs mailing list