[PATCH] Improve netbios name handling

Jeremy Allison jra at samba.org
Thu Feb 19 12:59:25 MST 2015


On Fri, Jan 30, 2015 at 05:29:38PM +0100, Andreas Schneider wrote:
>  
> +	nbt_len = strlen(node_name);
> +	if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
> +		printf("The specified netbios name is to long.\n");

Should be 'is too long', not 'to long'.

Also print out the name in this printf.

> +		talloc_free(tmp_ctx);
> +		return false;
> +	}
> +
>  	nbtsock = nbt_name_socket_init(tmp_ctx, ev);
>  	
>  	if (options.root_port) {
> diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
> index 78548e9..d6a920c 100644
> --- a/source3/utils/nmblookup.c
> +++ b/source3/utils/nmblookup.c
> @@ -320,6 +320,7 @@ int main(int argc, const char *argv[])
>  	while(poptPeekArg(pc)) {
>  		char *p;
>  		struct in_addr ip;
> +		size_t nbt_len;
>  
>  		fstrcpy(lookup,poptGetArg(pc));
>  
> @@ -349,6 +350,13 @@ int main(int argc, const char *argv[])
>  			sscanf(++p,"%x",&lookup_type);
>  		}
>  
> +		nbt_len = strlen(lookup);
> +		if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
> +			d_printf("The specified netbios name is to long!\n");

Should be 'is too long', not 'to long'.

Also print out the name in this printf.

Thanks,

Jeremy.


More information about the samba-technical mailing list