Skip to content

Commit 0870889

Browse files
tiranencukou
authored andcommitted
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 72a4707 commit 0870889

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
@@ -1365,14 +1365,16 @@ l_ldap_start_tls_s(LDAPObject *self, PyObject *args)
13651365
/* ldap_set_option */
13661366

13671367
static PyObject *
1368-
l_ldap_set_option(PyObject *self, PyObject *args)
1368+
l_ldap_set_option(LDAPObject *self, PyObject *args)
13691369
{
13701370
PyObject *value;
13711371
int option;
13721372

13731373
if (!PyArg_ParseTuple(args, "iO:set_option", &option, &value))
13741374
return NULL;
1375-
if (!LDAP_set_option((LDAPObject *)self, option, value))
1375+
if (not_valid(self))
1376+
return NULL;
1377+
if (!LDAP_set_option(self, option, value))
13761378
return NULL;
13771379
Py_INCREF(Py_None);
13781380
return Py_None;
@@ -1381,13 +1383,15 @@ l_ldap_set_option(PyObject *self, PyObject *args)
13811383
/* ldap_get_option */
13821384

13831385
static PyObject *
1384-
l_ldap_get_option(PyObject *self, PyObject *args)
1386+
l_ldap_get_option(LDAPObject *self, PyObject *args)
13851387
{
13861388
int option;
13871389

13881390
if (!PyArg_ParseTuple(args, "i:get_option", &option))
13891391
return NULL;
1390-
return LDAP_get_option((LDAPObject *)self, option);
1392+
if (not_valid(self))
1393+
return NULL;
1394+
return LDAP_get_option(self, option);
13911395
}
13921396

13931397
/* 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