summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-05-08 15:52:53 +0000
committerGerald Carter <jerry@samba.org>2002-05-08 15:52:53 +0000
commitd5369989d2d7e8aa2ad9f25aba78857cecc7df37 (patch)
tree5cd3725b38152cfa148b6520604692854428cea6 /packaging
parentf14ea695115d2f2b503147df64e7315ddaf8ff40 (diff)
downloadsamba-d5369989d2d7e8aa2ad9f25aba78857cecc7df37.tar.gz
samba-d5369989d2d7e8aa2ad9f25aba78857cecc7df37.tar.xz
samba-d5369989d2d7e8aa2ad9f25aba78857cecc7df37.zip
Note that findsmb has been made s standard part of samba
(located now in source/script/). This commit merges in Simo's fixes from HEAD, but package maintainers should remove the local copy of findsmb in the distro directory and get it from scripts (just like smbtar).
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/Caldera/OpenLinux/findsmb23
-rwxr-xr-xpackaging/Caldera/OpenServer/findsmb10
-rwxr-xr-xpackaging/Caldera/UnixWare/findsmb27
-rwxr-xr-xpackaging/Mandrake/findsmb23
-rwxr-xr-xpackaging/PHT/TurboLinux/findsmb23
-rwxr-xr-xpackaging/SGI/findsmb79
6 files changed, 82 insertions, 103 deletions
diff --git a/packaging/Caldera/OpenLinux/findsmb b/packaging/Caldera/OpenLinux/findsmb
index fb178f91c1c..04bc6080508 100755
--- a/packaging/Caldera/OpenLinux/findsmb
+++ b/packaging/Caldera/OpenLinux/findsmb
@@ -63,17 +63,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# get the first <00> name
- @name = grep(/<00> - /,@nmblookup);
+ @name = grep(/<00>/,@nmblookup);
$_ = @name[0];
- if (not $_) {
-# try without the -r option
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
- @name = grep(/<00> - /,@nmblookup);
- $_ = @name[0];
- }
if ($_) { # we have a netbios name
if (/GROUP/) { # is it a group name
($name, $aliases, $type, $length, @addresses) =
@@ -82,13 +73,16 @@ foreach $ip (@ipaddrs) # loop through each IP address found
$name = "unknown nis name";
}
} else {
- /(\S+)/;
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
$name = $1;
}
# do an smbclient command on the netbios name.
- open(SMB,"$SAMBABIN/smbclient -N -L '$name' -I $ip -U% |") ||
+ open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
die("Can't do smbclient command.\n");
@smb = <SMB>;
close SMB;
@@ -104,7 +98,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@info = grep(/OS=/,@smb);
$_ = @info[0];
if ($_) { # we found response
- s/.*Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
} else { # no OS= string in response (WIN95 client)
@@ -112,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
diff --git a/packaging/Caldera/OpenServer/findsmb b/packaging/Caldera/OpenServer/findsmb
index 2e831c5f11a..04bc6080508 100755
--- a/packaging/Caldera/OpenServer/findsmb
+++ b/packaging/Caldera/OpenServer/findsmb
@@ -15,7 +15,7 @@
# that workgroup.
#
-$SAMBABIN = "/usr/lib/samba/bin";
+$SAMBABIN = "/usr/bin";
for ($i = 0; $i < 2; $i++) { # test for -d option and broadcast address
$_ = shift;
@@ -73,7 +73,10 @@ foreach $ip (@ipaddrs) # loop through each IP address found
$name = "unknown nis name";
}
} else {
- /(\S+)/;
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
$name = $1;
}
@@ -103,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
diff --git a/packaging/Caldera/UnixWare/findsmb b/packaging/Caldera/UnixWare/findsmb
index 4871b24ea4b..04bc6080508 100755
--- a/packaging/Caldera/UnixWare/findsmb
+++ b/packaging/Caldera/UnixWare/findsmb
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
#
# Prints info on all smb responding machines on a subnet.
# This script needs to be run on a machine without nmbd running and be
@@ -15,7 +15,7 @@
# that workgroup.
#
-$SAMBABIN = "/usr/local/samba/bin";
+$SAMBABIN = "/usr/bin";
for ($i = 0; $i < 2; $i++) { # test for -d option and broadcast address
$_ = shift;
@@ -63,17 +63,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# get the first <00> name
- @name = grep(/<00> - /,@nmblookup);
+ @name = grep(/<00>/,@nmblookup);
$_ = @name[0];
- if (not $_) {
-# try without the -r option
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
- @name = grep(/<00> - /,@nmblookup);
- $_ = @name[0];
- }
if ($_) { # we have a netbios name
if (/GROUP/) { # is it a group name
($name, $aliases, $type, $length, @addresses) =
@@ -82,13 +73,16 @@ foreach $ip (@ipaddrs) # loop through each IP address found
$name = "unknown nis name";
}
} else {
- /(\S+)/;
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
$name = $1;
}
# do an smbclient command on the netbios name.
- open(SMB,"$SAMBABIN/smbclient -N -L '$name' -I $ip -U% |") ||
+ open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
die("Can't do smbclient command.\n");
@smb = <SMB>;
close SMB;
@@ -104,7 +98,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@info = grep(/OS=/,@smb);
$_ = @info[0];
if ($_) { # we found response
- s/.*Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
} else { # no OS= string in response (WIN95 client)
@@ -112,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
diff --git a/packaging/Mandrake/findsmb b/packaging/Mandrake/findsmb
index fb178f91c1c..04bc6080508 100755
--- a/packaging/Mandrake/findsmb
+++ b/packaging/Mandrake/findsmb
@@ -63,17 +63,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# get the first <00> name
- @name = grep(/<00> - /,@nmblookup);
+ @name = grep(/<00>/,@nmblookup);
$_ = @name[0];
- if (not $_) {
-# try without the -r option
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
- @name = grep(/<00> - /,@nmblookup);
- $_ = @name[0];
- }
if ($_) { # we have a netbios name
if (/GROUP/) { # is it a group name
($name, $aliases, $type, $length, @addresses) =
@@ -82,13 +73,16 @@ foreach $ip (@ipaddrs) # loop through each IP address found
$name = "unknown nis name";
}
} else {
- /(\S+)/;
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
$name = $1;
}
# do an smbclient command on the netbios name.
- open(SMB,"$SAMBABIN/smbclient -N -L '$name' -I $ip -U% |") ||
+ open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
die("Can't do smbclient command.\n");
@smb = <SMB>;
close SMB;
@@ -104,7 +98,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@info = grep(/OS=/,@smb);
$_ = @info[0];
if ($_) { # we found response
- s/.*Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
} else { # no OS= string in response (WIN95 client)
@@ -112,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
diff --git a/packaging/PHT/TurboLinux/findsmb b/packaging/PHT/TurboLinux/findsmb
index fb178f91c1c..04bc6080508 100755
--- a/packaging/PHT/TurboLinux/findsmb
+++ b/packaging/PHT/TurboLinux/findsmb
@@ -63,17 +63,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# get the first <00> name
- @name = grep(/<00> - /,@nmblookup);
+ @name = grep(/<00>/,@nmblookup);
$_ = @name[0];
- if (not $_) {
-# try without the -r option
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
- @name = grep(/<00> - /,@nmblookup);
- $_ = @name[0];
- }
if ($_) { # we have a netbios name
if (/GROUP/) { # is it a group name
($name, $aliases, $type, $length, @addresses) =
@@ -82,13 +73,16 @@ foreach $ip (@ipaddrs) # loop through each IP address found
$name = "unknown nis name";
}
} else {
- /(\S+)/;
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
$name = $1;
}
# do an smbclient command on the netbios name.
- open(SMB,"$SAMBABIN/smbclient -N -L '$name' -I $ip -U% |") ||
+ open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
die("Can't do smbclient command.\n");
@smb = <SMB>;
close SMB;
@@ -104,7 +98,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@info = grep(/OS=/,@smb);
$_ = @info[0];
if ($_) { # we found response
- s/.*Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
} else { # no OS= string in response (WIN95 client)
@@ -112,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
diff --git a/packaging/SGI/findsmb b/packaging/SGI/findsmb
index c71837e3757..04bc6080508 100755
--- a/packaging/SGI/findsmb
+++ b/packaging/SGI/findsmb
@@ -1,4 +1,4 @@
-#!/bin/perl
+#!/usr/bin/perl
#
# Prints info on all smb responding machines on a subnet.
# This script needs to be run on a machine without nmbd running and be
@@ -15,7 +15,7 @@
# that workgroup.
#
-$SAMBABIN = "/usr/samba/bin";
+$SAMBABIN = "/usr/bin";
for ($i = 0; $i < 2; $i++) { # test for -d option and broadcast address
$_ = shift;
@@ -47,9 +47,7 @@ open(NMBLOOKUP,"$SAMBABIN/nmblookup $BCAST '*'|") ||
# print header info
-print "\n *=DMB\n";
-print " +=LMB\n";
-print "IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION $BCAST\n";
+print "\nIP ADDR NETBIOS NAME WORKGROUP/OS/VERSION $BCAST\n";
print "---------------------------------------------------------------------\n";
foreach $ip (@ipaddrs) # loop through each IP address found
@@ -63,48 +61,32 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@nmblookup = <NMBLOOKUP>;
close NMBLOOKUP;
-# get the first non group <00> name
+# get the first <00> name
- @name = grep(/<00> - /,@nmblookup);
+ @name = grep(/<00>/,@nmblookup);
$_ = @name[0];
- if (not $_) {
-# try without the -r option
- open(NMBLOOKUP,"$SAMBABIN/nmblookup -A $ip|") ||
- die("Can't get nmb name list.\n");
- @nmblookup = <NMBLOOKUP>;
- close NMBLOOKUP;
- @name = grep(/<00> - /,@nmblookup);
- $_ = @name[0];
- }
- /(\S+)/;
- $name = $1;
-
- if (not $name) { # no netbios name found
-# try getting the host name
- ($name, $aliases, $type, $length, @addresses) =
- gethostbyaddr(pack('C4',split('\.',$ip)),2);
- if (! $name) { # could not get name
- $name = "unknown name";
- }
- if (length($name) > 15) {
- $name = substr($name,0,15);
+ if ($_) { # we have a netbios name
+ if (/GROUP/) { # is it a group name
+ ($name, $aliases, $type, $length, @addresses) =
+ gethostbyaddr(pack('C4',split('\.',$ip)),2);
+ if (! $name) { # could not get name
+ $name = "unknown nis name";
+ }
+ } else {
+# The Netbios name can contain lot of characters also '<' '>'
+# and spaces. The follwing cure inside name space but not
+# names starting or ending with spaces
+ /(.{1,15})\s+<00>\s+/;
+ $name = $1;
}
-# do an smbclient command on the ip address
-
- open(SMB,"$SAMBABIN/smbclient -N -L '$ip' -I $ip -U% |") ||
- die("Can't do smbclient command.\n");
- @smb = <SMB>;
- close SMB;
- } else { # netbios name found
# do an smbclient command on the netbios name.
- open(SMB,"$SAMBABIN/smbclient -N -L '$name' -I $ip -U% |") ||
+ open(SMB,"$SAMBABIN/smbclient -N -L $name -I $ip -U% |") ||
die("Can't do smbclient command.\n");
@smb = <SMB>;
close SMB;
- }
- {
+
if ($DEBUG) { # if -d flag print results of nmblookup and smbclient
print "===============================================================\n";
print @nmblookup;
@@ -116,7 +98,7 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@info = grep(/OS=/,@smb);
$_ = @info[0];
if ($_) { # we found response
- s/.*Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
+ s/Domain=|OS=|Server=|\n//g; # strip out descriptions to make line shorter
} else { # no OS= string in response (WIN95 client)
@@ -124,7 +106,8 @@ foreach $ip (@ipaddrs) # loop through each IP address found
@name = grep(/<00> - <GROUP>/,@nmblookup);
$_ = @name[0];
if ($_) {
- /(\S+)/;
+# Same as before for space and characters
+ /(.{1,15})\s+<00>\s+/;
$_ = "[$1]";
} else {
$_ = "Unknown Workgroup";
@@ -143,8 +126,20 @@ foreach $ip (@ipaddrs) # loop through each IP address found
# line up info in 3 columns
- print "$ip".' 'x(16-length($ip))."$name".' 'x(16-length($name))."$master"."$_\n";
+ print "$ip".' 'x(16-length($ip))."$name".' 'x(14-length($name))."$master"."$_\n";
- }
+ } else { # no netbios name found
+# try getting the host name
+ ($name, $aliases, $type, $length, @addresses) =
+ gethostbyaddr(pack('C4',split('\.',$ip)),2);
+ if (! $name) { # could not get name
+ $name = "unknown nis name";
+ }
+ if ($DEBUG) { # if -d flag print results of nmblookup
+ print "===============================================================\n";
+ print @nmblookup;
+ }
+ print "$ip".' 'x(16-length($ip))."$name\n";
+ }
}