From: Hallvard Furuseth Date: Fri, 31 Dec 2010 09:02:34 +0000 (+0000) Subject: ITS#6758 config_build_entry, avoid SlapReply reuse X-Git-Tag: MIGRATION_CVS2GIT~306 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b120b2a05b189bbe5aceaad9b71948664d6cb779;p=openldap ITS#6758 config_build_entry, avoid SlapReply reuse Do not use the 'SlapReply *rs' passed to config_build_entry(). Instead pass a new one to op->o_bd->be_add() and copy the output sr_err to rs. This takes care of most SlapReply reuse in bconfig.c. --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index dda830388d..5b4e37b917 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -6402,6 +6402,8 @@ config_build_attrs( Entry *e, AttributeType **at, AttributeDescription *ad, return 0; } +/* currently (2010) does not access rs except possibly writing rs->sr_err */ + Entry * config_build_entry( Operation *op, SlapReply *rs, CfEntryInfo *parent, ConfigArgs *c, struct berval *rdn, ConfigOCs *main, ConfigOCs *extra ) @@ -6499,9 +6501,12 @@ fail: op->ora_modlist = NULL; slap_add_opattrs( op, NULL, NULL, 0, 0 ); if ( !op->o_noop ) { - op->o_bd->be_add( op, rs ); - if ( ( rs->sr_err != LDAP_SUCCESS ) - && (rs->sr_err != LDAP_ALREADY_EXISTS) ) { + SlapReply rs2 = {REP_RESULT}; + op->o_bd->be_add( op, &rs2 ); + rs->sr_err = rs2.sr_err; + rs_assert_done( &rs2 ); + if ( ( rs2.sr_err != LDAP_SUCCESS ) + && (rs2.sr_err != LDAP_ALREADY_EXISTS) ) { goto fail; } }