RAP bug: Not truncating names to 12 characters.

Christopher R. Hertel crh at ubiqx.mn.org
Thu Jan 15 17:39:29 GMT 2004


On Thu, Jan 15, 2004 at 09:14:11AM -0800, Marc Kaplan wrote:
> ab wrote:
> > Same with smbclient. It does display them but can't access. 
> > It also has
> > bug in that displayed share name is cropped:
> > d_printf("\t%-15.15s%-10.10s%s\n", name, typestr, comment);
> 
> Right, and just as a note this is in bugzilla already:
> https://bugzilla.samba.org/show_bug.cgi?id=767

Thanks!
I did a search of bugzilla last night and 767 didn't pop out.

Thing is, the bug isn't in smbclient.  It's in lanman.c on the server
side.  Any name longer than 12 bytes should be skipped, not reported.  
That (as the saying goes) is what Windows does.

The NetShareEnum() response allows for 13-byte names, but Windows servers 
always include a nul terminator so the maximum name length is 12 bytes.  
If I create a share on a W2K server that has a 13 byte or longer name, the 
share name is simply skipped in the response.  I figure we should be doing 
the same thing.

I've looked through lanman.c and I can see where the names are iterated to
create the response message.  There is also a RNetShareGetInfo() RAP
function that returns detailed information on a given share.  I'm trying 
to figure out whether I should be checking for the 12-byte limit in there 
as well and, if so, whether that's the right place to check the limit.

I wish the code had more and better comments.  (covers head and ducks)

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list