Bugfix for interface.c

Kai Fritzowsky kai at mkm.de
Wed Dec 6 10:18:25 GMT 2000


Hi!

After applying several patches to a Solaris 7 box, the nmbd died right after
startup.
I tracked the bug down to a memcmp() call in source/lib/interface.c.
Obviously the call relies on the fact that the compared structures consist
of one single memory block, which is not true for the patched Solaris 7
libc any more.

My system:
# uname -svr
SunOS 5.7 Generic_106541-12
# nmbd -V
Version 2.0.7

The bugfix for the described problem is attached.

Greetings,
ka.i
-- 
perl -e '@_=(0110,0101|010<<0<<1<<0<<1,1<<1<<1<<0<<1<<1<<1<<0<<1|11*1<<1<<1
,0110|0100>>1|1<<1<<1,111,11*010>>1,010*1<<1<<1,11*010-1,101,(0100<<1)-(010
<<1|010>>1),(11>>1)+111,(1<<1<<1<<1<<1<<1)+1,010+(1<<1));printf"%c"x at _, at _'
-------------- next part --------------
--- source/lib/interface.c	Wed Oct 13 07:26:48 1999
+++ /tmp/interface.c	Wed Dec  6 10:57:23 2000
@@ -229,16 +229,25 @@
 ****************************************************************************/
 BOOL interfaces_changed(void)
 {
-	int n;
+	int n, i;
 	struct iface_struct ifaces[MAX_INTERFACES];
 
 	n = get_interfaces(ifaces, MAX_INTERFACES);
 
+/*
 	if (n != total_probed ||
 	    memcmp(ifaces, probed_ifaces, sizeof(ifaces[0])*n)) {
 		return True;
 	}
-	
+*/	
+	if (n != total_probed) {
+          return True;
+	}
+        for (i=0;i<n;i++) {
+          if (memcmp(&ifaces[i], &probed_ifaces[i], sizeof(ifaces[i]))) {
+                return True;
+          }
+        }
 	return False;
 }
 


More information about the samba mailing list