svn commit: samba r5990 - in trunk/source/libsmb: .

jra at samba.org jra at samba.org
Wed Mar 23 03:54:53 GMT 2005


Author: jra
Date: 2005-03-23 03:54:52 +0000 (Wed, 23 Mar 2005)
New Revision: 5990

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

Log:
Fixup last entry offset correctly for level 260.
Should fix bug found by Derrell.Lipman at UnwiredUniverse.com.
Jeremy.

Modified:
   trunk/source/libsmb/clilist.c


Changeset:
Modified: trunk/source/libsmb/clilist.c
===================================================================
--- trunk/source/libsmb/clilist.c	2005-03-23 01:42:29 UTC (rev 5989)
+++ trunk/source/libsmb/clilist.c	2005-03-23 03:54:52 UTC (rev 5990)
@@ -29,7 +29,7 @@
  by NT and 2 is used by OS/2
 ****************************************************************************/
 
-static int interpret_long_filename(struct cli_state *cli,
+static size_t interpret_long_filename(struct cli_state *cli,
 				   int level,char *p,file_info *finfo)
 {
 	extern file_info def_finfo;
@@ -130,12 +130,12 @@
 			clistr_pull(cli, finfo->name, p,
 				    sizeof(finfo->name),
 				    namelen, 0);
-			return SVAL(base, 0);
+			return (size_t)IVAL(base, 0);
 		}
 	}
 	
 	DEBUG(1,("Unknown long filename format %d\n",level));
-	return(SVAL(p,0));
+	return (size_t)IVAL(base,0);
 }
 
 /****************************************************************************
@@ -168,6 +168,7 @@
 	unsigned int param_len, data_len;	
 	uint16 setup;
 	pstring param;
+	const char *mnt;
 
 	/* NT uses 260, OS/2 uses 2. Both accept 1. */
 	info_level = (cli->capabilities&CAP_NT_SMBS)?260:1;
@@ -271,6 +272,10 @@
 
 		/* we might need the lastname for continuations */
 		for (p2=p,i=0;i<ff_searchcount;i++) {
+			if ((info_level == 260) && (i == ff_searchcount-1)) {
+				/* 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);
 		}
 
@@ -308,11 +313,10 @@
 		First = False;
 	}
 
+	mnt = cli_cm_get_mntpoint( cli );
+
 	for (p=dirlist,i=0;i<total_received;i++) {
-		const char *mnt = cli_cm_get_mntpoint( cli );
-		
 		p += interpret_long_filename(cli,info_level,p,&finfo);
-		
 		fn( mnt,&finfo, Mask, state );
 	}
 



More information about the samba-cvs mailing list