findsmb PATCH -- host names can contain spaces

Simo Sorce idra at samba.org
Fri May 3 16:02:04 GMT 2002


Sorry but your patch is not ok as also '<' is a valid NetBIOS name
character.

I just put a fix into HEAD someday ago just to fix this problem,
it is not perfect yet but will work resonably well (I think my patch
will not correctly detect names starting or ending with spaces and to do
it we would require to modify nmblookup output).

On Fri, 2002-05-03 at 17:25, Derrell.Lipman at UnwiredUniverse.com wrote:
> 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.
> 
-- 
Simo Sorce
----------
Una scelta di liberta': Software Libero.
A choice of freedom: Free Software.
http://www.softwarelibero.it




More information about the samba-technical mailing list