File tree Expand file tree Collapse file tree 4 files changed +14
-5
lines changed
Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -341,9 +341,7 @@ class Str(Constant):
341341 # XXX - these should be errors
342342 Int ('URL_ERR_BADSCOPE' ),
343343 Int ('URL_ERR_MEM' ),
344- # Int('LIBLDAP_R'),
345344
346- Feature ('LIBLDAP_R' , 'HAVE_LIBLDAP_R' ),
347345 Feature ('SASL_AVAIL' , 'HAVE_SASL' ),
348346 Feature ('TLS_AVAIL' , 'HAVE_TLS' ),
349347 Feature ('INIT_FD_AVAIL' , 'HAVE_LDAP_INIT_FD' ),
Original file line number Diff line number Diff line change 197197LDAPinit_constants (PyObject * m )
198198{
199199 PyObject * exc , * nobj ;
200+ struct ldap_apifeature_info info = { 1 , "X_OPENLDAP_THREAD_SAFE" , 0 };
201+ int thread_safe = 0 ;
200202
201203 /* simple constants */
202204
@@ -221,6 +223,14 @@ LDAPinit_constants(PyObject *m)
221223 return -1 ;
222224 Py_INCREF (LDAPexception_class );
223225
226+ #ifdef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
227+ if (ldap_get_option (NULL , LDAP_OPT_API_FEATURE_INFO , & info ) == LDAP_SUCCESS ) {
228+ thread_safe = (info .ldapaif_version == 1 );
229+ }
230+ #endif
231+ if (PyModule_AddIntConstant (m , "LIBLDAP_R" , thread_safe ) != 0 )
232+ return -1 ;
233+
224234 /* Generated constants -- see Lib/ldap/constants.py */
225235
226236#define add_err (n ) do { \
Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ defines = HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
2121extra_compile_args =
2222extra_objects =
2323
24+ # Uncomment this if your libldap is not thread-safe and you need libldap_r
25+ # instead
2426# Example for full-featured build:
2527# Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r.
26- libs = ldap_r lber
28+ # libs = ldap_r lber
2729
2830# Installation options
2931[install]
@@ -33,7 +35,7 @@ optimize = 1
3335# Linux distributors/packagers should adjust these settings
3436[bdist_rpm]
3537provides = python-ldap
36- requires = python libldap-2_4
38+ requires = python libldap-2
3739vendor = python-ldap project
3840packager = python-ldap team
3941distribution_name = openSUSE 11.x
Original file line number Diff line number Diff line change @@ -132,7 +132,6 @@ class OpenLDAP2:
132132 extra_objects = LDAP_CLASS .extra_objects ,
133133 runtime_library_dirs = (not sys .platform .startswith ("win" ))* LDAP_CLASS .library_dirs ,
134134 define_macros = LDAP_CLASS .defines + \
135- ('ldap_r' in LDAP_CLASS .libs or 'oldap_r' in LDAP_CLASS .libs )* [('HAVE_LIBLDAP_R' ,None )] + \
136135 ('sasl' in LDAP_CLASS .libs or 'sasl2' in LDAP_CLASS .libs or 'libsasl' in LDAP_CLASS .libs )* [('HAVE_SASL' ,None )] + \
137136 ('ssl' in LDAP_CLASS .libs and 'crypto' in LDAP_CLASS .libs )* [('HAVE_TLS' ,None )] + \
138137 [
You can’t perform that action at this time.
0 commit comments