Skip to content

Commit

Permalink
Fixed releasing GIL when calling ldap_start_tls_s()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Jan 25, 2017
1 parent 2db5c4c commit e832b57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Lib/
Modules/
* Fixed checking for empty server error message
(thanks to Bradley Baetz)
* Fixed releasing GIL when calling ldap_start_tls_s()
(thanks to Lars Munch)

----------------------------------------------------------------
Released 2.4.28 2016-11-17
Expand Down Expand Up @@ -1308,4 +1310,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19

$Id: CHANGES,v 1.400 2017/01/06 15:11:14 stroeder Exp $
$Id: CHANGES,v 1.401 2017/01/25 19:41:31 stroeder Exp $
12 changes: 7 additions & 5 deletions Modules/LDAPObject.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* See http://www.python-ldap.org/ for details.
* $Id: LDAPObject.c,v 1.94 2016/01/26 11:01:08 stroeder Exp $ */
* $Id: LDAPObject.c,v 1.95 2017/01/25 19:41:31 stroeder Exp $ */

#include "common.h"
#include "patchlevel.h"
Expand Down Expand Up @@ -1213,14 +1213,16 @@ l_ldap_whoami_s( LDAPObject* self, PyObject* args )
static PyObject*
l_ldap_start_tls_s( LDAPObject* self, PyObject* args )
{
int result;
int ldaperror;

if (!PyArg_ParseTuple( args, "" )) return NULL;
if (not_valid(self)) return NULL;

result = ldap_start_tls_s( self->ldap, NULL, NULL );
if ( result != LDAP_SUCCESS ){
ldap_set_option(self->ldap, LDAP_OPT_ERROR_NUMBER, &result);
LDAP_BEGIN_ALLOW_THREADS( self );
ldaperror = ldap_start_tls_s( self->ldap, NULL, NULL );
LDAP_END_ALLOW_THREADS( self );
if ( ldaperror != LDAP_SUCCESS ){
ldap_set_option(self->ldap, LDAP_OPT_ERROR_NUMBER, &ldaperror);
return LDAPerror( self->ldap, "ldap_start_tls_s" );
}

Expand Down

0 comments on commit e832b57

Please sign in to comment.