util_str.c and Problems with wins

Heinreichsberger Helmut helmut.heinreichsberger at sbs.at
Mon Feb 14 00:25:57 GMT 2000


By reading this part of code from samba 2.0.6 I found 2 possible problems.

1) Function next_token:
	if (!ptr) ptr = &last_ptr;
	if (!ptr) return(False);	// I think this should read as:
if(!*ptr) return(False);

	s = *ptr;

last_ptr is defined as static char *, and so it always returns an address.

2) Function strhex_to_str:
	char	*hexchars = "0123456789ABCDEF";
	for ( i = 0; i < len && strhex[i] != 0; i++ )
		if( strnequal(hexchars, "0x", 2))		// I think
this should be: if( strnequal(strhex +i, "0x", 2))
			i++;	/* skip 2 chars	*/

the variable hexchars is unchanged in this function, so this test never can
be true. 

When this function should skip any non-hex-numeric characters (as
described), then the following change should be done:
	if (!(p1 = strchr(hexchars, toupper(strhex[i]))))
	if (!(p1 = strchr(hexchars, toupper(strhex[i]))))
		continue;		/* the first character is
non-hex-numeric, so skip that character	*/

So here is my Problem with wins:
I have installed Samba on Redhat Linux 6.0 with 3 Ethernet-cards. Every Card
has its own address and its own DNS-Name.
2 private addresses and 1 public address. I have only 1 Wins-Server, that
isn't in the range of my Network Masks. And so the Samba Server registers
all 3 IP-Addresses to the wins server under the unique Machine-Name. So it
can be that a client, that comes from the public side, get the private
IP-Address from the Wins-Server. The private Addresses are blocked by the
routers, and so the client cannot connect to the server with net NetBIOS
name. I think that the better way for registering the Interfaces is to take
the DNS-Name of the interface and not the Machine-Name.



More information about the samba-technical mailing list