From: Howard Chu Date: Tue, 16 May 2006 21:45:31 +0000 (+0000) Subject: ITS#4550 don't overwrite remote server's err msg X-Git-Tag: OPENLDAP_REL_ENG_2_4_3ALPHA~9^2~253 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb11c8117874aed2b33001cf1346c723693dbba4;p=openldap ITS#4550 don't overwrite remote server's err msg --- diff --git a/servers/slapd/back-ldap/extended.c b/servers/slapd/back-ldap/extended.c index e0537e870f..c4f43f8a4c 100644 --- a/servers/slapd/back-ldap/extended.c +++ b/servers/slapd/back-ldap/extended.c @@ -112,6 +112,7 @@ ldap_back_exop_passwd( ber_int_t msgid; int rc, isproxy; int do_retry = 1; + char *text = NULL; lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR ); if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) { @@ -140,7 +141,7 @@ retry: */ rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err, (char **)&rs->sr_matched, - (char **)&rs->sr_text, + &text, NULL, NULL, 0 ); if ( rc == LDAP_SUCCESS ) { @@ -180,6 +181,7 @@ retry: goto retry; } } + if ( text ) rs->sr_text = text; send_ldap_extended( op, rs ); /* otherwise frontend resends result */ rc = rs->sr_err = SLAPD_ABANDON; @@ -191,8 +193,8 @@ retry: rs->sr_matched = NULL; } - if ( rs->sr_text ) { - free( (char *)rs->sr_text ); + if ( text ) { + free( text ); rs->sr_text = NULL; } @@ -213,6 +215,7 @@ ldap_back_exop_generic( ber_int_t msgid; int rc; int do_retry = 1; + char *text = NULL; lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR ); if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) { @@ -238,7 +241,7 @@ retry: */ rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err, (char **)&rs->sr_matched, - (char **)&rs->sr_text, + text, NULL, NULL, 0 ); if ( rc == LDAP_SUCCESS ) { if ( rs->sr_err == LDAP_SUCCESS ) { @@ -264,6 +267,7 @@ retry: goto retry; } } + if ( text ) rs->sr_text = text; send_ldap_extended( op, rs ); /* otherwise frontend resends result */ rc = rs->sr_err = SLAPD_ABANDON; @@ -275,8 +279,8 @@ retry: rs->sr_matched = NULL; } - if ( rs->sr_text ) { - free( (char *)rs->sr_text ); + if ( text ) { + free( text ); rs->sr_text = NULL; }