wok-next view nss_ldap/stuff/patches/nss_ldap-265-glibc-2.16.patch @ rev 20982

... and this one
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Sep 28 01:16:57 2018 +0300 (2018-09-28)
parents
children
line source
1 diff -u -r nss_ldap-265.orig/configure.in nss_ldap-265/configure.in
2 --- nss_ldap-265.orig/configure.in 2009-11-06 19:28:08.000000000 +0900
3 +++ nss_ldap-265/configure.in 2012-12-20 17:04:48.798942465 +0900
4 @@ -234,6 +234,7 @@
5 AC_CHECK_FUNCS(pthread_once)
6 AC_CHECK_FUNCS(ether_aton)
7 AC_CHECK_FUNCS(ether_ntoa)
8 +AC_CHECK_FUNCS(__libc_once __libc_atfork __libc_lock_lock __libc_lock_unlock)
10 AC_MSG_CHECKING(for struct ether_addr)
11 AC_TRY_COMPILE([#include <sys/types.h>
12 Only in nss_ldap-265: configure.in.orig
13 diff -u -r nss_ldap-265.orig/ldap-nss.c nss_ldap-265/ldap-nss.c
14 --- nss_ldap-265.orig/ldap-nss.c 2009-11-06 19:28:08.000000000 +0900
15 +++ nss_ldap-265/ldap-nss.c 2012-12-20 17:04:48.798942465 +0900
16 @@ -142,7 +142,7 @@
17 */
18 static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED };
20 -#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
21 +#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
22 static pthread_once_t __once = PTHREAD_ONCE_INIT;
23 #endif
25 @@ -150,7 +150,7 @@
26 static FILE *__debugfile;
27 #endif /* LBER_OPT_LOG_PRINT_FILE */
29 -#ifndef HAVE_PTHREAD_ATFORK
30 +#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE)
31 /*
32 * Process ID that opened the session.
33 */
34 @@ -162,7 +162,7 @@
35 static int __ssl_initialized = 0;
36 #endif /* HAVE_LDAPSSL_CLIENT_INIT */
38 -#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
39 +#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
40 /*
41 * Prepare for fork(); lock mutex.
42 */
43 @@ -513,7 +513,7 @@
44 }
45 #endif /* HAVE_NSSWITCH_H */
47 -#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
48 +#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE)
49 static void
50 do_atfork_prepare (void)
51 {
52 @@ -547,7 +547,7 @@
53 #ifdef HAVE_PTHREAD_ATFORK
54 (void) pthread_atfork (do_atfork_prepare, do_atfork_parent,
55 do_atfork_child);
56 -#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
57 +#elif defined(HAVE___LIBC_ATFORK)
58 (void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child);
59 #endif
61 @@ -1096,7 +1096,7 @@
62 do_init (void)
63 {
64 ldap_config_t *cfg;
65 -#ifndef HAVE_PTHREAD_ATFORK
66 +#if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE)
67 pid_t pid;
68 #endif
69 uid_t euid;
70 @@ -1113,7 +1113,7 @@
71 }
73 #ifndef HAVE_PTHREAD_ATFORK
74 -#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
75 +#if defined(HAVE___LIBC_ONCE)
76 /*
77 * This bogosity is necessary because Linux uses different
78 * PIDs for different threads (like IRIX, which we don't
79 @@ -1145,7 +1145,7 @@
80 pid = -1; /* linked against libpthreads, don't care */
81 #else
82 pid = getpid ();
83 -#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
84 +#endif /* HAVE___LIBC_ONCE */
85 #endif /* HAVE_PTHREAD_ATFORK */
87 euid = geteuid ();
88 @@ -1155,7 +1155,7 @@
89 syslog (LOG_DEBUG,
90 "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i",
91 __session.ls_state, __session.ls_conn, __euid, euid);
92 -#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
93 +#elif defined(HAVE___LIBC_ONCE)
94 syslog (LOG_DEBUG,
95 "nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
96 ((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"),
97 @@ -1179,11 +1179,11 @@
98 }
99 else
100 #ifndef HAVE_PTHREAD_ATFORK
101 -#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
102 +#if defined(HAVE___LIBC_ONCE)
103 if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid)
104 #else
105 if (__pid != pid)
106 -#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */
107 +#endif /* HAVE___LIBC_ONCE */
108 {
109 do_close_no_unbind ();
110 }
111 @@ -1244,9 +1244,9 @@
112 debug ("<== do_init (pthread_once failed)");
113 return NSS_UNAVAIL;
114 }
115 -#elif defined(HAVE_PTHREAD_ATFORK) && ( defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) )
116 +#elif defined(HAVE_PTHREAD_ATFORK) && defined(HAVE___LIBC_ONCE)
117 __libc_once (__once, do_atfork_setup);
118 -#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
119 +#elif defined(HAVE___LIBC_ONCE)
120 /*
121 * Only install the pthread_atfork() handlers i
122 * we are linked against libpthreads. Otherwise,
123 Only in nss_ldap-265: ldap-nss.c.orig
124 diff -u -r nss_ldap-265.orig/ldap-nss.h nss_ldap-265/ldap-nss.h
125 --- nss_ldap-265.orig/ldap-nss.h 2009-11-06 19:28:08.000000000 +0900
126 +++ nss_ldap-265/ldap-nss.h 2012-12-20 17:04:48.798942465 +0900
127 @@ -670,7 +670,7 @@
128 #define NSS_LDAP_LOCK(m) mutex_lock(&m)
129 #define NSS_LDAP_UNLOCK(m) mutex_unlock(&m)
130 #define NSS_LDAP_DEFINE_LOCK(m) static mutex_t m = DEFAULTMUTEX
131 -#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
132 +#elif defined(HAVE___LIBC_LOCK_LOCK) && defined(HAVE___LIBC_LOCK_UNLOCK)
133 #define NSS_LDAP_LOCK(m) __libc_lock_lock(m)
134 #define NSS_LDAP_UNLOCK(m) __libc_lock_unlock(m)
135 #define NSS_LDAP_DEFINE_LOCK(m) static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER
136 Only in nss_ldap-265: ldap-nss.h.orig