Lines 148-154
Link Here
|
148 |
*/ |
148 |
*/ |
149 |
static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED }; |
149 |
static ldap_session_t __session = { NULL, NULL, 0, LS_UNINITIALIZED }; |
150 |
|
150 |
|
151 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
151 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
152 |
static pthread_once_t __once = PTHREAD_ONCE_INIT; |
152 |
static pthread_once_t __once = PTHREAD_ONCE_INIT; |
153 |
#endif |
153 |
#endif |
154 |
|
154 |
|
Lines 168-174
Link Here
|
168 |
static int __ssl_initialized = 0; |
168 |
static int __ssl_initialized = 0; |
169 |
#endif /* HAVE_LDAPSSL_CLIENT_INIT */ |
169 |
#endif /* HAVE_LDAPSSL_CLIENT_INIT */ |
170 |
|
170 |
|
171 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
171 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
172 |
/* |
172 |
/* |
173 |
* Prepare for fork(); lock mutex. |
173 |
* Prepare for fork(); lock mutex. |
174 |
*/ |
174 |
*/ |
Lines 519-525
Link Here
|
519 |
} |
519 |
} |
520 |
#endif /* HAVE_NSSWITCH_H */ |
520 |
#endif /* HAVE_NSSWITCH_H */ |
521 |
|
521 |
|
522 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
522 |
#if defined(HAVE_PTHREAD_ATFORK) || defined(HAVE___LIBC_ONCE) |
523 |
static void |
523 |
static void |
524 |
do_atfork_prepare (void) |
524 |
do_atfork_prepare (void) |
525 |
{ |
525 |
{ |
Lines 553-559
Link Here
|
553 |
#ifdef HAVE_PTHREAD_ATFORK |
553 |
#ifdef HAVE_PTHREAD_ATFORK |
554 |
(void) pthread_atfork (do_atfork_prepare, do_atfork_parent, |
554 |
(void) pthread_atfork (do_atfork_prepare, do_atfork_parent, |
555 |
do_atfork_child); |
555 |
do_atfork_child); |
556 |
#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
556 |
#elif defined(HAVE___LIBC_ATFORK) |
557 |
(void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child); |
557 |
(void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child); |
558 |
#endif |
558 |
#endif |
559 |
|
559 |
|
Lines 1119-1125
Link Here
|
1119 |
} |
1119 |
} |
1120 |
|
1120 |
|
1121 |
#ifndef HAVE_PTHREAD_ATFORK |
1121 |
#ifndef HAVE_PTHREAD_ATFORK |
1122 |
#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
1122 |
#if defined(HAVE___LIBC_ONCE) |
1123 |
/* |
1123 |
/* |
1124 |
* This bogosity is necessary because Linux uses different |
1124 |
* This bogosity is necessary because Linux uses different |
1125 |
* PIDs for different threads (like IRIX, which we don't |
1125 |
* PIDs for different threads (like IRIX, which we don't |
Lines 1151-1157
Link Here
|
1151 |
pid = -1; /* linked against libpthreads, don't care */ |
1151 |
pid = -1; /* linked against libpthreads, don't care */ |
1152 |
#else |
1152 |
#else |
1153 |
pid = getpid (); |
1153 |
pid = getpid (); |
1154 |
#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */ |
1154 |
#endif /* HAVE___LIBC_ONCE */ |
1155 |
#endif /* HAVE_PTHREAD_ATFORK */ |
1155 |
#endif /* HAVE_PTHREAD_ATFORK */ |
1156 |
|
1156 |
|
1157 |
euid = geteuid (); |
1157 |
euid = geteuid (); |
Lines 1161-1167
Link Here
|
1161 |
syslog (LOG_DEBUG, |
1161 |
syslog (LOG_DEBUG, |
1162 |
"nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i", |
1162 |
"nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i", |
1163 |
__session.ls_state, __session.ls_conn, __euid, euid); |
1163 |
__session.ls_state, __session.ls_conn, __euid, euid); |
1164 |
#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
1164 |
#elif defined(HAVE___LIBC_ONCE) |
1165 |
syslog (LOG_DEBUG, |
1165 |
syslog (LOG_DEBUG, |
1166 |
"nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", |
1166 |
"nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", |
1167 |
((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"), |
1167 |
((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"), |
Lines 1185-1195
Link Here
|
1185 |
} |
1185 |
} |
1186 |
else |
1186 |
else |
1187 |
#ifndef HAVE_PTHREAD_ATFORK |
1187 |
#ifndef HAVE_PTHREAD_ATFORK |
1188 |
#if defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
1188 |
#if defined(HAVE___LIBC_ONCE) |
1189 |
if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid) |
1189 |
if ((__pthread_once == NULL || __pthread_atfork == NULL) && __pid != pid) |
1190 |
#else |
1190 |
#else |
1191 |
if (__pid != pid) |
1191 |
if (__pid != pid) |
1192 |
#endif /* HAVE_LIBC_LOCK_H || HAVE_BITS_LIBC_LOCK_H */ |
1192 |
#endif /* HAVE___LIBC_ONCE */ |
1193 |
{ |
1193 |
{ |
1194 |
do_close_no_unbind (); |
1194 |
do_close_no_unbind (); |
1195 |
} |
1195 |
} |
Lines 1250-1258
Link Here
|
1250 |
debug ("<== do_init (pthread_once failed)"); |
1250 |
debug ("<== do_init (pthread_once failed)"); |
1251 |
return NSS_UNAVAIL; |
1251 |
return NSS_UNAVAIL; |
1252 |
} |
1252 |
} |
1253 |
#elif defined(HAVE_PTHREAD_ATFORK) && ( defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) ) |
1253 |
#elif defined(HAVE_PTHREAD_ATFORK) && defined(HAVE___LIBC_ONCE) |
1254 |
__libc_once (__once, do_atfork_setup); |
1254 |
__libc_once (__once, do_atfork_setup); |
1255 |
#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) |
1255 |
#elif defined(HAVE___LIBC_ONCE) |
1256 |
/* |
1256 |
/* |
1257 |
* Only install the pthread_atfork() handlers i |
1257 |
* Only install the pthread_atfork() handlers i |
1258 |
* we are linked against libpthreads. Otherwise, |
1258 |
* we are linked against libpthreads. Otherwise, |