[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Oct 20 09:06:02 MDT 2010


The branch, master has been updated
       via  ab01d61 nsstest: no need for two copies of the same tool.
       via  abb07fa s3-waf: more registry cleanup.
       via  d05157a s3-waf: convert LIBSMBCONF into a subsystem.
       via  4a2e47b s3-waf: move RPC_CLIENT_SCHANNEL into a subsystem.
      from  71ac92b s4-schema_init: Print more info about syntax we fail to recognize

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


- Log -----------------------------------------------------------------
commit ab01d6139fc7b2c4b651a0959a5816352d6bb49b
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 20 14:52:30 2010 +0200

    nsstest: no need for two copies of the same tool.
    
    Guenther
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Wed Oct 20 15:05:34 UTC 2010 on sn-devel-104

commit abb07fad043b141c3a3128c04f1e5a8d1c1507e8
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 20 02:17:41 2010 +0200

    s3-waf: more registry cleanup.
    
    Guenher

commit d05157a47026632b1c231defeefa553811aef163
Author: Günther Deschner <gd at samba.org>
Date:   Wed Oct 20 01:54:12 2010 +0200

    s3-waf: convert LIBSMBCONF into a subsystem.
    
    Guenther

commit 4a2e47b74a7dbf8604d6a3eff6235819d13fd83f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 8 13:17:21 2010 +0200

    s3-waf: move RPC_CLIENT_SCHANNEL into a subsystem.
    
    Guenther

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

Summary of changes:
 nsswitch/nsstest.c         |  144 ++++++++++---
 source3/Makefile.in        |    2 +-
 source3/auth/wscript_build |    1 +
 source3/torture/nsstest.c  |  495 --------------------------------------------
 source3/wscript_build      |   54 ++++--
 5 files changed, 152 insertions(+), 544 deletions(-)
 delete mode 100644 source3/torture/nsstest.c


Changeset truncated at 500 lines:

diff --git a/nsswitch/nsstest.c b/nsswitch/nsstest.c
index 26f816f..8742b32 100644
--- a/nsswitch/nsstest.c
+++ b/nsswitch/nsstest.c
@@ -2,6 +2,7 @@
    Unix SMB/CIFS implementation.
    nss tester for winbindd
    Copyright (C) Andrew Tridgell 2001
+   Copyright (C) Tim Potter 2003
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,9 +19,15 @@
 */
 
 #include "includes.h"
-
 #include "nsswitch/nsstest.h"
 
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+
 static const char *so_path = "/lib/libnss_winbind.so";
 static const char *nss_name = "winbind";
 static int nss_errno;
@@ -29,11 +36,13 @@ static int total_errors;
 
 static void *find_fn(const char *name)
 {
-	char s[1024];
+	char *s;
 	static void *h;
 	void *res;
 
-	snprintf(s,sizeof(s), "_nss_%s_%s", nss_name, name);
+	if (asprintf(&s, "_nss_%s_%s", nss_name, name) < 0) {
+		exit(1);
+	}
 
 	if (!h) {
 		h = dlopen(so_path, RTLD_LAZY);
@@ -45,8 +54,11 @@ static void *find_fn(const char *name)
 	res = dlsym(h, s);
 	if (!res) {
 		printf("Can't find function %s\n", s);
+		total_errors++;
+		SAFE_FREE(s);
 		return NULL;
 	}
+	SAFE_FREE(s);
 	return res;
 }
 
@@ -61,11 +73,16 @@ static void report_nss_error(const char *who, NSS_STATUS status)
 static struct passwd *nss_getpwent(void)
 {
 	NSS_STATUS (*_nss_getpwent_r)(struct passwd *, char *,
-				      size_t , int *) = find_fn("getpwent_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(struct passwd *, char *,
+				size_t, int *))find_fn("getpwent_r");
 	static struct passwd pwd;
 	static char buf[1000];
 	NSS_STATUS status;
 
+	if (!_nss_getpwent_r)
+		return NULL;
+
 	status = _nss_getpwent_r(&pwd, buf, sizeof(buf), &nss_errno);
 	if (status == NSS_STATUS_NOTFOUND) {
 		return NULL;
@@ -80,11 +97,16 @@ static struct passwd *nss_getpwent(void)
 static struct passwd *nss_getpwnam(const char *name)
 {
 	NSS_STATUS (*_nss_getpwnam_r)(const char *, struct passwd *, char *,
-				      size_t , int *) = find_fn("getpwnam_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(const char *, struct passwd *, char *,
+				size_t, int *))find_fn("getpwnam_r");
 	static struct passwd pwd;
 	static char buf[1000];
 	NSS_STATUS status;
 
+	if (!_nss_getpwnam_r)
+		return NULL;
+
 	status = _nss_getpwnam_r(name, &pwd, buf, sizeof(buf), &nss_errno);
 	if (status == NSS_STATUS_NOTFOUND) {
 		return NULL;
@@ -99,11 +121,16 @@ static struct passwd *nss_getpwnam(const char *name)
 static struct passwd *nss_getpwuid(uid_t uid)
 {
 	NSS_STATUS (*_nss_getpwuid_r)(uid_t , struct passwd *, char *,
-				      size_t , int *) = find_fn("getpwuid_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(uid_t, struct passwd *, char *,
+				size_t, int *))find_fn("getpwuid_r");
 	static struct passwd pwd;
 	static char buf[1000];
 	NSS_STATUS status;
 
+	if (!_nss_getpwuid_r)
+		return NULL;
+
 	status = _nss_getpwuid_r(uid, &pwd, buf, sizeof(buf), &nss_errno);
 	if (status == NSS_STATUS_NOTFOUND) {
 		return NULL;
@@ -117,8 +144,13 @@ static struct passwd *nss_getpwuid(uid_t uid)
 
 static void nss_setpwent(void)
 {
-	NSS_STATUS (*_nss_setpwent)(void) = find_fn("setpwent");
+	NSS_STATUS (*_nss_setpwent)(void) =
+		(NSS_STATUS(*)(void))find_fn("setpwent");
 	NSS_STATUS status;
+
+	if (!_nss_setpwent)
+		return;
+
 	status = _nss_setpwent();
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("setpwent", status);
@@ -127,8 +159,13 @@ static void nss_setpwent(void)
 
 static void nss_endpwent(void)
 {
-	NSS_STATUS (*_nss_endpwent)(void) = find_fn("endpwent");
+	NSS_STATUS (*_nss_endpwent)(void) =
+		(NSS_STATUS (*)(void))find_fn("endpwent");
 	NSS_STATUS status;
+
+	if (!_nss_endpwent)
+		return;
+
 	status = _nss_endpwent();
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("endpwent", status);
@@ -139,26 +176,37 @@ static void nss_endpwent(void)
 static struct group *nss_getgrent(void)
 {
 	NSS_STATUS (*_nss_getgrent_r)(struct group *, char *,
-				      size_t , int *) = find_fn("getgrent_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(struct group *, char *,
+				size_t, int *))find_fn("getgrent_r");
 	static struct group grp;
 	static char *buf;
 	static int buflen = 1024;
 	NSS_STATUS status;
 
-	if (!buf) buf = malloc_array_p(char, buflen);
+	if (!_nss_getgrent_r)
+		return NULL;
+
+	if (!buf)
+		buf = (char *)malloc(buflen);
 
 again:
 	status = _nss_getgrent_r(&grp, buf, buflen, &nss_errno);
 	if (status == NSS_STATUS_TRYAGAIN) {
 		buflen *= 2;
-		buf = realloc_p(buf, char, buflen);
+		buf = (char *)realloc(buf, buflen);
+		if (!buf) {
+			return NULL;
+		}
 		goto again;
 	}
 	if (status == NSS_STATUS_NOTFOUND) {
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("getgrent", status);
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	return &grp;
@@ -167,25 +215,36 @@ again:
 static struct group *nss_getgrnam(const char *name)
 {
 	NSS_STATUS (*_nss_getgrnam_r)(const char *, struct group *, char *,
-				      size_t , int *) = find_fn("getgrnam_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(const char *, struct group *, char *,
+				size_t, int *))find_fn("getgrnam_r");
 	static struct group grp;
 	static char *buf;
 	static int buflen = 1000;
 	NSS_STATUS status;
 
-	if (!buf) buf = malloc_array_p(char, buflen);
+	if (!_nss_getgrnam_r)
+		return NULL;
+
+	if (!buf)
+		buf = (char *)malloc(buflen);
 again:
 	status = _nss_getgrnam_r(name, &grp, buf, buflen, &nss_errno);
 	if (status == NSS_STATUS_TRYAGAIN) {
 		buflen *= 2;
-		buf = realloc_p(buf, char, buflen);
+		buf = (char *)realloc(buf, buflen);
+		if (!buf) {
+			return NULL;
+		}
 		goto again;
 	}
 	if (status == NSS_STATUS_NOTFOUND) {
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("getgrnam", status);
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	return &grp;
@@ -194,25 +253,37 @@ again:
 static struct group *nss_getgrgid(gid_t gid)
 {
 	NSS_STATUS (*_nss_getgrgid_r)(gid_t , struct group *, char *,
-				      size_t , int *) = find_fn("getgrgid_r");
+				      size_t , int *) =
+		(NSS_STATUS (*)(gid_t, struct group *, char *,
+				size_t, int *))find_fn("getgrgid_r");
 	static struct group grp;
 	static char *buf;
 	static int buflen = 1000;
 	NSS_STATUS status;
 
-	if (!buf) buf = malloc_array_p(char, buflen);
+	if (!_nss_getgrgid_r)
+		return NULL;
+
+	if (!buf)
+		buf = (char *)malloc(buflen);
+
 again:
 	status = _nss_getgrgid_r(gid, &grp, buf, buflen, &nss_errno);
 	if (status == NSS_STATUS_TRYAGAIN) {
 		buflen *= 2;
-		buf = realloc_p(buf, char, buflen);
+		buf = (char *)realloc(buf, buflen);
+		if (!buf) {
+			return NULL;
+		}
 		goto again;
 	}
 	if (status == NSS_STATUS_NOTFOUND) {
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("getgrgid", status);
+		SAFE_FREE(buf);
 		return NULL;
 	}
 	return &grp;
@@ -220,8 +291,13 @@ again:
 
 static void nss_setgrent(void)
 {
-	NSS_STATUS (*_nss_setgrent)(void) = find_fn("setgrent");
+	NSS_STATUS (*_nss_setgrent)(void) =
+		(NSS_STATUS (*)(void))find_fn("setgrent");
 	NSS_STATUS status;
+
+	if (!_nss_setgrent)
+		return;
+
 	status = _nss_setgrent();
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("setgrent", status);
@@ -230,8 +306,13 @@ static void nss_setgrent(void)
 
 static void nss_endgrent(void)
 {
-	NSS_STATUS (*_nss_endgrent)(void) = find_fn("endgrent");
+	NSS_STATUS (*_nss_endgrent)(void) =
+		(NSS_STATUS (*)(void))find_fn("endgrent");
 	NSS_STATUS status;
+
+	if (!_nss_endgrent)
+		return;
+
 	status = _nss_endgrent();
 	if (status != NSS_STATUS_SUCCESS) {
 		report_nss_error("endgrent", status);
@@ -242,10 +323,13 @@ static int nss_initgroups(char *user, gid_t group, gid_t **groups, long int *sta
 {
 	NSS_STATUS (*_nss_initgroups)(char *, gid_t , long int *,
 				      long int *, gid_t **, long int , int *) =
-		find_fn("initgroups_dyn");
+		(NSS_STATUS (*)(char *, gid_t, long int *,
+				long int *, gid_t **,
+				long int, int *))find_fn("initgroups_dyn");
 	NSS_STATUS status;
 
-	if (!_nss_initgroups) return NSS_STATUS_UNAVAIL;
+	if (!_nss_initgroups)
+		return NSS_STATUS_UNAVAIL;
 
 	status = _nss_initgroups(user, group, start, size, groups, 0, &nss_errno);
 	if (status != NSS_STATUS_SUCCESS) {
@@ -256,11 +340,11 @@ static int nss_initgroups(char *user, gid_t group, gid_t **groups, long int *sta
 
 static void print_passwd(struct passwd *pwd)
 {
-	printf("%s:%s:%d:%d:%s:%s:%s\n",
+	printf("%s:%s:%lu:%lu:%s:%s:%s\n",
 	       pwd->pw_name,
 	       pwd->pw_passwd,
-	       pwd->pw_uid,
-	       pwd->pw_gid,
+	       (unsigned long)pwd->pw_uid,
+	       (unsigned long)pwd->pw_gid,
 	       pwd->pw_gecos,
 	       pwd->pw_dir,
 	       pwd->pw_shell);
@@ -269,10 +353,10 @@ static void print_passwd(struct passwd *pwd)
 static void print_group(struct group *grp)
 {
 	int i;
-	printf("%s:%s:%d: ",
+	printf("%s:%s:%lu:",
 	       grp->gr_name,
 	       grp->gr_passwd,
-	       grp->gr_gid);
+	       (unsigned long)grp->gr_gid);
 
 	if (!grp->gr_mem[0]) {
 		printf("\n");
@@ -280,7 +364,7 @@ static void print_group(struct group *grp)
 	}
 
 	for (i=0; grp->gr_mem[i+1]; i++) {
-		printf("%s, ", grp->gr_mem[i]);
+		printf("%s,", grp->gr_mem[i]);
 	}
 	printf("%s\n", grp->gr_mem[i]);
 }
@@ -293,7 +377,7 @@ static void nss_test_initgroups(char *name, gid_t gid)
 	int i;
 	NSS_STATUS status;
 
-	groups = (gid_t *)malloc_array_p(gid_t, size);
+	groups = (gid_t *)malloc(size);
 	groups[0] = gid;
 
 	status = nss_initgroups(name, gid, &groups, &start, &size);
@@ -303,9 +387,9 @@ static void nss_test_initgroups(char *name, gid_t gid)
 	}
 
 	for (i=0; i<start-1; i++) {
-		printf("%d, ", groups[i]);
+		printf("%lu, ", (unsigned long)groups[i]);
 	}
-	printf("%d\n", groups[i]);
+	printf("%lu\n", (unsigned long)groups[i]);
 }
 
 
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 491c1a9..86cd88a 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1216,7 +1216,7 @@ LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) \
                $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \
                $(LIBNDR_GEN_OBJ0) $(FNAME_UTIL_OBJ)
 
-NSSTEST_OBJ = torture/nsstest.o $(LIBSAMBAUTIL_OBJ)
+NSSTEST_OBJ = ../nsswitch/nsstest.o $(LIBSAMBAUTIL_OBJ)
 
 PDBTEST_OBJ = torture/pdbtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
 		$(LIB_NONSMBD_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
diff --git a/source3/auth/wscript_build b/source3/auth/wscript_build
index 62a730c..0fd28bc 100644
--- a/source3/auth/wscript_build
+++ b/source3/auth/wscript_build
@@ -61,6 +61,7 @@ bld.SAMBA_MODULE('auth_server',
 bld.SAMBA_MODULE('auth_domain',
                  subsystem='auth',
                  source=AUTH_DOMAIN_SRC,
+                 deps='RPC_CLIENT_SCHANNEL',
                  init_function='',
                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('AUTH_DOMAIN'),
                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('AUTH_DOMAIN'))
diff --git a/source3/torture/nsstest.c b/source3/torture/nsstest.c
deleted file mode 100644
index dcdfd1c..0000000
--- a/source3/torture/nsstest.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   nss tester for winbindd
-   Copyright (C) Andrew Tridgell 2001
-   Copyright (C) Tim Potter 2003
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-   
-   This program 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 General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "nsswitch/winbind_client.h"
-
-#ifdef malloc
-#undef malloc
-#endif
-#ifdef realloc
-#undef realloc
-#endif
-
-static const char *so_path = "/lib/libnss_winbind.so";
-static const char *nss_name = "winbind";
-static int nss_errno;
-static NSS_STATUS last_error;
-static int total_errors;
-
-static void *find_fn(const char *name)
-{
-	char *s;
-	static void *h;
-	void *res;
-
-	if (asprintf(&s, "_nss_%s_%s", nss_name, name) < 0) {
-		exit(1);
-	}
-
-	if (!h) {
-		h = dlopen(so_path, RTLD_LAZY);
-	}
-	if (!h) {
-		printf("Can't open shared library %s\n", so_path);
-		exit(1);
-	}
-	res = dlsym(h, s);
-	if (!res) {
-		printf("Can't find function %s\n", s);
-		total_errors++;
-		SAFE_FREE(s);
-		return NULL;
-	}
-	SAFE_FREE(s);
-	return res;
-}
-
-static void report_nss_error(const char *who, NSS_STATUS status)
-{
-	last_error = status;
-	total_errors++;
-	printf("ERROR %s: NSS_STATUS=%d  %d (nss_errno=%d)\n", 
-	       who, status, NSS_STATUS_SUCCESS, nss_errno);
-}
-
-static struct passwd *nss_getpwent(void)
-{
-	NSS_STATUS (*_nss_getpwent_r)(struct passwd *, char *, 
-				      size_t , int *) =
-		(NSS_STATUS (*)(struct passwd *, char *,
-				size_t, int *))find_fn("getpwent_r");
-	static struct passwd pwd;
-	static char buf[1000];
-	NSS_STATUS status;
-
-	if (!_nss_getpwent_r)
-		return NULL;
-
-	status = _nss_getpwent_r(&pwd, buf, sizeof(buf), &nss_errno);
-	if (status == NSS_STATUS_NOTFOUND) {
-		return NULL;
-	}
-	if (status != NSS_STATUS_SUCCESS) {
-		report_nss_error("getpwent", status);
-		return NULL;
-	}
-	return &pwd;
-}
-
-static struct passwd *nss_getpwnam(const char *name)
-{
-	NSS_STATUS (*_nss_getpwnam_r)(const char *, struct passwd *, char *, 
-				      size_t , int *) =
-		(NSS_STATUS (*)(const char *, struct passwd *, char *,
-				size_t, int *))find_fn("getpwnam_r");


-- 
Samba Shared Repository


More information about the samba-cvs mailing list