From c4b432cb3f058fec34d1abadd7c7072e7014677e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 29 Dec 2001 02:56:08 +0000 Subject: [PATCH] Fix newSuperior handling. Back out previous commit. --- servers/slapd/back-bdb/modrdn.c | 2 +- servers/slapd/back-ldbm/modrdn.c | 4 ++-- servers/slapd/modrdn.c | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 15c4973495..c67b5a3180 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -268,7 +268,7 @@ retry: /* transaction retry */ new_parent_dn = &p_dn; /* New Parent unless newSuperior given */ - if ( newSuperior->bv_val != NULL ) { + if ( newSuperior != NULL ) { Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: new parent \"%s\" requested...\n", newSuperior->bv_val, 0, 0 ); diff --git a/servers/slapd/back-ldbm/modrdn.c b/servers/slapd/back-ldbm/modrdn.c index 107986c9ff..d62ca57599 100644 --- a/servers/slapd/back-ldbm/modrdn.c +++ b/servers/slapd/back-ldbm/modrdn.c @@ -281,7 +281,7 @@ ldbm_back_modrdn( new_parent_dn = &p_dn; /* New Parent unless newSuperior given */ - if ( newSuperior->bv_val != NULL ) { + if ( newSuperior != NULL ) { #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, "ldbm_back_modrdn: new parent \"%s\" requested\n", @@ -314,7 +314,7 @@ ldbm_back_modrdn( } } - if ( newSuperior && newSuperior->bv_val != NULL ) { + if ( newSuperior != NULL ) { /* newSuperior == entry being moved?, if so ==> ERROR */ /* Get Entry with dn=newSuperior. Does newSuperior exist? */ diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 628f68497f..815da7d481 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -51,11 +51,11 @@ do_modrdn( struct berval pdn = { 0, NULL }; struct berval pnewrdn = { 0, NULL }; - struct berval pnewSuperior = { 0, NULL }; + struct berval pnewSuperior = { 0, NULL }, *pnewS = NULL; struct berval ndn = { 0, NULL }; struct berval nnewrdn = { 0, NULL }; - struct berval nnewSuperior = { 0, NULL }; + struct berval nnewSuperior = { 0, NULL }, *nnewS = NULL; Backend *be; Backend *newSuperior_be = NULL; @@ -136,6 +136,8 @@ do_modrdn( rc = SLAPD_DISCONNECT; goto cleanup; } + pnewS = &pnewSuperior; + nnewS = &nnewSuperior; } #ifdef NEW_LOGGING @@ -249,7 +251,7 @@ do_modrdn( goto cleanup; } - if( newSuperior.bv_len ) { + if( pnewS ) { rc = dnPrettyNormal( NULL, &newSuperior, &pnewSuperior, &nnewSuperior ); if( rc != LDAP_SUCCESS ) { @@ -306,7 +308,7 @@ do_modrdn( /* Make sure that the entry being changed and the newSuperior are in * the same backend, otherwise we return an error. */ - if( newSuperior.bv_len ) { + if( pnewS ) { newSuperior_be = select_backend( &nnewSuperior, 0, 0 ); if ( newSuperior_be != be ) { @@ -341,7 +343,7 @@ do_modrdn( { if ( (*be->be_modrdn)( be, conn, op, &pdn, &ndn, &pnewrdn, &nnewrdn, deloldrdn, - &pnewSuperior, &nnewSuperior ) == 0 + pnewS, nnewS ) == 0 #ifdef SLAPD_MULTIMASTER && ( !be->be_update_ndn.bv_len || !repl_user ) #endif -- 2.39.5