PERFORCE change 99852 for review

Michael Bushkov bushman at FreeBSD.org
Fri Jun 23 07:06:37 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=99852

Change 99852 by bushman at bushman_nss_ldap_cached on 2006/06/23 07:06:21

	nsdispatch(3) behaviour slightly changed to correctly process stubs from nss_stubs.c

Affected files ...

.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nsdispatch.c#5 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nss_stubs.c#2 edit

Differences ...

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nsdispatch.c#5 (text+ko) ====

@@ -430,20 +430,11 @@
 	*src = NULL;
 }
 
-/* ARGSUSED */
-ns_mtab *
-__dummy_reg(const char *name, unsigned int *mtab_size,
-	nss_module_unregister_fn *fn)
-{
-	return (NULL);
-}
-
 /*
  * NSS module management.
  */
 /* The built-in NSS modules are all loaded at once. */
 #define NSS_BACKEND(name, reg) \
-__weak_reference(__dummy_reg, reg);\
 ns_mtab	*reg(const char *, unsigned int *, nss_module_unregister_fn *);
 #include "nss_backends.h"
 #undef NSS_BACKEND
@@ -507,11 +498,16 @@
 	}
 	mod.mtab = fn(mod.name, &mod.mtabsize, &mod.unregister);
 	if (mod.mtab == NULL || mod.mtabsize == 0) {
-		if (mod.handle != nss_builtin_handle)
+		if (mod.handle != nss_builtin_handle) {
 			(void)dlclose(mod.handle);
-		mod.handle = NULL;
-		nss_log(LOG_ERR, "%s, registration failed", mod.name);
-		goto fin;
+			nss_log(LOG_ERR, "%s, registration failed", mod.name);
+			mod.handle = NULL;
+			goto fin;
+		} else {
+			/* we've loaded the stub - now try the real module */
+			nss_load_module(source, NULL);
+			return;
+		}
 	}
 	if (mod.mtabsize > 1)
 		qsort(mod.mtab, mod.mtabsize, sizeof(mod.mtab[0]),

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nss_stubs.c#2 (text+ko) ====

@@ -35,6 +35,8 @@
 __dummy_reg(const char *name, unsigned int *mtab_size,
         nss_module_unregister_fn *fn)
 {
+	*mtab_size = 0;
+	*fn = NULL;
         return (NULL);
 }
 


More information about the p4-projects mailing list