source:
npl/system/nss_ldap/patches/glibc-2.16.patch
Last change on this file was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 5.1 KB |
-
ldap-nss.c
Description: Handle removal of __libc_lock_lock and similar symbols from libc Bug: http://bugzilla.padl.com/show_bug.cgi?id=445 Bug-Debian: http://bugs.debian.org/727177 Bug-Arch-Linux-ARM: https://github.com/archlinuxarm/PKGBUILDs/issues/296 Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=438692 Author: Dennis Schridde <devurandom@gmx.net>
a b static void (*__sigpipe_handler) (int) = 142 142 */ 143 143 static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED }; 144 144 145 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)145 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) 146 146 static pthread_once_t __once = PTHREAD_ONCE_INIT; 147 147 #endif 148 148 … … static pthread_once_t __once = PTHREAD_O 150 150 static FILE *__debugfile; 151 151 #endif /* LBER_OPT_LOG_PRINT_FILE */ 152 152 153 #if ndef HAVE_PTHREAD_ATFORK153 #if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE) 154 154 /* 155 155 * Process ID that opened the session. 156 156 */ … … static uid_t __euid = -1; 162 162 static int __ssl_initialized = 0; 163 163 #endif /* HAVE_LDAPSSL_CLIENT_INIT */ 164 164 165 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)165 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) 166 166 /* 167 167 * Prepare for fork(); lock mutex. 168 168 */ … … _nss_ldap_default_constr (nss_ldap_backe 514 514 } 515 515 #endif /* HAVE_NSSWITCH_H */ 516 516 517 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)517 #if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) 518 518 static void 519 519 do_atfork_prepare (void) 520 520 { … … do_atfork_setup (void) 548 548 #ifdef HAVE_PTHREAD_ATFORK 549 549 (void) pthread_atfork (do_atfork_prepare, do_atfork_parent, 550 550 do_atfork_child); 551 #elif defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)551 #elif defined(HAVE___LIBC_ATFORK) 552 552 (void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child); 553 553 #endif 554 554 … … static NSS_STATUS 1111 1111 do_init (void) 1112 1112 { 1113 1113 ldap_config_t *cfg; 1114 #if ndef HAVE_PTHREAD_ATFORK1114 #if !defined(HAVE_PTHREAD_ATFORK) || !defined(HAVE___LIBC_ONCE) 1115 1115 pid_t pid; 1116 1116 #endif 1117 1117 uid_t euid; … … do_init (void) 1128 1128 } 1129 1129 1130 1130 #ifndef HAVE_PTHREAD_ATFORK 1131 #if defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)1131 #if defined(HAVE___LIBC_ONCE) 1132 1132 /* 1133 1133 * This bogosity is necessary because Linux uses different 1134 1134 * PIDs for different threads (like IRIX, which we don't … … do_init (void) 1160 1160 pid = -1; /* linked against libpthreads, don't care */ 1161 1161 #else 1162 1162 pid = getpid (); 1163 #endif /* HAVE_ LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H*/1163 #endif /* HAVE___LIBC_ONCE */ 1164 1164 #endif /* HAVE_PTHREAD_ATFORK */ 1165 1165 1166 1166 euid = geteuid (); … … do_init (void) 1170 1170 syslog (LOG_AUTHPRIV | LOG_DEBUG, 1171 1171 "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i", 1172 1172 __session.ls_state, __session.ls_conn, __euid, euid); 1173 #elif defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)1173 #elif defined(HAVE___LIBC_ONCE) 1174 1174 syslog (LOG_AUTHPRIV | LOG_DEBUG, 1175 1175 "nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", 1176 1176 ((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"), … … do_init (void) 1194 1194 } 1195 1195 else 1196 1196 #ifndef HAVE_PTHREAD_ATFORK 1197 #if defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)1197 #if defined(HAVE___LIBC_ONCE) 1198 1198 if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid) 1199 1199 #else 1200 1200 if (__pid != pid) 1201 #endif /* HAVE_ LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H*/1201 #endif /* HAVE___LIBC_ONCE */ 1202 1202 { 1203 1203 do_close_no_unbind (); 1204 1204 } … … do_init (void) 1259 1259 debug ("<== do_init (pthread_once failed)"); 1260 1260 return NSS_UNAVAIL; 1261 1261 } 1262 #elif defined(HAVE_PTHREAD_ATFORK) && ( defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H))1262 #elif defined(HAVE_PTHREAD_ATFORK) && defined(HAVE___LIBC_ONCE) 1263 1263 __libc_once (__once, do_atfork_setup); 1264 #elif defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)1264 #elif defined(HAVE___LIBC_ONCE) 1265 1265 /* 1266 1266 * Only install the pthread_atfork() handlers i 1267 1267 * we are linked against libpthreads. Otherwise, -
ldap-nss.h
a b extern int __multi_threaded; 670 670 #define NSS_LDAP_LOCK(m) mutex_lock(&m) 671 671 #define NSS_LDAP_UNLOCK(m) mutex_unlock(&m) 672 672 #define NSS_LDAP_DEFINE_LOCK(m) static mutex_t m = DEFAULTMUTEX 673 #elif defined(HAVE_ LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)673 #elif defined(HAVE___LIBC_LOCK_LOCK) && defined(HAVE___LIBC_LOCK_UNLOCK) 674 674 #define NSS_LDAP_LOCK(m) __libc_lock_lock(m) 675 675 #define NSS_LDAP_UNLOCK(m) __libc_lock_unlock(m) 676 676 #define NSS_LDAP_DEFINE_LOCK(m) static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER -
configure.in
a b AC_CHECK_FUNCS(pthread_atfork) 234 234 AC_CHECK_FUNCS(pthread_once) 235 235 AC_CHECK_FUNCS(ether_aton) 236 236 AC_CHECK_FUNCS(ether_ntoa) 237 AC_CHECK_FUNCS(__libc_once __libc_atfork __libc_lock_lock __libc_lock_unlock) 237 238 238 239 AC_MSG_CHECKING(for struct ether_addr) 239 240 AC_TRY_COMPILE([#include <sys/types.h>
Note: See TracBrowser
for help on using the repository browser.