--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Mar 22, 2005 at 09:51:57PM -0500, Derrell.Lipman@UnwiredUniverse.com wrote:
> Jeremy Allison writes:
>
> > On Tue, Mar 22, 2005 at 09:24:03PM -0500, Derrell.Lipman@UnwiredUniverse.com wrote:
> >> Quick update... The problem appears to be that interpret_long_filename()
> >> is returning 0 as obtained from SVAL(base, 0) for each of the additional
> >> names, so interpret_long_filename() is being recalled with the same pointer
> >> over and over.

> >
> > Ok - it looks like the length field isn't being set correctly.
> > Hmmmm. I'll look at a patch to get around that problem. Thanks
> > for tracking this down !

>
> Ok, great. It kind of makes sense that the next entry offset would be zero at
> the end of the FINDFIRST response.
>
> Maybe an appropriate fix is to patch the "next entry offset" when you append
> 'p' to 'dirlist'... sort of like adding a new element at the end of a linked
> list???


Ok, here is the patch I'm going to check into SVN. Please test.
Thanks for finding this bug. It wasn't being triggered by my or
Jerry's test cases so I'm really glad you got it :-).

Thanks,

Jeremy.

--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=look

Index: libsmb/clilist.c
================================================== =================
--- libsmb/clilist.c (revision 5989)
+++ libsmb/clilist.c (working copy)
@@ -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 + 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 - const char *mnt = cli_cm_get_mntpoint( cli );
-
p += interpret_long_filename(cli,info_level,p,&finfo);
-
fn( mnt,&finfo, Mask, state );
}


--jI8keyz6grp/JLjh--