Fwd: Re: libsmbclient.so problem w98 servers? (LONG)

Tom Jansen tom at ninja.nl
Mon Jun 17 10:17:01 GMT 2002


Oops... to the list too !! 
here it is :

-----


> > > > Lately, I did a cvs up and now things are weird ! 

> maybe a wrong pointer/counter somwhere not initialized at evry
> filename

Alrighty, I did some investigation and I've found the problem although I'm not
sure I've solved it the right way. I guess not. Comments please.

Here is what happens:
smbc_opendir() calls cli_list() which calls cli_list_new().
After talking to the Win98 SE server (info level 1 response) the response is
parsed. 
Read with me in libsmb/clilist.c line 49 and further if you want to understand
the following piece (or use you XL-coderemember-brain :).

byte 0-25 are time/size/mode data. byte 26 is the length of the directory entry
WITHOUT the trailing \0 terminator. 
clistr_align_in() decides it's ascii and adds no extra padding.
clistr_pull() copies the entry in the finfo struct. This routine returns the
exact len (from byte 26 mentioned above).

PTR_DIFF(p, base) returns the length of the read dirent entry. 

Because clistr_pull() returns len instead of len+1 (to cover the trailing \0
char) this length is one byte to short.

The solution is easy:
add the following:

libsmb/clilist.c: line 61:  p += 1; /* skip the trailing 0 char */

to the case 1: just before the return PTR_DIFF()

Maybe the solution has to be implemented in the clistr_pull() routine or one of
it's underlying routines.

Yours,
    Tom

Tom Jansen -- tom at ninja.nl 
Ninja ISD  -- www.ninja.nl





More information about the samba-technical mailing list