tags:

views:

909

answers:

3

Hi all,

We're trying to get SMB volume listings in our OS X application, and have been using NMBLookup, as suggested by Apple, to get listings. However, more often than not, we're not able to get a full listing of available SMB volumes using the tool. We've got a good benchmark in that we can see the full listing the Apple Finder gets, and the majority of the time, our listing is not matching up, usually missing servers.

We're tried a number ways of executing the command, but haven't yet found anything that brings us back a complete listing.

nmblookup -M -- -

nmblookup '*'

etc

Does anyone know what we could be doing wrong, or know of a better way to query for SMB volumes available on local subnets?

Many thanks

Paul

A: 

Insightful. Thanks Dan

Chops
+1  A: 

This work fairly well in our network. The point is to use smbclient -L on each of the entries returned by nmblookup:

nmblookup  -M -- - | grep -v querying | while read sw
do
echo $sw | awk -F' ' '{print $1}' | xargs smbclient -L 
done

Edit: @paul - now I see what you mean - a vista has just joined our network and the Finder shows it but not nmblookup, but smbclient shows it in the "Server" section.

smbclient has a "Server" section where it lists the machines found on the network. The command line I use is:

smbclient -L 192.168.0.4 //the IP as returned by nmblookup of the master browser

cristi:~ diciu$ smbclient -L 192.168.0.4
Domain=[DOMAIN] OS=[Unix] Server=[Samba 3.0.24-7.fc5]
    Sharename       Type      Comment
    ---------       ----      -------
    internal        Disk      some share
[..]
Anonymous login successful
Domain=[DOMAIN] OS=[Unix] Server=[Samba 3.0.24-7.fc5]

    Server               Comment
    ---------            -------
    MMM                  Vista box not showing up in nmblookup
diciu
When I've tried that on my system, it's just literally giving me info on the one and only IP address NMBLookup has returned. Doesn't list anything beyond the shares for that IP address and the server info.
Chops
Any other ideas?
Chops
More interesting, if, rather than doing nmblookup -M -- -, I do nmblookup workgroup, I get a better listing. Obviously this will only be machines in the WORKGROUP group (which all of ours are), but the behaviour of the tool is very different. Any ideas?
Chops
A: 

I can't comment, so to diciu (This is Paul Dunlop logged in properly btw! Yeah, managed to mess up posting my first question. Slick eh).

That was what was suggested to us by Apple, but the results of the nmblookup query aren't complete. We've seen situations were, on a network with 5 windows machines, it returns nothing. In other setups, it's returning a full listing. What we can't figure is why this would be.

It should be noted we're talking about mixed networks, with OS X, Linux and Windows machines available.

Chops