Skip to content

Commit 9ca5d97

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 7e084ae commit 9ca5d97

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Modules/LDAPObject.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,14 +1382,16 @@ l_ldap_start_tls_s(LDAPObject *self, PyObject *args)
13821382
/* ldap_set_option */
13831383

13841384
static PyObject *
1385-
l_ldap_set_option(PyObject *self, PyObject *args)
1385+
l_ldap_set_option(LDAPObject *self, PyObject *args)
13861386
{
13871387
PyObject *value;
13881388
int option;
13891389

13901390
if (!PyArg_ParseTuple(args, "iO:set_option", &option, &value))
13911391
return NULL;
1392-
if (!LDAP_set_option((LDAPObject *)self, option, value))
1392+
if (not_valid(self))
1393+
return NULL;
1394+
if (!LDAP_set_option(self, option, value))
13931395
return NULL;
13941396
Py_INCREF(Py_None);
13951397
return Py_None;
@@ -1398,13 +1400,15 @@ l_ldap_set_option(PyObject *self, PyObject *args)
13981400
/* ldap_get_option */
13991401

14001402
static PyObject *
1401-
l_ldap_get_option(PyObject *self, PyObject *args)
1403+
l_ldap_get_option(LDAPObject *self, PyObject *args)
14021404
{
14031405
int option;
14041406

14051407
if (!PyArg_ParseTuple(args, "i:get_option", &option))
14061408
return NULL;
1407-
return LDAP_get_option((LDAPObject *)self, option);
1409+
if (not_valid(self))
1410+
return NULL;
1411+
return LDAP_get_option(self, option);
14081412
}
14091413

14101414
/* ldap_passwd */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy