@@ -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 ;
@@ -89,10 +93,6 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
89
93
case LDAP_OPT_X_TLS_PROTOCOL_MIN :
90
94
#endif
91
95
#endif
92
- #ifdef HAVE_SASL
93
- case LDAP_OPT_X_SASL_SSF_MIN :
94
- case LDAP_OPT_X_SASL_SSF_MAX :
95
- #endif
96
96
#ifdef LDAP_OPT_X_KEEPALIVE_IDLE
97
97
case LDAP_OPT_X_KEEPALIVE_IDLE :
98
98
#endif
@@ -108,6 +108,16 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
108
108
return 0 ;
109
109
ptr = & intval ;
110
110
break ;
111
+
112
+ #ifdef HAVE_SASL
113
+ case LDAP_OPT_X_SASL_SSF_MIN :
114
+ case LDAP_OPT_X_SASL_SSF_MAX :
115
+ if (!PyArg_Parse (value , "k:set_option" , & blen ))
116
+ return 0 ;
117
+ ptr = & blen ;
118
+ break ;
119
+ #endif
120
+
111
121
case LDAP_OPT_HOST_NAME :
112
122
case LDAP_OPT_URI :
113
123
#ifdef LDAP_OPT_DEFBASE
@@ -135,6 +145,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
135
145
return 0 ;
136
146
ptr = strval ;
137
147
break ;
148
+
138
149
case LDAP_OPT_TIMEOUT :
139
150
case LDAP_OPT_NETWORK_TIMEOUT :
140
151
/* Float valued timeval options */
@@ -239,6 +250,10 @@ LDAP_get_option(LDAPObject *self, int option)
239
250
LDAPAPIInfo apiinfo ;
240
251
LDAPControl * * lcs ;
241
252
char * strval ;
253
+ #if HAVE_SASL
254
+ /* unsigned long */
255
+ ber_len_t blen ;
256
+ #endif
242
257
PyObject * extensions , * v ;
243
258
Py_ssize_t i , num_extensions ;
244
259
@@ -277,9 +292,6 @@ LDAP_get_option(LDAPObject *self, int option)
277
292
278
293
return v ;
279
294
280
- #ifdef HAVE_SASL
281
- case LDAP_OPT_X_SASL_SSF :
282
- #endif
283
295
case LDAP_OPT_REFERRALS :
284
296
case LDAP_OPT_RESTART :
285
297
case LDAP_OPT_DEREF :
@@ -299,10 +311,6 @@ LDAP_get_option(LDAPObject *self, int option)
299
311
case LDAP_OPT_X_TLS_PROTOCOL_MIN :
300
312
#endif
301
313
#endif
302
- #ifdef HAVE_SASL
303
- case LDAP_OPT_X_SASL_SSF_MIN :
304
- case LDAP_OPT_X_SASL_SSF_MAX :
305
- #endif
306
314
#ifdef LDAP_OPT_X_SASL_NOCANON
307
315
case LDAP_OPT_X_SASL_NOCANON :
308
316
#endif
@@ -324,6 +332,17 @@ LDAP_get_option(LDAPObject *self, int option)
324
332
return option_error (res , "ldap_get_option" );
325
333
return PyInt_FromLong (intval );
326
334
335
+ #ifdef HAVE_SASL
336
+ case LDAP_OPT_X_SASL_SSF :
337
+ case LDAP_OPT_X_SASL_SSF_MIN :
338
+ case LDAP_OPT_X_SASL_SSF_MAX :
339
+ /* ber_len_t options (unsigned long)*/
340
+ res = LDAP_int_get_option (self , option , & blen );
341
+ if (res != LDAP_OPT_SUCCESS )
342
+ return option_error (res , "ldap_get_option" );
343
+ return PyLong_FromUnsignedLong (blen );
344
+ #endif
345
+
327
346
case LDAP_OPT_HOST_NAME :
328
347
case LDAP_OPT_URI :
329
348
#ifdef LDAP_OPT_DEFBASE
0 commit comments