@@ -41,6 +41,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
4141{
4242 int res ;
4343 int intval ;
44+ unsigned int uintval ;
4445 double doubleval ;
4546 char * strval ;
4647 struct timeval tv ;
@@ -57,6 +58,7 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
5758 switch (option ) {
5859 case LDAP_OPT_API_INFO :
5960 case LDAP_OPT_API_FEATURE_INFO :
61+ case LDAP_OPT_DESC :
6062#ifdef HAVE_SASL
6163 case LDAP_OPT_X_SASL_SSF :
6264#endif
@@ -116,10 +118,19 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
116118 ptr = & intval ;
117119 break ;
118120
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+
119129#ifdef HAVE_SASL
120130 case LDAP_OPT_X_SASL_SSF_MIN :
121131 case LDAP_OPT_X_SASL_SSF_MAX :
122132 case LDAP_OPT_X_SASL_SSF_EXTERNAL :
133+ case LDAP_OPT_X_SASL_MAXBUFSIZE :
123134 if (!PyArg_Parse (value , "k:set_option" , & blen ))
124135 return 0 ;
125136 ptr = & blen ;
@@ -144,9 +155,15 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
144155#ifdef LDAP_OPT_X_TLS_CRLFILE
145156 case LDAP_OPT_X_TLS_CRLFILE :
146157#endif
158+ #ifdef LDAP_OPT_X_TLS_ECNAME
159+ case LDAP_OPT_X_TLS_ECNAME :
160+ #endif
147161#endif
148162#ifdef HAVE_SASL
149163 case LDAP_OPT_X_SASL_SECPROPS :
164+ #endif
165+ #ifdef LDAP_OPT_SOCKET_BIND_ADDRESSES
166+ case LDAP_OPT_SOCKET_BIND_ADDRESSES :
150167#endif
151168 /* String valued options */
152169 if (!PyArg_Parse (value , "s:set_option" , & strval ))
@@ -187,8 +204,8 @@ LDAP_set_option(LDAPObject *self, int option, PyObject *value)
187204 }
188205 else {
189206 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 );
192209 return 0 ;
193210 }
194211 break ;
@@ -254,6 +271,7 @@ LDAP_get_option(LDAPObject *self, int option)
254271{
255272 int res ;
256273 int intval ;
274+ unsigned int uintval ;
257275 struct timeval * tv ;
258276 LDAPAPIInfo apiinfo ;
259277 LDAPControl * * lcs ;
@@ -268,6 +286,7 @@ LDAP_get_option(LDAPObject *self, int option)
268286
269287 switch (option ) {
270288#ifdef HAVE_SASL
289+ case LDAP_OPT_X_SASL_SECPROPS :
271290 case LDAP_OPT_X_SASL_SSF_EXTERNAL :
272291 /* Write-only options */
273292 PyErr_SetString (PyExc_ValueError , "write-only option" );
@@ -350,10 +369,20 @@ LDAP_get_option(LDAPObject *self, int option)
350369 return option_error (res , "ldap_get_option" );
351370 return PyInt_FromLong (intval );
352371
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+
353381#ifdef HAVE_SASL
354382 case LDAP_OPT_X_SASL_SSF :
355383 case LDAP_OPT_X_SASL_SSF_MIN :
356384 case LDAP_OPT_X_SASL_SSF_MAX :
385+ case LDAP_OPT_X_SASL_MAXBUFSIZE :
357386 /* ber_len_t options (unsigned long)*/
358387 res = LDAP_int_get_option (self , option , & blen );
359388 if (res != LDAP_OPT_SUCCESS )
@@ -388,16 +417,21 @@ LDAP_get_option(LDAPObject *self, int option)
388417#ifdef LDAP_OPT_X_TLS_PACKAGE
389418 case LDAP_OPT_X_TLS_PACKAGE :
390419#endif
420+ #ifdef LDAP_OPT_X_TLS_ECNAME
421+ case LDAP_OPT_X_TLS_ECNAME :
422+ #endif
391423#endif
392424#ifdef HAVE_SASL
393- case LDAP_OPT_X_SASL_SECPROPS :
394425 case LDAP_OPT_X_SASL_MECH :
395426 case LDAP_OPT_X_SASL_REALM :
396427 case LDAP_OPT_X_SASL_AUTHCID :
397428 case LDAP_OPT_X_SASL_AUTHZID :
398429#ifdef LDAP_OPT_X_SASL_USERNAME
399430 case LDAP_OPT_X_SASL_USERNAME :
400431#endif
432+ #endif
433+ #ifdef LDAP_OPT_SOCKET_BIND_ADDRESSES
434+ case LDAP_OPT_SOCKET_BIND_ADDRESSES :
401435#endif
402436 /* String-valued options */
403437 res = LDAP_int_get_option (self , option , & strval );
0 commit comments