File tree Expand file tree Collapse file tree 1 file changed +3
-23
lines changed Expand file tree Collapse file tree 1 file changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -180,10 +180,9 @@ LDAP_get_option(LDAPObject *self, int option)
180
180
struct timeval * tv ;
181
181
LDAPAPIInfo apiinfo ;
182
182
LDAPControl * * lcs ;
183
- LDAPControl * lc ;
184
183
char * strval ;
185
- PyObject * extensions , * v , * tup ;
186
- Py_ssize_t i , num_extensions , num_controls ;
184
+ PyObject * extensions , * v ;
185
+ Py_ssize_t i , num_extensions ;
187
186
LDAP * ld ;
188
187
189
188
ld = self ? self -> ldap : NULL ;
@@ -352,27 +351,8 @@ LDAP_get_option(LDAPObject *self, int option)
352
351
if (res != LDAP_OPT_SUCCESS )
353
352
return option_error (res , "ldap_get_option" );
354
353
355
- if (lcs == NULL )
356
- return PyList_New (0 );
357
-
358
- /* Get the number of controls */
359
- num_controls = 0 ;
360
- while (lcs [num_controls ])
361
- num_controls ++ ;
362
-
363
- /* We'll build a list of controls, with each control a tuple */
364
- v = PyList_New (num_controls );
365
- for (i = 0 ; i < num_controls ; i ++ ) {
366
- lc = lcs [i ];
367
- tup = Py_BuildValue ("(sbs)" ,
368
- lc -> ldctl_oid ,
369
- lc -> ldctl_iscritical ,
370
- lc -> ldctl_value .bv_val );
371
- PyList_SET_ITEM (v , i , tup );
372
- }
373
-
354
+ v = LDAPControls_to_List (lcs );
374
355
ldap_controls_free (lcs );
375
-
376
356
return v ;
377
357
378
358
default :
You can’t perform that action at this time.
0 commit comments