X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldap%2Fmodify.c;h=3c287cd8db02c67fffdebdc2b239da4e1f119849;hb=fb2e448e877a8a387084dde517362c9f7bf1b6b7;hp=9e53ac2b8e74d7c522f49e0cc2f635a21c1e3d6e;hpb=150a4f106ce06829466562db3edcec9a719209ab;p=openldap diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index 9e53ac2b8e..3c287cd8db 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1999-2006 The OpenLDAP Foundation. + * Copyright 1999-2007 The OpenLDAP Foundation. * Portions Copyright 1999-2003 Howard Chu. * Portions Copyright 2000-2003 Pierangelo Masarati. * All rights reserved. @@ -38,7 +38,7 @@ ldap_back_modify( { ldapinfo_t *li = (ldapinfo_t *)op->o_bd->be_private; - ldapconn_t *lc; + ldapconn_t *lc = NULL; LDAPMod **modv = NULL, *mods = NULL; Modifications *ml; @@ -48,8 +48,7 @@ ldap_back_modify( ldap_back_send_t retrying = LDAP_BACK_RETRYING; LDAPControl **ctrls = NULL; - lc = ldap_back_getconn( op, rs, LDAP_BACK_SENDERR ); - if ( !lc || !ldap_back_dobind( lc, op, rs, LDAP_BACK_SENDERR ) ) { + if ( !ldap_back_dobind( &lc, op, rs, LDAP_BACK_SENDERR ) ) { return rs->sr_err; } @@ -98,6 +97,7 @@ ldap_back_modify( } modv[ i ] = 0; +retry:; ctrls = op->o_ctrls; rc = ldap_back_proxy_authz_ctrl( &lc->lc_bound_ndn, li->li_version, &li->li_idassert, op, rs, &ctrls ); @@ -107,7 +107,6 @@ ldap_back_modify( goto cleanup; } -retry: rs->sr_err = ldap_modify_ext( lc->lc_ld, op->o_req_dn.bv_val, modv, ctrls, NULL, &msgid ); rc = ldap_back_op_result( lc, op, rs, msgid, @@ -116,6 +115,8 @@ retry: if ( rs->sr_err == LDAP_UNAVAILABLE && retrying ) { retrying &= ~LDAP_BACK_RETRYING; if ( ldap_back_retry( &lc, op, rs, LDAP_BACK_SENDERR ) ) { + /* if the identity changed, there might be need to re-authz */ + (void)ldap_back_proxy_authz_ctrl_free( op, &ctrls ); goto retry; } } @@ -129,7 +130,7 @@ cleanup:; ch_free( modv ); if ( lc != NULL ) { - ldap_back_release_conn( op, rs, lc ); + ldap_back_release_conn( li, lc ); } return rc;