summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-13 12:54:59 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-13 12:54:59 +0000
commit80120a79bc5381d86241b4173f085a00f5bb7e01 (patch)
tree068fe4cabadd7f1885cfc4ace30ad3c8d5d4fda5 /source3
parente3293c7181525a069d2006c29792a1a805d93ee0 (diff)
downloadsamba-80120a79bc5381d86241b4173f085a00f5bb7e01.tar.gz
samba-80120a79bc5381d86241b4173f085a00f5bb7e01.tar.bz2
samba-80120a79bc5381d86241b4173f085a00f5bb7e01.zip
Patch from ab, to make findsmb omit -r most of the time.
(original mail follows) -- From: Alexander Bokovoy <a.bokovoy@sam-solutions.net> Greetings! I propose to make an optional argument '-r' for findsmb utility to pass '-r' option to nmblookup optionally and default to omit it. The reason is to have findsmb working more user-friendly in contemporary office environments where Windows 95/98 boxes are rare and also to allow usage of the utility under non-priviledged accounts when Windows95/98 boxes are in minority or even absent in network neighbourhood. An attached patch provides this change for HEAD together with documentation changes. -- / Alexander Bokovoy (This used to be commit d0bebea521e12fb9cef66feecd969216607ef63d)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/findsmb.in21
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/script/findsmb.in b/source3/script/findsmb.in
index d2aa94591b..5ca1d8082a 100755
--- a/source3/script/findsmb.in
+++ b/source3/script/findsmb.in
@@ -5,7 +5,7 @@
# run as root to get correct info from WIN95 clients.
#
# syntax:
-# findsmb [subnet broadcast address]
+# findsmb [-d|-D] [-r] [subnet broadcast address]
#
# with no agrument it will list machines on the current subnet
#
@@ -13,21 +13,28 @@
# local master browsers for that workgroup. There will be an "*" in front
# of the workgroup name for machines that are the domain master browser for
# that workgroup.
+#
+# Options:
+#
+# -d|-D enable debug
+# -r add -r option to nmblookup when finding netbios name
#
$SAMBABIN = "@prefix@/bin";
-for ($i = 0; $i < 2; $i++) { # test for -d option and broadcast address
+for ($i = 0; $i < 2; $i++) { # test for -d and -r options
$_ = shift;
if (m/-d|-D/) {
$DEBUG = 1;
- } else {
- if ($_) {
- $BCAST = "-B $_";
- }
+ } else (m/-r/) {
+ $R_OPTION = "-r";
}
}
+if ($_) { # set broadcast address if it was specified
+ $BCAST = "-B $_";
+}
+
sub ipsort # do numeric sort on last field of IP address
{
@t1 = split(/\./,$a);
@@ -56,7 +63,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# find the netbios names registered by each machine
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -r -A $ip|") ||
+ open(NMBLOOKUP,"$SAMBABIN/nmblookup $R_OPTION -A $ip|") ||
die("Can't get nmb name list.\n");
@nmblookup = <NMBLOOKUP>;
close NMBLOOKUP;