suggestion for libsmbclient feature / (SMB URL syntax)

Derrell.Lipman at Derrell.Lipman at
Sat Jan 29 15:31:19 GMT 2005

Alexander Vodomerov <alex at> writes:

> I would like to use libsmbclient to scan remote server. However, there
> is a problem, that I cannot solve. Out network is quite large (more than
> 2000 hosts). There is no strong administration, so each user choose
> whatever name for his computer. As a result, there many hosts have the
> same names. To scan them, I've tried to use IP instead of name. It
> works well for the most part of network. However, there are some old
> machines running Win98 and this method doesn't work for them.
> After googling I found that Win98 requires NetBIOS name to be specified:
> So, if I use only name I can't properly scan machines with the same
> names. If I use only IP - I can't scan machines with Win98. The solution
> is to use both! smbclient already allows to specify both name and IP
> (via -I cmdline option). But the libsmbclient doesn't have such ability.
> Functions like smbc_open get URL in form of //host/share or
> //ip.ip.ip.ip/share, but not both.
> I suggest adding this feature to libsmbclient. What is the best way to
> specify ip? I've seen sources of the libsmbclient and found that there
> are some "options". Currently supported options are "?mb=all",
> "?mb=any". Maybe new option like "?ip=x.y.z.t" can be added? However,
> with current code options and URL cannot be specified at the same time.
> Another idea is to put this into SMBCCTX structure...
> I can create a patch that add this functionality. What should be done
> for it to be applied upstream? What coding style/policy/etc should I
> follow? Do you see another solution for this problem?


I added the ?mb option that you mention.  Unfortunately, it violates the
proposed standard for the SMB URL:

I recently submitted a set of changes that, amongh other more significant
changes, remove the ?mb option, opting instead to provide a set of c-code
options in the context structure.  This eliminates the need to extend the URL
options fields.

As to what you request, I believe that the "CALLED" option is intended to do
what you request (see the above link).  I've CC'ed Chris Hertel who wrote the
proposed URL standard.  I hope he'll provide you with additional information
about whether this is in fact the intended purpose of the CALLED option.

That option is, as you discovered, not currently supported in libsmbclient.
If you'd like to implement it, I should send you (or you can find in the
archives from a couple of weeks ago) my patch to libsmbclient.  It's fairly
large since it adds a lot of new functionality for setting and retrieving
attributes, so it would be best if you started with that rather than having to
merge in multiple patches.  In the process of implementing the ?mb option in
libsmbclient, I added a general facility for processing options (with no
options currently supported) that should make it reasonably easy to
implemented CALLED if that's appropriate.



More information about the samba-technical mailing list