[RESENDx2][BUG] interpret_interface() destroys token

Nick Wellnhofer wellnhofer at aevum.de
Mon Jun 21 13:08:42 GMT 2004


[ This is the third time I'm sending this. Why is noone interested? Is 
this the wrong list? ]


Hi,

the following code in interpret_interface() in lib/interface.c destroys
the token parameter (Samba version 3.0.2).

	/* parse it into an IP address/netmasklength pair */
	*p++ = 0;

If we have an IP address/netmask token and interpret_interface() is
called a second time it only sees the IP address, can't find the netmask
and fails.

This is a problem with nmbd, because it reloads all interfaces if the
list of interfaces changes. If you specify an interface with an IP
address/netmask pair in smb.conf, start nmbd and any new interface comes
up or goes down (a PPP connection for example) nmbd dies after a while
with the message:

     reload_interfaces: No subnets to listen to. Shutting down...

There seem to be quite a few people who had this problem.

http://www.google.com/search?q=nmbd+%22No+subnets+to+listen+to%22

I have attached a patch that fixes the bug, but is a little kludgy and
not thread-safe.

Nick


-- 
aevum gmbh
leopoldstr. 87
80802 münchen
germany

fon: +4989 38380653
fax: +4989 38799384
wellnhofer at aevum.de
http://aevum.de/



-------------- next part --------------
--- source/lib/interface.c~destroys-config	2004-04-15 18:00:44.000000000 +0200
+++ source/lib/interface.c	2004-04-15 18:01:15.000000000 +0200
@@ -130,10 +130,12 @@
 	}
 
 	/* parse it into an IP address/netmasklength pair */
-	*p++ = 0;
+	*p = 0;
 
 	ip = *interpret_addr2(token);
 
+	*p++ = '/';
+
 	if (strlen(p) > 2) {
 		nmask = *interpret_addr2(p);
 	} else {




More information about the samba-technical mailing list