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):
341
341
# XXX - these should be errors
342
342
Int ('URL_ERR_BADSCOPE' ),
343
343
Int ('URL_ERR_MEM' ),
344
- # Int('LIBLDAP_R'),
345
344
346
- Feature ('LIBLDAP_R' , 'HAVE_LIBLDAP_R' ),
347
345
Feature ('SASL_AVAIL' , 'HAVE_SASL' ),
348
346
Feature ('TLS_AVAIL' , 'HAVE_TLS' ),
349
347
Feature ('INIT_FD_AVAIL' , 'HAVE_LDAP_INIT_FD' ),
Original file line number Diff line number Diff line change 197
197
LDAPinit_constants (PyObject * m )
198
198
{
199
199
PyObject * exc , * nobj ;
200
+ struct ldap_apifeature_info info = { 1 , "X_OPENLDAP_THREAD_SAFE" , 0 };
201
+ int thread_safe = 0 ;
200
202
201
203
/* simple constants */
202
204
@@ -221,6 +223,14 @@ LDAPinit_constants(PyObject *m)
221
223
return -1 ;
222
224
Py_INCREF (LDAPexception_class );
223
225
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
+
224
234
/* Generated constants -- see Lib/ldap/constants.py */
225
235
226
236
#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
21
21
extra_compile_args =
22
22
extra_objects =
23
23
24
+ # Uncomment this if your libldap is not thread-safe and you need libldap_r
25
+ # instead
24
26
# Example for full-featured build:
25
27
# Support for StartTLS/LDAPS, SASL bind and reentrant libldap_r.
26
- libs = ldap_r lber
28
+ # libs = ldap_r lber
27
29
28
30
# Installation options
29
31
[install]
@@ -33,7 +35,7 @@ optimize = 1
33
35
# Linux distributors/packagers should adjust these settings
34
36
[bdist_rpm]
35
37
provides = python-ldap
36
- requires = python libldap-2_4
38
+ requires = python libldap-2
37
39
vendor = python-ldap project
38
40
packager = python-ldap team
39
41
distribution_name = openSUSE 11.x
Original file line number Diff line number Diff line change @@ -132,7 +132,6 @@ class OpenLDAP2:
132
132
extra_objects = LDAP_CLASS .extra_objects ,
133
133
runtime_library_dirs = (not sys .platform .startswith ("win" ))* LDAP_CLASS .library_dirs ,
134
134
define_macros = LDAP_CLASS .defines + \
135
- ('ldap_r' in LDAP_CLASS .libs or 'oldap_r' in LDAP_CLASS .libs )* [('HAVE_LIBLDAP_R' ,None )] + \
136
135
('sasl' in LDAP_CLASS .libs or 'sasl2' in LDAP_CLASS .libs or 'libsasl' in LDAP_CLASS .libs )* [('HAVE_SASL' ,None )] + \
137
136
('ssl' in LDAP_CLASS .libs and 'crypto' in LDAP_CLASS .libs )* [('HAVE_TLS' ,None )] + \
138
137
[
You can’t perform that action at this time.
0 commit comments