1
1
/* See https://www.python-ldap.org/ for details.
2
- * $Id: LDAPObject.c,v 1.96 2017/08/15 16:21:59 stroeder Exp $ */
2
+ * $Id: LDAPObject.c,v 1.97 2017/09/07 09:03:00 stroeder Exp $ */
3
3
4
4
#include "common.h"
5
5
#include "patchlevel.h"
@@ -1024,7 +1024,6 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
1024
1024
int result = LDAP_SUCCESS ;
1025
1025
char * * refs = NULL ;
1026
1026
LDAPControl * * serverctrls = 0 ;
1027
- LDAP_BEGIN_ALLOW_THREADS ( self );
1028
1027
if (res_type == LDAP_RES_SEARCH_ENTRY ) {
1029
1028
/* LDAPmessage_to_python will parse entries and read the controls for each entry */
1030
1029
} else if (res_type == LDAP_RES_SEARCH_REFERENCE ) {
@@ -1035,18 +1034,21 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
1035
1034
int rc ;
1036
1035
if (res_type == LDAP_RES_EXTENDED ) {
1037
1036
struct berval * retdata = 0 ;
1037
+ LDAP_BEGIN_ALLOW_THREADS ( self );
1038
1038
rc = ldap_parse_extended_result ( self -> ldap , msg , & retoid , & retdata , 0 );
1039
+ LDAP_END_ALLOW_THREADS ( self );
1039
1040
/* handle error rc!=0 here? */
1040
1041
if (rc == LDAP_SUCCESS ) {
1041
1042
valuestr = LDAPberval_to_object (retdata );
1042
1043
}
1043
1044
ber_bvfree ( retdata );
1044
1045
}
1045
1046
1047
+ LDAP_BEGIN_ALLOW_THREADS ( self );
1046
1048
rc = ldap_parse_result ( self -> ldap , msg , & result , NULL , NULL , & refs ,
1047
1049
& serverctrls , 0 );
1050
+ LDAP_END_ALLOW_THREADS ( self );
1048
1051
}
1049
- LDAP_END_ALLOW_THREADS ( self );
1050
1052
1051
1053
if (result != LDAP_SUCCESS ) { /* result error */
1052
1054
char * e , err [1024 ];
@@ -1061,7 +1063,9 @@ l_ldap_result4( LDAPObject* self, PyObject *args )
1061
1063
1062
1064
if (!(pyctrls = LDAPControls_to_List (serverctrls ))) {
1063
1065
int err = LDAP_NO_MEMORY ;
1066
+ LDAP_BEGIN_ALLOW_THREADS ( self );
1064
1067
ldap_set_option (self -> ldap , LDAP_OPT_ERROR_NUMBER , & err );
1068
+ LDAP_END_ALLOW_THREADS ( self );
1065
1069
ldap_msgfree (msg );
1066
1070
return LDAPerror (self -> ldap , "LDAPControls_to_List" );
1067
1071
}
0 commit comments