@@ -41,6 +41,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
41
41
{
42
42
int res ;
43
43
int intval ;
44
+ unsigned int uintval ;
44
45
double doubleval ;
45
46
char * strval ;
46
47
struct timeval tv ;
@@ -57,6 +58,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
57
58
switch (option ) {
58
59
case LDAP_OPT_API_INFO :
59
60
case LDAP_OPT_API_FEATURE_INFO :
61
+ case LDAP_OPT_DESC :
60
62
#ifdef HAVE_SASL
61
63
case LDAP_OPT_X_SASL_SSF :
62
64
#endif
@@ -116,10 +118,19 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
116
118
ptr = & intval ;
117
119
break ;
118
120
121
+ #ifdef LDAP_OPT_TCP_USER_TIMEOUT
122
+ case LDAP_OPT_TCP_USER_TIMEOUT :
123
+ #endif
124
+ if (!PyArg_Parse (value , "I:set_option" , & uintval ))
125
+ return 0 ;
126
+ ptr = & uintval ;
127
+ break ;
128
+
119
129
#ifdef HAVE_SASL
120
130
case LDAP_OPT_X_SASL_SSF_MIN :
121
131
case LDAP_OPT_X_SASL_SSF_MAX :
122
132
case LDAP_OPT_X_SASL_SSF_EXTERNAL :
133
+ case LDAP_OPT_X_SASL_MAXBUFSIZE :
123
134
if (!PyArg_Parse (value , "k:set_option" , & blen ))
124
135
return 0 ;
125
136
ptr = & blen ;
@@ -144,9 +155,15 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
144
155
#ifdef LDAP_OPT_X_TLS_CRLFILE
145
156
case LDAP_OPT_X_TLS_CRLFILE :
146
157
#endif
158
+ #ifdef LDAP_OPT_X_TLS_ECNAME
159
+ case LDAP_OPT_X_TLS_ECNAME :
160
+ #endif
147
161
#endif
148
162
#ifdef HAVE_SASL
149
163
case LDAP_OPT_X_SASL_SECPROPS :
164
+ #endif
165
+ #ifdef LDAP_OPT_SOCKET_BIND_ADDRESSES
166
+ case LDAP_OPT_SOCKET_BIND_ADDRESSES :
150
167
#endif
151
168
/* String valued options */
152
169
if (!PyArg_Parse (value , "s:set_option" , & strval ))
@@ -187,8 +204,8 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
187
204
}
188
205
else {
189
206
PyErr_Format (PyExc_ValueError ,
190
- "timeout must be >= 0 or -1/None for infinity, got %d " ,
191
- option );
207
+ "timeout must be >= 0 or -1/None for infinity, got %f " ,
208
+ doubleval );
192
209
return 0 ;
193
210
}
194
211
break ;
@@ -254,6 +271,7 @@ LDAP_get_option(LDAPObject *self, int option)
254
271
{
255
272
int res ;
256
273
int intval ;
274
+ unsigned int uintval ;
257
275
struct timeval * tv ;
258
276
LDAPAPIInfo apiinfo ;
259
277
LDAPControl * * lcs ;
@@ -268,6 +286,7 @@ LDAP_get_option(LDAPObject *self, int option)
268
286
269
287
switch (option ) {
270
288
#ifdef HAVE_SASL
289
+ case LDAP_OPT_X_SASL_SECPROPS :
271
290
case LDAP_OPT_X_SASL_SSF_EXTERNAL :
272
291
/* Write-only options */
273
292
PyErr_SetString (PyExc_ValueError , "write-only option" );
@@ -350,10 +369,20 @@ LDAP_get_option(LDAPObject *self, int option)
350
369
return option_error (res , "ldap_get_option" );
351
370
return PyInt_FromLong (intval );
352
371
372
+ #ifdef LDAP_OPT_TCP_USER_TIMEOUT
373
+ case LDAP_OPT_TCP_USER_TIMEOUT :
374
+ #endif
375
+ /* unsigned int options */
376
+ res = LDAP_int_get_option (self , option , & uintval );
377
+ if (res != LDAP_OPT_SUCCESS )
378
+ return option_error (res , "ldap_get_option" );
379
+ return PyLong_FromUnsignedLong (uintval );
380
+
353
381
#ifdef HAVE_SASL
354
382
case LDAP_OPT_X_SASL_SSF :
355
383
case LDAP_OPT_X_SASL_SSF_MIN :
356
384
case LDAP_OPT_X_SASL_SSF_MAX :
385
+ case LDAP_OPT_X_SASL_MAXBUFSIZE :
357
386
/* ber_len_t options (unsigned long)*/
358
387
res = LDAP_int_get_option (self , option , & blen );
359
388
if (res != LDAP_OPT_SUCCESS )
@@ -388,16 +417,21 @@ LDAP_get_option(LDAPObject *self, int option)
388
417
#ifdef LDAP_OPT_X_TLS_PACKAGE
389
418
case LDAP_OPT_X_TLS_PACKAGE :
390
419
#endif
420
+ #ifdef LDAP_OPT_X_TLS_ECNAME
421
+ case LDAP_OPT_X_TLS_ECNAME :
422
+ #endif
391
423
#endif
392
424
#ifdef HAVE_SASL
393
- case LDAP_OPT_X_SASL_SECPROPS :
394
425
case LDAP_OPT_X_SASL_MECH :
395
426
case LDAP_OPT_X_SASL_REALM :
396
427
case LDAP_OPT_X_SASL_AUTHCID :
397
428
case LDAP_OPT_X_SASL_AUTHZID :
398
429
#ifdef LDAP_OPT_X_SASL_USERNAME
399
430
case LDAP_OPT_X_SASL_USERNAME :
400
431
#endif
432
+ #endif
433
+ #ifdef LDAP_OPT_SOCKET_BIND_ADDRESSES
434
+ case LDAP_OPT_SOCKET_BIND_ADDRESSES :
401
435
#endif
402
436
/* String-valued options */
403
437
res = LDAP_int_get_option (self , option , & strval );
0 commit comments