@@ -43,6 +43,10 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
43
43
double doubleval ;
44
44
char * strval ;
45
45
struct timeval tv ;
46
+ #if HAVE_SASL
47
+ /* unsigned long */
48
+ ber_len_t blen ;
49
+ #endif
46
50
void * ptr ;
47
51
LDAP * ld ;
48
52
LDAPControl * * controls = NULL ;
@@ -92,10 +96,6 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
92
96
case LDAP_OPT_X_TLS_REQUIRE_SAN :
93
97
#endif
94
98
#endif
95
- #ifdef HAVE_SASL
96
- case LDAP_OPT_X_SASL_SSF_MIN :
97
- case LDAP_OPT_X_SASL_SSF_MAX :
98
- #endif
99
99
#ifdef LDAP_OPT_X_KEEPALIVE_IDLE
100
100
case LDAP_OPT_X_KEEPALIVE_IDLE :
101
101
#endif
@@ -111,6 +111,16 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
111
111
return 0 ;
112
112
ptr = & intval ;
113
113
break ;
114
+
115
+ #ifdef HAVE_SASL
116
+ case LDAP_OPT_X_SASL_SSF_MIN :
117
+ case LDAP_OPT_X_SASL_SSF_MAX :
118
+ if (!PyArg_Parse (value , "k:set_option" , & blen ))
119
+ return 0 ;
120
+ ptr = & blen ;
121
+ break ;
122
+ #endif
123
+
114
124
case LDAP_OPT_HOST_NAME :
115
125
case LDAP_OPT_URI :
116
126
#ifdef LDAP_OPT_DEFBASE
@@ -138,6 +148,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
138
148
return 0 ;
139
149
ptr = strval ;
140
150
break ;
151
+
141
152
case LDAP_OPT_TIMEOUT :
142
153
case LDAP_OPT_NETWORK_TIMEOUT :
143
154
/* Float valued timeval options */
@@ -242,6 +253,10 @@ LDAP_get_option(LDAPObject *self, int option)
242
253
LDAPAPIInfo apiinfo ;
243
254
LDAPControl * * lcs ;
244
255
char * strval ;
256
+ #if HAVE_SASL
257
+ /* unsigned long */
258
+ ber_len_t blen ;
259
+ #endif
245
260
PyObject * extensions , * v ;
246
261
Py_ssize_t i , num_extensions ;
247
262
@@ -280,9 +295,6 @@ LDAP_get_option(LDAPObject *self, int option)
280
295
281
296
return v ;
282
297
283
- #ifdef HAVE_SASL
284
- case LDAP_OPT_X_SASL_SSF :
285
- #endif
286
298
case LDAP_OPT_REFERRALS :
287
299
case LDAP_OPT_RESTART :
288
300
case LDAP_OPT_DEREF :
@@ -305,10 +317,6 @@ LDAP_get_option(LDAPObject *self, int option)
305
317
case LDAP_OPT_X_TLS_REQUIRE_SAN :
306
318
#endif
307
319
#endif
308
- #ifdef HAVE_SASL
309
- case LDAP_OPT_X_SASL_SSF_MIN :
310
- case LDAP_OPT_X_SASL_SSF_MAX :
311
- #endif
312
320
#ifdef LDAP_OPT_X_SASL_NOCANON
313
321
case LDAP_OPT_X_SASL_NOCANON :
314
322
#endif
@@ -330,6 +338,17 @@ LDAP_get_option(LDAPObject *self, int option)
330
338
return option_error (res , "ldap_get_option" );
331
339
return PyInt_FromLong (intval );
332
340
341
+ #ifdef HAVE_SASL
342
+ case LDAP_OPT_X_SASL_SSF :
343
+ case LDAP_OPT_X_SASL_SSF_MIN :
344
+ case LDAP_OPT_X_SASL_SSF_MAX :
345
+ /* ber_len_t options (unsigned long)*/
346
+ res = LDAP_int_get_option (self , option , & blen );
347
+ if (res != LDAP_OPT_SUCCESS )
348
+ return option_error (res , "ldap_get_option" );
349
+ return PyLong_FromUnsignedLong (blen );
350
+ #endif
351
+
333
352
case LDAP_OPT_HOST_NAME :
334
353
case LDAP_OPT_URI :
335
354
#ifdef LDAP_OPT_DEFBASE
0 commit comments