Listing shares

Danny Smith dannys at
Wed Jan 29 17:55:20 GMT 2003

Derrell.Lipman at wrote:

>Danny Smith <dannys at> writes:
>>I've just come across a problem listing shares on both samba and Win* boxes
>>using the samba suite.  Initially I tried using 'smbclient -L' and parsing
>>the output using a perl script, which works to a degree.  The problem is
>>that the V2.x.x smbclient uses the old-style "RAP" calls to talk to the
>>server, which are limited to 13 charcter return values.  I overcame this by
>>using a V3 'net rpc share' command instead, and discovered that the output
>>is limited by the format string in net_rpc.c to 12 characters instead
>>(net_rpc.c:1125 and net_rpc.c:1128). Surely this is a little short sighted?
>>I've got around the problem for now, by changing the format strings, but
>>it's maybe worth looking at a more generic solution?
>>Personally I think it would be nice to be able to pass a format specifier to
>>such commands, for use in these kinds of cases. Does anyone have any views
>>on that? Assuming people are agreeable to it, I'm happy to attempt some
>I submitted patches about six months ago, to provide options to generate
>program-parsable output from smbclient and nmblookup.  If you search the
>archives, you should find exactly what you're looking for.  I'm not sure
>whether the patches were rejected or just never incorporated.
Did this include using RPC instead of RAP?
'smbclient' is perfectly parsable as it is, as it uses limited width output.
The lack of RPC functionality is more of a problem, as it by definition 
us to 13 character share names.
Thanks for the info though. It looks like (from the version 3 tree) that 
the general
push is away from smbclient anyway, so I guess the better thing would be 
to get
this fixed in 'net' instead.


Danny Smith
Senior Systems Administrator, Cinesite (Europe) Ltd
020 7973 4000 - x4055    /    dannys at

More information about the samba-technical mailing list