[jcifs] jCIFS and Share name length?

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Thu Nov 15 11:50:41 EST 2001


You're confusing host names with share names. The jcifs.nbt.Name class is for NetBIOS
hostnames which invariably have a length of no more than 15 characters. Share names on the
other hand where for a long time limited to 13 characters. But when Unicode was introduced
this limitation was absolved. The relavant code is on jcifs.smb.NetShareEnumResponse:

 results = new ShareInfo1[entriesReturned];
        for( int i = 0; i < entriesReturned; i++ ) {
            results[i] = new ShareInfo1();
            results[i].netName = new String( buffer, bufferIndex,
                            readStringLength( buffer, bufferIndex, 13 ));
            bufferIndex += 14;

NetShareEnum is a RAP (Remote Access Protocol) call that runs over an SMB Named Pipe.
There are analogous functions that use DCE/RPC (Distributed Computing
Environment/Remote Procedure Call) again over SMB Named Pipes. These are meant to
replace all RAP calls and beyond. DCE/RPC is qute complicated (Luke from Samba-TNG
says it would take me 5000 lines of code (but I seriously doubt it's that bad)). Of course there
might be an alternative RAP call which is trivial with jCIFS but I'd have to look at the wire to
see how it works. Unfortunately I only have NT4 and Win98 at the moment which both only
allow 13 character shares (I think). I need to get my hands on Win2K and XP soon (just got a
new disk so I have the space).

</rant>

Mike

> -----Original Message-----
> From:	rjw [SMTP:rob at wygand.com]
> Sent:	Wednesday, November 14, 2001 7:36 PM
> To:	jcifs at samba.org
> Subject:	Re: [jcifs] jCIFS and Share name length?
> 
> Actually, Samba appears to be 13 chars. jCIFS appears to be 16. My guess 
> is that this snippet might code might have soemthing to do with it:
> 
> jcifs.nbt.Name.writeWireFormat:
> 
> // write name
> name = ( name.length() > 15 ) ?							
> 	name.substring( 0, 15 ).toUpperCase() :
> 	name.toUpperCase();
> 
> I don't think this wouldn't explain why a browse would not return those 
> shares, though... I'm going to keep poking around.
> 
> rjw
> 
> Allen, Michael B (RSCH) wrote:
> 
> > I don't know much about the problem. I need to just try it and see what it looks like on the
> > wire. If it's a RAP call it should work already (which suggests that it is not). If it's DCE RPC it
> > will be a while before I get around to that (possibly never).
> > 
> > Mike
> > 
> > 
> >>-----Original Message-----
> >>From:	rjw [SMTP:rob at wygand.com]
> >>Sent:	Wednesday, November 14, 2001 6:47 PM
> >>To:	jcifs at samba.org
> >>Subject:	[jcifs] jCIFS and Share name length?
> >>
> >>Hey Mike,
> >>
> >>Are there any plans to support share names longer than 13 characters? 
> >>We've got some NT servers here with share names like 
> >>someshare_is_really_long.
> >>
> >>I assume this is a huge change? (A newer version of the protocol, I'd 
> >>imagine?
> >>
> >>Thanks,
> >>rjw
> >>
> >>-- 
> >>"They that can give up essential liberty to obtain a little
> >>  temporary safety deserve neither liberty nor safety."
> >>
> >>
> > 
> 
> 
> -- 
> "They that can give up essential liberty to obtain a little
>   temporary safety deserve neither liberty nor safety."
> 
> 





More information about the jcifs mailing list