rpms/nss_ldap/devel nss_ldap-259-res_init.patch, NONE, 1.1 nss_ldap.spec, 1.94, 1.95
Nalin Somabhai Dahyabhai (nalin)
fedora-extras-commits at redhat.com
Wed Apr 16 15:13:48 UTC 2008
- Previous message (by thread): rpms/valgrind/devel valgrind-3.3.0-glibc28.patch, NONE, 1.1 valgrind-3.3.0-syscalls1.patch, NONE, 1.1 valgrind-3.3.0-syscalls2.patch, NONE, 1.1 valgrind.spec, 1.56, 1.57
- Next message (by thread): comps/po af.po,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: nalin
Update of /cvs/pkgs/rpms/nss_ldap/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27522
Modified Files:
nss_ldap.spec
Added Files:
nss_ldap-259-res_init.patch
Log Message:
Try to work around #442272 (gdm starts before resolv.conf is populated, and
without an explicit re-read, nss_ldap won't be able to resolve the directory
server's address even after it is populated) in a really horrible way.
nss_ldap-259-res_init.patch:
--- NEW FILE nss_ldap-259-res_init.patch ---
Workaround for a NetworkManager/Upstart combination making things
interesting. When an application starts before the network is up,
/etc/resolv.conf is empty, causing the application to attempt to use a
local resolver. When the network comes up later, /etc/resolv.conf gets
populated with nameserver addresses, but the application doesn't re-read
it. This screws nss_ldap later on, because the LDAP client library
needs to be able to resolve the directory server's address, but it can't
without a local resolver which is probably not started.
diff -up nss_ldap-259/configure.in nss_ldap-259/configure.in
--- nss_ldap-259/configure.in 2008-04-16 10:42:15.000000000 -0400
+++ nss_ldap-259/configure.in 2008-04-16 10:42:15.000000000 -0400
@@ -176,6 +176,7 @@ AC_CHECK_HEADERS(alignof.h)
AC_CHECK_HEADERS(rpc/rpcent.h)
AC_CHECK_HEADERS(sys/byteorder.h)
AC_CHECK_HEADERS(sys/un.h)
+AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(libc-lock.h)
AC_CHECK_HEADERS(bits/libc-lock.h)
AC_CHECK_HEADERS(sasl.h sasl/sasl.h)
diff -up nss_ldap-259/ldap-nss.c nss_ldap-259/ldap-nss.c
--- nss_ldap-259/ldap-nss.c 2008-04-16 10:42:15.000000000 -0400
+++ nss_ldap-259/ldap-nss.c 2008-04-16 10:48:02.000000000 -0400
@@ -44,10 +44,16 @@ static char rcsId[] =
#include <syslog.h>
#include <signal.h>
#include <fcntl.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <errno.h>
+#ifdef HAVE_RESOLV_H
+#include <resolv.h>
+#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
@@ -1021,8 +1027,31 @@ _nss_ldap_close (void)
do_close ();
}
+static void
+_nss_ldap_res_init (const char *uri)
+{
+ if (strncmp(uri, "ldapi://", 8) != 0)
+ {
+ struct stat st;
+ static time_t last_mtime = (time_t) -1;
+#if defined(HAVE_RESOLV_H) && defined(_PATH_RESCONF)
+ NSS_LDAP_DEFINE_LOCK (_nss_ldap_res_init_lock);
+ NSS_LDAP_LOCK (_nss_ldap_res_init_lock);
+ if (stat(_PATH_RESCONF, &st) == 0)
+ {
+ if (last_mtime != st.st_mtime)
+ {
+ last_mtime = st.st_mtime;
+ res_init();
+ }
+ }
+ NSS_LDAP_UNLOCK (_nss_ldap_res_init_lock);
+#endif
+ }
+}
+
static NSS_STATUS
-do_init_session (LDAP ** ld, const char *uri, int defport)
+do_init_session (LDAP ** ld, const char *uri, int defport, int res_init_hack)
{
int rc;
int ldaps;
@@ -1050,6 +1079,8 @@ do_init_session (LDAP ** ld, const char
uri = uribuf;
}
+ if (res_init_hack)
+ _nss_ldap_res_init(uri);
rc = ldap_initialize (ld, uri);
#else
if (strncasecmp (uri, "ldap://", sizeof ("ldap://") - 1) != 0)
@@ -1075,6 +1106,8 @@ do_init_session (LDAP ** ld, const char
defport = atoi (p + 1);
uri = uribuf;
}
+ if (res_init_hack)
+ _nss_ldap_res_init(NULL);
# ifdef HAVE_LDAP_INIT
*ld = ldap_init (uri, defport);
# else
@@ -1346,7 +1379,8 @@ do_init (void)
stat = do_init_session (&__session.ls_conn,
cfg->ldc_uris[__session.ls_current_uri],
- cfg->ldc_port);
+ cfg->ldc_port,
+ cfg->ldc_resolv_conf_res_init_hack);
if (stat != NSS_SUCCESS)
{
debug ("<== do_init (failed to initialize LDAP session)");
diff -up nss_ldap-259/ldap-nss.h nss_ldap-259/ldap-nss.h
--- nss_ldap-259/ldap-nss.h 2008-04-16 10:45:49.000000000 -0400
+++ nss_ldap-259/ldap-nss.h 2008-04-16 10:45:52.000000000 -0400
@@ -400,6 +400,9 @@ struct ldap_config
time_t ldc_mtime;
char **ldc_initgroups_ignoreusers;
+
+ /* disable the do-res_init()-on-resolv.conf-changes hack */
+ unsigned int ldc_resolv_conf_res_init_hack;
};
typedef struct ldap_config ldap_config_t;
diff -up nss_ldap-259/util.c nss_ldap-259/util.c
--- nss_ldap-259/util.c 2008-04-16 10:48:08.000000000 -0400
+++ nss_ldap-259/util.c 2008-04-16 10:50:14.000000000 -0400
@@ -680,6 +680,8 @@ NSS_STATUS _nss_ldap_init_config (ldap_c
}
}
+ result->ldc_resolv_conf_res_init_hack = 1;
+
return NSS_SUCCESS;
}
@@ -1204,6 +1206,19 @@ _nss_ldap_readconfig (ldap_config_t ** p
{
t = &result->ldc_srv_domain;
}
+ else if (!strcasecmp (k, "nss_resolv_conf_res_init_hack"))
+ {
+ if (!strcasecmp (v, "on") || !strcasecmp (v, "yes")
+ || !strcasecmp (v, "true"))
+ {
+ result->ldc_resolv_conf_res_init_hack = 1;
+ }
+ else if (!strcasecmp (v, "off") || !strcasecmp (v, "no")
+ || !strcasecmp (v, "false"))
+ {
+ result->ldc_resolv_conf_res_init_hack = 0;
+ }
+ }
else
{
/*
Index: nss_ldap.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nss_ldap/devel/nss_ldap.spec,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- nss_ldap.spec 15 Apr 2008 18:47:58 -0000 1.94
+++ nss_ldap.spec 16 Apr 2008 15:13:13 -0000 1.95
@@ -2,7 +2,7 @@
Summary: NSS library and PAM module for LDAP
Name: nss_ldap
Version: 259
-Release: 2%{?dist}
+Release: 3%{?dist}
Source0: ftp://ftp.padl.com/pub/nss_ldap-%{version}.tar.gz
Source1: ftp://ftp.padl.com/pub/pam_ldap-%{pam_ldap_version}.tar.gz
Source3: nss_ldap.versions
@@ -22,6 +22,7 @@
Patch13: pam_ldap-176-exop-modify.patch
Patch15: nss_ldap-257-mozldap.patch
Patch16: pam_ldap-184-referral-passwd2.patch
+Patch17: nss_ldap-259-res_init.patch
URL: http://www.padl.com/
License: LGPLv2+
@@ -61,6 +62,7 @@
pushd nss_ldap-%{version}
%patch2 -p1 -b .parse2
%patch8 -p1 -b .soname
+%patch17 -p1 -b .res_init
autoreconf -f -i
popd
@@ -186,6 +188,10 @@
%doc pam_ldap-%{pam_ldap_version}/ns-pwd-policy.schema
%changelog
+* Wed Apr 16 2008 Nalin Dahyabhai <nalin at redhat.com> - 259-3
+- try to work around not having had a populated resolver configuration earlier,
+ but needing to use its data when we're asked to look up something (#442272)
+
* Tue Apr 15 2008 Nalin Dahyabhai <nalin at redhat.com> - 259-2
- apply updated logic for finding libresolv to pam_ldap's build setup
- add gdm,polkituser to default nss_initgroups_ignoreusers list
- Previous message (by thread): rpms/valgrind/devel valgrind-3.3.0-glibc28.patch, NONE, 1.1 valgrind-3.3.0-syscalls1.patch, NONE, 1.1 valgrind-3.3.0-syscalls2.patch, NONE, 1.1 valgrind.spec, 1.56, 1.57
- Next message (by thread): comps/po af.po,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list