summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2018-10-15 17:50:02 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2018-10-15 17:50:02 +0000
commit1d7da823b49459aab466de4614b1895e917df3da (patch)
treed3032d673ca312050f5a75e1c587b7b5b01ad7f5
parent3f74c0272eaf1a4455c94db9fc2f5ed812d04020 (diff)
Notes
-rw-r--r--lib/libc/net/nsdispatch.37
-rw-r--r--lib/libc/net/nsdispatch.c14
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/libc/net/nsdispatch.3 b/lib/libc/net/nsdispatch.3
index 9654c841faf4e..e53bbb9647ce8 100644
--- a/lib/libc/net/nsdispatch.3
+++ b/lib/libc/net/nsdispatch.3
@@ -32,7 +32,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 4, 2010
+.Dd October 15, 2018
.Dt NSDISPATCH 3
.Os
.Sh NAME
@@ -112,10 +112,7 @@ which case they are selected using the
and
.Fa method_name
arguments along with the configured source.
-(The methods supplied via
-.Fa dtab
-take priority over those implemented in NSS modules in the event
-of a conflict.)
+Modules must use source names different from the built-in ones.
.Pp
.Va defaults
contains a list of default sources to try if
diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c
index bf605ece65f09..b9533bd1ca46d 100644
--- a/lib/libc/net/nsdispatch.c
+++ b/lib/libc/net/nsdispatch.c
@@ -486,9 +486,19 @@ nss_load_module(const char *source, nss_module_register_fn reg_fn)
*/
mod.handle = nss_builtin_handle;
fn = reg_fn;
- } else if (!is_dynamic())
+ } else if (!is_dynamic()) {
goto fin;
- else {
+ } else if (strcmp(source, NSSRC_CACHE) == 0 ||
+ strcmp(source, NSSRC_COMPAT) == 0 ||
+ strcmp(source, NSSRC_DB) == 0 ||
+ strcmp(source, NSSRC_DNS) == 0 ||
+ strcmp(source, NSSRC_FILES) == 0 ||
+ strcmp(source, NSSRC_NIS) == 0) {
+ /*
+ * Avoid calling dlopen(3) for built-in modules.
+ */
+ goto fin;
+ } else {
if (snprintf(buf, sizeof(buf), "nss_%s.so.%d", mod.name,
NSS_MODULE_INTERFACE_VERSION) >= (int)sizeof(buf))
goto fin;