[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Fri Sep 11 01:38:02 UTC 2015


The branch, master has been updated
       via  b0f41c0 build: use as-needed linker flag also on OpenBSD
       via  d3e51b9 nss_winbind: fix hang on Solaris on big groups
       via  a997c77 nss_wins: add module for FreeBSD
      from  b7eb725 smbXsrv_session: factor smbXsrv_session_add_channel() out of smbXsrv_session_create()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b0f41c07ffe8600433c20a038b1612c04ed29e89
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Sep 10 21:31:03 2015 +0200

    build: use as-needed linker flag also on OpenBSD
    
    OpenBSD is unusable with binaries with many superfluous libs linked in.
    samba-tool start times of 250 seconds without as-needed vs. 1.4 seconds with
    as-needed.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11355
    
    Signed-off-by: Bjoern Jacke <bj at sernet.de>
    Reviewed-by: Ralph Böhme <rb at sernet.de>
    
    Autobuild-User(master): Björn Jacke <bj at sernet.de>
    Autobuild-Date(master): Fri Sep 11 03:37:17 CEST 2015 on sn-devel-104

commit d3e51b9cfe3d56530253571e020af72da1877044
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Sep 10 14:35:32 2015 +0200

    nss_winbind: fix hang on Solaris on big groups
    
    The problem with large groups on Solaris in the the NSS winbind module is
    Solaris wants the return value to be NSS_UNAVAIL if the buffer given is too
    small for getgrnam_r.  The current code return NSS_TRYAGAIN which causes
    Solaris/Illumos to loop without trying to resize the buffer.
    
    Thanks to  Nathan Huff <nhuff at acm.org> for finding this out.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=10365
    
    Signed-off-by: Bjoern Jacke <bj at sernet.de>
    Reviewed-by: Ralph Böhme <rb at sernet.de>

commit a997c7780e69117bcc18b43834275d9bb332c4ad
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Sep 10 11:27:42 2015 +0200

    nss_wins: add module for FreeBSD
    
    Thanks to Timur Bakeyev <timur at FreeBSD.org> for the patch.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11493
    
    Signed-off-by: Bjoern Jacke <bj at sernet.de>
    Reviewed-by: Ralph Böhme <rb at sernet.de>

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/winbind_nss_solaris.c |  6 ++++
 nsswitch/wins_freebsd.c        | 81 ++++++++++++++++++++++++++++++++++++++++++
 nsswitch/wscript_build         |  7 +++-
 wscript                        |  3 +-
 4 files changed, 94 insertions(+), 3 deletions(-)
 create mode 100644 nsswitch/wins_freebsd.c


Changeset truncated at 500 lines:

diff --git a/nsswitch/winbind_nss_solaris.c b/nsswitch/winbind_nss_solaris.c
index 1d0ac90..dfb87e3 100644
--- a/nsswitch/winbind_nss_solaris.c
+++ b/nsswitch/winbind_nss_solaris.c
@@ -259,6 +259,9 @@ _nss_winbind_getgrnam_solwrap(nss_backend_t* be, void* args)
 	if(ret == NSS_STATUS_SUCCESS)
 		NSS_ARGS(args)->returnval = (void*) result;
 
+	if (NSS_ARGS(args)->erange == ERANGE && ret == NSS_STATUS_TRYAGAIN)
+		return NSS_STATUS_UNAVAIL;
+
 	return ret;
 }
 
@@ -278,6 +281,9 @@ _nss_winbind_getgrgid_solwrap(nss_backend_t* be, void* args)
 	if(ret == NSS_STATUS_SUCCESS)
 		NSS_ARGS(args)->returnval = (void*) result;
 
+	if (NSS_ARGS(args)->erange == ERANGE && ret == NSS_STATUS_TRYAGAIN)
+		return NSS_STATUS_UNAVAIL;
+
 	return ret;
 }
 
diff --git a/nsswitch/wins_freebsd.c b/nsswitch/wins_freebsd.c
new file mode 100644
index 0000000..c1845d2
--- /dev/null
+++ b/nsswitch/wins_freebsd.c
@@ -0,0 +1,81 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Timur I. Bakeyev 2007
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this library; if not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA  02111-1307, USA.
+*/
+
+#include "winbind_client.h"
+
+extern enum nss_status _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he,
+                          char *buffer, size_t buflen, int *h_errnop);
+
+ns_mtab *nss_module_register(const char *source, unsigned int *, nss_module_unregister_fn *);
+
+NSS_METHOD_PROTOTYPE(__nss_wins_freebsd_gethostbyname2_r);
+
+static ns_mtab methods[] =
+{
+       { NSDB_HOSTS, "getaddrinfo",      NULL, NULL },
+       { NSDB_HOSTS, "ghbyname",         NULL, NULL },
+       { NSDB_HOSTS, "ghbyaddr",         NULL, NULL },
+       { NSDB_HOSTS, "gethostbyaddr_r",  NULL, NULL },
+       { NSDB_HOSTS, "gethostbyname2_r", __nss_wins_freebsd_gethostbyname2_r, _nss_wins_gethostbyname2_r },
+       { NSDB_HOSTS, "getnetbyname_r",   NULL, NULL },
+       { NSDB_HOSTS, "getnetbyaddr_r",   NULL, NULL },
+       { NSDB_HOSTS, "gethostbyname",    NULL, NULL },
+       { NSDB_HOSTS, "gethostbyaddr",    NULL, NULL },
+       { NSDB_HOSTS, "getnetbyname",     NULL, NULL },
+       { NSDB_HOSTS, "getnetbyaddr",     NULL, NULL }
+};
+
+int
+__nss_wins_freebsd_gethostbyname2_r(void *retval, void *mdata, va_list ap)
+{
+       int (*fn)(const char *, int, struct hostent *, char *, size_t, int *);
+       const char      *hostname;
+       int             af;
+       struct hostent  *he;
+       char            *buffer;
+       size_t          buflen;
+       int             *h_errnop;
+       enum nss_status status;
+
+       fn = mdata;
+       hostname = va_arg(ap, const char *);
+       af = va_arg(ap, int);
+       he = va_arg(ap, struct hostent *);
+       buffer = va_arg(ap, char *);
+       buflen = va_arg(ap, size_t);
+       h_errnop = va_arg(ap, int *);
+
+       status = fn(hostname, af, he, buffer, buflen, h_errnop);
+       status = __nss_compat_result(status, *h_errnop);
+       if (status == NS_SUCCESS)
+               *(struct hostent **)retval = he;
+
+       return (status);
+}
+
+ns_mtab *
+nss_module_register(const char *source __unused, unsigned int *mtabsize,
+    nss_module_unregister_fn *unreg)
+{
+       *mtabsize = sizeof(methods) / sizeof(methods[0]);
+       *unreg = NULL;
+       return (methods);
+}
diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build
index 381ff44..bf7d908 100644
--- a/nsswitch/wscript_build
+++ b/nsswitch/wscript_build
@@ -39,7 +39,6 @@ if (Utils.unversioned_sys_platform() == 'linux' or (host_os.rfind('gnu') > -1)):
               pc_files=[],
               vnum='2')
 
-    # for nss_wins is linux only
     bld.SAMBA3_LIBRARY('nss_wins',
                        keep_underscore=True,
                        source='wins.c',
@@ -57,6 +56,12 @@ elif (host_os.rfind('freebsd') > -1):
 			  realname='nss_winbind.so.1',
 			  vnum='1')
 
+	bld.SAMBA3_LIBRARY('nss_wins',
+			  source='wins.c wins_freebsd.c',
+			  deps='''param libsmb LIBTSOCKET''',
+			  realname='nss_wins.so.1',
+			  vnum='1')
+
 elif (host_os.rfind('netbsd') > -1):
 	# NetBSD winbind client is implemented as a wrapper
 	# around the Linux version. It needs getpwent_r() to
diff --git a/wscript b/wscript
index a84e5d5..9431e11 100644
--- a/wscript
+++ b/wscript
@@ -166,8 +166,7 @@ def configure(conf):
     # allows us to find problems on our development hosts faster.
     # It also results in faster load time.
 
-    if not sys.platform.startswith("openbsd"):
-        conf.env.asneeded_ldflags = conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
+    conf.env.asneeded_ldflags = conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
 
     if not conf.CHECK_NEED_LC("-lc not needed"):
         conf.ADD_LDFLAGS('-lc', testflags=False)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list