[Samba] Getting a list of all possible smb mounts (and bug report
on smbtree)
Buchan Milne
bgmilne at cae.co.za
Mon Oct 20 12:00:58 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> Message: 36
> Date: Sat, 18 Oct 2003 12:26:02 +0200 (CEST)
> From: Bernhard Rosenkraenzer <bero at arklinux.org>
> Subject: [Samba] Getting a list of all possible smb mounts
> To: samba at lists.samba.org
> Message-ID: <Pine.LNX.4.56.0310181208330.21409 at dot.kde.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> Hi,
> I'm currently doing this to get a list of all possible SMB mounts:
>
> nmblookup -M -- - [grab list of master browsers]
> for every master browser:
> smbclient -L {MASTER BROWSER IP} -U user%pass
> * Parse everything after "Workgroup.*Master" to get list of
> workgroups and workgroup masters
> for every found workgroup master:
> smbclient -L {WORKGROUP MASTER IP} -U user%pass
> * Parse everything between "Server.*Comment" and
> "Workgroup.*Master" to get list of hosts
> for every found host:
> smbclient -L {HOST} -U user%pass
> * Parse everything between "Sharename.*Type.*Comment" and
> "Server.*Comment" to get available mounts
>
> This mostly works, but has a couple of problems, such as
> * smbclient -L some_ip -U user%pass apparently hangs for 10+ minutes
> if some_ip belongs to a Windoze box with a paranoid firewall
> [Tried with 2.2.8a, 3.0.0, 3.0.1pre1 and current CVS 3.0 branch]
> * smbclient -L {WORKGROUP MASTER IP} -U user%pass doesn't always find
> all machines in the workgroup, and sometimes finds machines that
> have been turned off ages ago (I know this isn't samba's fault).
>
> Is there a better way to get a list of available SMB mounts, or at
least a
> workaround for the long hangs?
>
Have you tried the smbtree program in samba-3.0.0?
It seems to be a bit broken in samba-3.0.1pre1 though ... firstly it
wants to be able to write to the log directory, and after changing the
perms on the log directory, it dies loading codepages:
write(1, "Adding chars 0x7d 0x0 (l->u = Fa"..., 52Adding chars 0x7d 0x0
(l->u = False) (u->l = False)
) = 52
write(1, "Adding chars 0x7e 0x0 (l->u = Fa"..., 52Adding chars 0x7e 0x0
(l->u = False) (u->l = False)
) = 52
time(NULL) = 1066650666
gettimeofday({1066650666, 501634}, NULL) = 0
stat64("/etc/samba/smb.conf", {st_mode=S_IFREG|0644, st_size=1740, ...}) = 0
open("/etc/samba/smb.conf", O_RDONLY|O_LARGEFILE) = 12
fstat64(12, {st_mode=S_IFREG|0644, st_size=1740, ...}) = 0
read(12, "# $Id$\n# Some change\n\n[global]\n "..., 1740) = 1740
close(12) = 0
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 12
ioctl(12, 0x8912, 0xbfffb0d8) = 0
ioctl(12, 0x8915, 0xbfffb100) = 0
ioctl(12, 0x8913, 0xbfffb100) = 0
ioctl(12, 0x891b, 0xbfffb100) = 0
ioctl(12, 0x8915, 0xbfffb0e0) = 0
ioctl(12, 0x8913, 0xbfffb0e0) = 0
ioctl(12, 0x891b, 0xbfffb0e0) = 0
close(12) = 0
time(NULL) = 1066650666
umask(022) = 022
open("/var/log/samba3/log.smbtree3",
O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0644) = 12
umask(022) = 022
geteuid32() = 501
write(12, "[2003/10/20 13:51:06, 6] lib/cha"..., 64) = 64
geteuid32() = 501
write(12, " codepage_initialise: client co"..., 44) = 44
time(NULL) = 1066650666
geteuid32() = 501
write(12, "[2003/10/20 13:51:06, 5] lib/cha"..., 65) = 65
geteuid32() = 501
write(12, " load_client_codepage: loading "..., 44) = 44
- --- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Normal (broken) output looks like this on samba-3.0.1pre1:
$ smbtree3
Password:
WORKGROUP
\\ABTCOMPAQ Compaq Laptop
\\ABTCOMPAQ\abt mail
\\ABTCOMPAQ\IPC$ Remote IPC
MDKGROUP
CAE
\\PRINT Samba Server 2.2.8a
Adding chars 0x0 0x0 (l->u = False) (u->l = False)
Adding chars 0x21 0x0 (l->u = False) (u->l = False)
Adding chars 0x23 0x0 (l->u = False) (u->l = False)
Adding chars 0x24 0x0 (l->u = False) (u->l = False)
Adding chars 0x25 0x0 (l->u = False) (u->l = False)
Adding chars 0x26 0x0 (l->u = False) (u->l = False)
Adding chars 0x27 0x0 (l->u = False) (u->l = False)
Adding chars 0x28 0x0 (l->u = False) (u->l = False)
Adding chars 0x29 0x0 (l->u = False) (u->l = False)
Adding chars 0x2d 0x0 (l->u = False) (u->l = False)
Adding chars 0x2e 0x0 (l->u = False) (u->l = False)
Adding chars 0x30 0x0 (l->u = False) (u->l = False)
Adding chars 0x31 0x0 (l->u = False) (u->l = False)
Adding chars 0x32 0x0 (l->u = False) (u->l = False)
Adding chars 0x33 0x0 (l->u = False) (u->l = False)
Adding chars 0x34 0x0 (l->u = False) (u->l = False)
Adding chars 0x35 0x0 (l->u = False) (u->l = False)
Adding chars 0x36 0x0 (l->u = False) (u->l = False)
Adding chars 0x37 0x0 (l->u = False) (u->l = False)
Adding chars 0x38 0x0 (l->u = False) (u->l = False)
Adding chars 0x39 0x0 (l->u = False) (u->l = False)
Adding chars 0x40 0x0 (l->u = False) (u->l = False)
Adding chars 0x41 0x0 (l->u = False) (u->l = False)
Adding chars 0x42 0x0 (l->u = False) (u->l = False)
Adding chars 0x43 0x0 (l->u = False) (u->l = False)
Adding chars 0x44 0x0 (l->u = False) (u->l = False)
Adding chars 0x45 0x0 (l->u = False) (u->l = False)
Adding chars 0x46 0x0 (l->u = False) (u->l = False)
Adding chars 0x47 0x0 (l->u = False) (u->l = False)
Adding chars 0x48 0x0 (l->u = False) (u->l = False)
Adding chars 0x49 0x0 (l->u = False) (u->l = False)
Adding chars 0x4a 0x0 (l->u = False) (u->l = False)
Adding chars 0x4b 0x0 (l->u = False) (u->l = False)
Adding chars 0x4c 0x0 (l->u = False) (u->l = False)
Adding chars 0x4d 0x0 (l->u = False) (u->l = False)
Adding chars 0x4e 0x0 (l->u = False) (u->l = False)
Adding chars 0x4f 0x0 (l->u = False) (u->l = False)
Adding chars 0x50 0x0 (l->u = False) (u->l = False)
Adding chars 0x51 0x0 (l->u = False) (u->l = False)
Adding chars 0x52 0x0 (l->u = False) (u->l = False)
Adding chars 0x53 0x0 (l->u = False) (u->l = False)
Adding chars 0x54 0x0 (l->u = False) (u->l = False)
Adding chars 0x55 0x0 (l->u = False) (u->l = False)
Adding chars 0x56 0x0 (l->u = False) (u->l = False)
Adding chars 0x57 0x0 (l->u = False) (u->l = False)
Adding chars 0x58 0x0 (l->u = False) (u->l = False)
Adding chars 0x59 0x0 (l->u = False) (u->l = False)
Adding chars 0x5a 0x0 (l->u = False) (u->l = False)
Adding chars 0x5e 0x0 (l->u = False) (u->l = False)
Adding chars 0x5f 0x0 (l->u = False) (u->l = False)
Adding chars 0x60 0x0 (l->u = False) (u->l = False)
Adding chars 0x61 0x0 (l->u = False) (u->l = False)
Adding chars 0x62 0x0 (l->u = False) (u->l = False)
Adding chars 0x63 0x0 (l->u = False) (u->l = False)
Adding chars 0x64 0x0 (l->u = False) (u->l = False)
Adding chars 0x65 0x0 (l->u = False) (u->l = False)
Adding chars 0x66 0x0 (l->u = False) (u->l = False)
Adding chars 0x67 0x0 (l->u = False) (u->l = False)
Adding chars 0x68 0x0 (l->u = False) (u->l = False)
Adding chars 0x69 0x0 (l->u = False) (u->l = False)
Adding chars 0x6a 0x0 (l->u = False) (u->l = False)
Adding chars 0x6b 0x0 (l->u = False) (u->l = False)
Adding chars 0x6c 0x0 (l->u = False) (u->l = False)
Adding chars 0x6d 0x0 (l->u = False) (u->l = False)
Adding chars 0x6e 0x0 (l->u = False) (u->l = False)
Adding chars 0x6f 0x0 (l->u = False) (u->l = False)
Adding chars 0x70 0x0 (l->u = False) (u->l = False)
Adding chars 0x71 0x0 (l->u = False) (u->l = False)
Adding chars 0x72 0x0 (l->u = False) (u->l = False)
Adding chars 0x73 0x0 (l->u = False) (u->l = False)
Adding chars 0x74 0x0 (l->u = False) (u->l = False)
Adding chars 0x75 0x0 (l->u = False) (u->l = False)
Adding chars 0x76 0x0 (l->u = False) (u->l = False)
Adding chars 0x77 0x0 (l->u = False) (u->l = False)
Adding chars 0x78 0x0 (l->u = False) (u->l = False)
Adding chars 0x79 0x0 (l->u = False) (u->l = False)
Adding chars 0x7a 0x0 (l->u = False) (u->l = False)
Adding chars 0x7b 0x0 (l->u = False) (u->l = False)
Adding chars 0x7d 0x0 (l->u = False) (u->l = False)
Adding chars 0x7e 0x0 (l->u = False) (u->l = False)
Segmentation fault (core dumped)
(core files available on request)
Normal operation on samba-3.0.0 looks like this
$ smbtree3
Password:
CAE
\\PRINT Samba Server 2.2.8a
\\PRINT\bgmilne Home Directories
\\PRINT\canongp
\\PRINT\dj1120
\\PRINT\dj970
\\PRINT\hp2100
\\PRINT\hp5l
\\PRINT\ADMIN$ IPC Service (Samba Server 2.2.8a)
\\PRINT\IPC$ IPC Service (Samba Server 2.2.8a)
\\PRINT\print$
\\PRINT\hp1200_ps Special print share to print
from programs that output Postscript (ie Wave)
\\PRINT\hp2100_ps Special print share to print
from programs that output Postscript (ie Wave)
\\PRINT\webpages Webpages hosted on this machine
(intranet, alpha, beta)
\\HERMES Samba Server 3.0.0
\\HERMES\bgmilne Home Directories
\\HERMES\hp5l No Information Available
\\HERMES\hp2100 Hewlett Packard HP2100
Laserjet
\\HERMES\dj970 HP Colour Printer
\\HERMES\dj1120 HP Colour Printer
\\HERMES\canongp GP200-225PCL
\\HERMES\ADMIN$ IPC Service (Samba
Server 3.0.0)
\\HERMES\IPC$ IPC Service (Samba
Server 3.0.0)
etc.. where CAE is the workgroup name in this case, and PRINT and HERMES
are two netbios names of samba servers (windows machines were also listed).
Regards,
Buchan
- --
|--------------Another happy Mandrake Club member--------------|
Buchan Milne Mechanical Engineer, Network Manager
Cellphone * Work +27 82 472 2231 * +27 21 8828820x202
Stellenbosch Automotive Engineering http://www.cae.co.za
GPG Key http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/k855rJK6UGDSBKcRAksQAJ9Wl5HTwbVJWQS6yEdkyYM8S/c8JgCfa5vI
olkEDe6/mX99Em5zjqLTGcA=
=8mq0
-----END PGP SIGNATURE-----
More information about the samba
mailing list