Diff below:- - sets "nmbd bind explicit broadcast" appropriately for -current OpenBSD, causing nmbd to bind to 0.0.0.0 (or whatever is set in "socket address") rather than separately binding a socket to each broadcast address.
Should we do this or should we rethink allowing sockets to be bound to broadcast IP addresses? Does anyone know of other programs that want to bind to broadcast addresses or is it just samba? - fixes a bug causing nmbd to crash with malloc options J when using the above option (if this were OpenBSD code it should just be using calloc to allocate of course, but here we should stick to samba's usual style). Whatever we decide with the "nmbd bind explicit broadcast" default setting, the nmbd_packets.c diff fixes a bug and should be fed upstream. Index: Makefile =================================================================== RCS file: /cvs/ports/net/samba/Makefile,v retrieving revision 1.140 diff -u -p -r1.140 Makefile --- Makefile 17 Apr 2011 08:33:14 -0000 1.140 +++ Makefile 23 Apr 2011 12:10:35 -0000 @@ -5,7 +5,7 @@ SHARED_ONLY= Yes COMMENT-main= SMB and CIFS client and server for UNIX COMMENT-docs= additional documentation and examples for Samba -REVISION-main= 3 +REVISION-main= 4 DISTNAME= samba-3.5.8 PKGNAME-main= ${DISTNAME} Index: patches/patch-nmbd_nmbd_packets_c =================================================================== RCS file: patches/patch-nmbd_nmbd_packets_c diff -N patches/patch-nmbd_nmbd_packets_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-nmbd_nmbd_packets_c 23 Apr 2011 12:10:35 -0000 @@ -0,0 +1,11 @@ +$OpenBSD$ +--- nmbd/nmbd_packets.c.orig Sat Apr 23 12:55:40 2011 ++++ nmbd/nmbd_packets.c Sat Apr 23 12:54:31 2011 +@@ -1708,6 +1708,7 @@ only use %d.\n", count, FD_SETSIZE)); + SAFE_FREE(pset); + return True; + } ++ memset(sock_array, '\0', (count) * sizeof(int)); + + FD_ZERO(pset); + Index: patches/patch-param_loadparm_c =================================================================== RCS file: patches/patch-param_loadparm_c diff -N patches/patch-param_loadparm_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-param_loadparm_c 23 Apr 2011 12:10:35 -0000 @@ -0,0 +1,19 @@ +$OpenBSD$ +--- param/loadparm.c.orig Sat Apr 23 12:57:19 2011 ++++ param/loadparm.c Sat Apr 23 12:58:44 2011 +@@ -4970,9 +4970,14 @@ static void init_globals(bool first_time_only) + string_set(&Globals.szSocketAddress, "0.0.0.0"); + /* + * By default support explicit binding to broadcast +- * addresses. ++ * addresses, but not on OpenBSD where it is no longer ++ * supported. + */ ++#ifdef __OpenBSD__ ++ Globals.bNmbdBindExplicitBroadcast = false; ++#else + Globals.bNmbdBindExplicitBroadcast = true; ++#endif + + if (asprintf(&s, "Samba %s", samba_version_string()) < 0) { + smb_panic("init_globals: ENOMEM");