findsmb PATCH -- host names can contain spaces

Derrell.Lipman at UnwiredUniverse.com Derrell.Lipman at UnwiredUniverse.com
Fri May 3 08:28:02 GMT 2002


This patch corrects a problem that occurs when a windows host name contains a
space.  Previously, only the first word of the host name would be displayed.

NOTES:

  1. It may not be "proper" to have spaces in host names, but Win98, at least,
     allows it, so findsmb should print the names correctly.)
  
  2. There is still a likely bug where the script searches for "GROUP" but
     does not limit the search to avoid searching within the host name
     itself.  This means that a host name of GROUPLEAD, for example, would
     likely match and the script would fail.

  3. I really don't know perl, so there's probably a one-line (simpler) way of
     doing what's in this patch.

This patch is against SAMBA_2_2 from CVS.

----------------------------------------------------------------------

--- findsmb~	Fri Apr 26 10:17:46 2002
+++ findsmb	Fri May  3 11:14:37 2002
@@ -73,8 +73,10 @@
 	    $name = "unknown nis name";
 	}
     } else {
-	/(\S+)/;
-	$name = $1;
+# names can have whitespace, so we can not split based on just looking for \S
+        /\s*([^<]+)/;
+        $name = $1;
+        $name =~ s/\s*$//
     }
 
 # do an smbclient command on the netbios name.




More information about the samba-technical mailing list