From 966dd1bdcaed03c47c7a88ff7241c7bf5bbe571e Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 31 Aug 2002 17:03:42 +0000 Subject: [PATCH] definitely fix NOOP in back-bdb --- servers/slapd/back-bdb/modify.c | 23 +++++++++++++++-------- servers/slapd/back-bdb/modrdn.c | 4 +++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index bc50253073..965bb0b098 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -166,9 +166,10 @@ int bdb_modify_internal( e->e_ocflags = 0; } - /* check if modified attribute was indexed */ + /* check if modified attribute was indexed + * but not in case of NOOP... */ err = bdb_index_is_indexed( be, mod->sm_desc ); - if ( err == LDAP_SUCCESS ) { + if ( err == LDAP_SUCCESS && !op->o_noop ) { ap = attr_find( save_attrs, mod->sm_desc ); if ( ap ) ap->a_flags |= SLAP_ATTR_IXDEL; @@ -179,17 +180,23 @@ int bdb_modify_internal( /* check that the entry still obeys the schema */ rc = entry_schema_check( be, e, save_attrs, text, textbuf, textlen ); - if ( rc != LDAP_SUCCESS ) { + if ( rc != LDAP_SUCCESS || op->o_noop ) { attrs_free( e->e_attrs ); e->e_attrs = save_attrs; + + if ( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, ERR, - "bdb_modify_internal: entry failed schema check %s\n", - *text, 0, 0 ); + LDAP_LOG ( OPERATION, ERR, "bdb_modify_internal: " + "entry failed schema check %s\n", + *text, 0, 0 ); #else - Debug( LDAP_DEBUG_ANY, "entry failed schema check: %s\n", - *text, 0, 0 ); + Debug( LDAP_DEBUG_ANY, + "entry failed schema check: %s\n", + *text, 0, 0 ); #endif + } + + /* if NOOP then silently revert to saved attrs */ return rc; } diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 56bc41d28e..54b6de974e 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -752,7 +752,9 @@ retry: /* transaction retry */ op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn ); #endif text = NULL; - bdb_cache_entry_commit( e ); + if ( !noop ) { + bdb_cache_entry_commit( e ); + } } else { #ifdef NEW_LOGGING -- 2.39.5