From 99c92b74c965d22260ce57832e7e5e6baa38a09c Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 22 Aug 2007 12:07:27 +0000 Subject: [PATCH] handle response controls in exops --- servers/slapd/back-ldap/extended.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-ldap/extended.c b/servers/slapd/back-ldap/extended.c index febfffacab..06f374ae3c 100644 --- a/servers/slapd/back-ldap/extended.c +++ b/servers/slapd/back-ldap/extended.c @@ -125,6 +125,7 @@ ldap_back_exop_passwd( ndn = op->o_req_ndn; assert( lc != NULL ); + assert( rs->sr_ctrls == NULL ); if ( BER_BVISNULL( &ndn ) && op->ore_reqdata != NULL ) { /* NOTE: most of this code is mutuated @@ -190,6 +191,7 @@ retry: op->o_ctrls, NULL, &msgid ); if ( rc == LDAP_SUCCESS ) { + /* TODO: set timeout? */ if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, NULL, &res ) == -1 ) { ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER, &rc ); rs->sr_err = rc; @@ -206,7 +208,7 @@ retry: rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err, (char **)&rs->sr_matched, &text, - NULL, NULL, 0 ); + NULL, &rs->sr_ctrls, 0 ); if ( rc == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) { @@ -270,6 +272,11 @@ retry: rs->sr_matched = NULL; } + if ( rs->sr_ctrls ) { + ldap_controls_free( rs->sr_ctrls ); + rs->sr_ctrls = NULL; + } + if ( text ) { free( text ); rs->sr_text = NULL; @@ -299,6 +306,7 @@ ldap_back_exop_generic( char *text = NULL; assert( lc != NULL ); + assert( rs->sr_ctrls == NULL ); Debug( LDAP_DEBUG_ARGS, "==> ldap_back_exop_generic(%s, \"%s\")\n", op->ore_reqoid.bv_val, op->o_req_dn.bv_val, 0 ); @@ -309,6 +317,7 @@ retry: op->o_ctrls, NULL, &msgid ); if ( rc == LDAP_SUCCESS ) { + /* TODO: set timeout? */ if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, NULL, &res ) == -1 ) { ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER, &rc ); rs->sr_err = rc; @@ -325,7 +334,7 @@ retry: rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err, (char **)&rs->sr_matched, &text, - NULL, NULL, 0 ); + NULL, &rs->sr_ctrls, 0 ); if ( rc == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) { rc = ldap_parse_extended_result( lc->lc_ld, res, @@ -370,6 +379,11 @@ retry: rs->sr_matched = NULL; } + if ( rs->sr_ctrls ) { + ldap_controls_free( rs->sr_ctrls ); + rs->sr_ctrls = NULL; + } + if ( text ) { free( text ); rs->sr_text = NULL;