libsmbclient -I equivalent?

Richard Sharpe rsharpe at
Mon Apr 8 20:17:01 GMT 2002

On Mon, 8 Apr 2002, Mike Rosack wrote:

> I'm trying to upgrade an smbclient-based share crawler I've written to
> libsmbclient and Alain's perl Filesys::SmbClient package.  This is for the
> Georgia Tech campus network, so the crawler will span multiple subnets.
> The problem I'm having is that about half of the clients I query won't
> recognize an IP based smb URL like this: smb://  The
> campus WINS server is flaky, plus there are many duplicate hostnames over
> the various subnets, so using it isn't really the answer in this scenario.
> What I need is some way to write the URL with the hostname like this:
> smb://hostname/share, and pass in the IP address to try to connect to.  Sort
> of like doing this in smbclient:
> smbclient //hostname/share -I

Hmmm, 128.61. ... I see what you mean ...

> Is there some way to do this that I'm missing?

This could be supplied in a couple of ways:

1. Provide a call/routine to libsmbclient that provides the target and 
source NetBIOS names to be used for all subsequent requests.

2. Extend the URL syntax to allow both the IP address and the NetBIOS name 
to be supplied.

3. Add code to have the library go out and retrieve the NetBIOS name from 
the target before trying to connect. I thought such code was already in 
the source, but maybe not.  This involves doing an adapter query or some 
such. [A quick perusal of libsmbclient reveals that opendir includes a 
call to name_status_find, but the main code for connecting to a server 
does not.

Of the three, one and three are easiest, and the code is left as an 
exercise for the reader :-)

Richard Sharpe, rsharpe at, rsharpe at, 
sharpe at

More information about the samba-technical mailing list