diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2008-02-04 22:32:36 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2008-02-04 22:32:36 +0000 |
commit | 72c25e69e9ef8382423f4aad20d90d7ac0d673ae (patch) | |
tree | f28fe683e824e671aee86c473f0991dbdcb4dbee | |
parent | 0ed6689ba2e5bbdfed9f7829dd03c9607f95001a (diff) |
only call __nss_configure_lookup() if it is available, if it isn't the platform is out of luck
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@623 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | nslcd/nslcd.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index e7818ba..7692a44 100644 --- a/configure.ac +++ b/configure.ac @@ -194,6 +194,7 @@ AC_CHECK_FUNCS(ether_ntoa_r) AC_CHECK_FUNCS(setgroups) AC_CHECK_FUNCS(getpeereid) AC_CHECK_FUNCS(getpeerucred) +AC_CHECK_FUNCS(__nss_configure_lookup) # replace getopt_long() function if it is not on the system AC_REPLACE_FUNCS(getopt_long) diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c index f57a8a0..06dfff1 100644 --- a/nslcd/nslcd.c +++ b/nslcd/nslcd.c @@ -45,7 +45,9 @@ #ifdef HAVE_GRP_H #include <grp.h> #endif /* HAVE_GRP_H */ +#ifdef HAVE_NSS_H #include <nss.h> +#endif /* HAVE_NSS_H */ #include <pthread.h> #ifndef HAVE_GETOPT_LONG #include "compat/getopt_long.h" @@ -514,8 +516,11 @@ int main(int argc,char *argv[]) /* disable ldap lookups of host names to avoid lookup loop and fall back to files dns (a sensible default) */ /* TODO: parse /etc/nsswitch ourselves and just remove ldap from the list */ +#ifdef HAVE___NSS_CONFIGURE_LOOKUP if (__nss_configure_lookup("hosts","files dns")) log_log(LOG_ERR,"unable to override hosts lookup method: %s",strerror(errno)); +#endif /* HAVE___NSS_CONFIGURE_LOOKUP */ + /* FIXME: have some other mechanism for systems that don't have this */ /* read configuration file */ cfg_init(NSS_LDAP_PATH_CONF); nslcd_cfg->ldc_debug=nslcd_debugging?nslcd_debugging-1:0; |