Skip to content

Commit e182bd2

Browse files
committed
Check valid connection in LDAPObject.set/get_option
set_option() and get_option() now verify that LDAPObject is valid. This fixes an assertion error and possible segfault after unbind_ext(). Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 1685038 commit e182bd2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Modules/LDAPObject.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,8 @@ l_ldap_set_option(PyObject *self, PyObject *args)
13911391

13921392
if (!PyArg_ParseTuple(args, "iO:set_option", &option, &value))
13931393
return NULL;
1394+
if (not_valid(self))
1395+
return NULL;
13941396
if (!LDAP_set_option((LDAPObject *)self, option, value))
13951397
return NULL;
13961398
Py_INCREF(Py_None);
@@ -1406,6 +1408,8 @@ l_ldap_get_option(PyObject *self, PyObject *args)
14061408

14071409
if (!PyArg_ParseTuple(args, "i:get_option", &option))
14081410
return NULL;
1411+
if (not_valid(self))
1412+
return NULL;
14091413
return LDAP_get_option((LDAPObject *)self, option);
14101414
}
14111415

0 commit comments

Comments
 (0)