From f148506bf68f688e606b33b773f1aadb879a9ae2 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 27 Dec 2002 18:08:27 +0000 Subject: [PATCH] reworking of error handling (should also fix ITS#2235) --- servers/slapd/back-bdb/modrdn.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index 7d3613fba1..f6ca46da1a 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -38,7 +38,7 @@ bdb_modrdn( /* LDAP v2 supporting correct attribute handling. */ LDAPRDN *new_rdn = NULL; LDAPRDN *old_rdn = NULL; - int rc; + int rc; const char *text; char textbuf[SLAP_TEXT_BUFLEN]; size_t textlen = sizeof textbuf; @@ -187,16 +187,14 @@ retry: /* transaction retry */ goto done; } - /* check write on old entry */ - rc = access_allowed( be, conn, op, e, - entry, NULL, ACL_WRITE, NULL ); - switch( opinfo.boi_err ) { case DB_LOCK_DEADLOCK: case DB_LOCK_NOTGRANTED: goto retry; } + /* check write on old entry */ + rc = access_allowed( be, conn, op, e, entry, NULL, ACL_WRITE, NULL ); if ( ! rc ) { #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ERR, @@ -205,6 +203,7 @@ retry: /* transaction retry */ Debug( LDAP_DEBUG_TRACE, "no access to entry\n", 0, 0, 0 ); #endif + text = "no write access to old entry"; rc = LDAP_INSUFFICIENT_ACCESS; goto return_results; } @@ -267,6 +266,7 @@ retry: /* transaction retry */ 0, 0, 0); #endif rc = LDAP_OTHER; + text = "old entry's parent does not exist"; goto return_results; } @@ -274,6 +274,7 @@ retry: /* transaction retry */ if ( ! access_allowed( be, conn, op, p, children, NULL, ACL_WRITE, NULL ) ) { + rc = LDAP_INSUFFICIENT_ACCESS; #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ERR, "==>bdb_modrdn: no access to parent\n", 0, 0, 0 ); @@ -281,8 +282,7 @@ retry: /* transaction retry */ Debug( LDAP_DEBUG_TRACE, "no access to parent\n", 0, 0, 0 ); #endif - send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, - NULL, NULL, NULL, NULL ); + text = "no write access to old parent's children"; goto return_results; } @@ -327,6 +327,7 @@ retry: /* transaction retry */ if ( ! rc ) { + rc = LDAP_INSUFFICIENT_ACCESS; #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ERR, "==>bdb_modrdn: no access to parent\n", 0, 0, 0 ); @@ -335,9 +336,7 @@ retry: /* transaction retry */ "no access to parent\n", 0, 0, 0 ); #endif - send_ldap_result( conn, op, - LDAP_INSUFFICIENT_ACCESS, - NULL, NULL, NULL, NULL ); + text = "no write access to old parent"; goto return_results; } @@ -374,6 +373,7 @@ retry: /* transaction retry */ "& \"\" is not suffix\n", 0, 0, 0); #endif + text = "no write access to old parent"; rc = LDAP_INSUFFICIENT_ACCESS; goto return_results; } @@ -445,6 +445,7 @@ retry: /* transaction retry */ "bdb_modrdn: newSup(ndn=%s) not here!\n", np_ndn->bv_val, 0, 0); #endif + text = "new superior not found"; rc = LDAP_OTHER; goto return_results; } @@ -469,6 +470,7 @@ retry: /* transaction retry */ "bdb_modrdn: no wr to newSup children\n", 0, 0, 0 ); #endif + text = "no write access to new superior's children"; rc = LDAP_INSUFFICIENT_ACCESS; goto return_results; } @@ -483,7 +485,7 @@ retry: /* transaction retry */ Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is alias\n", 0, 0, 0 ); #endif - + text = "new superior is an alias"; rc = LDAP_ALIAS_PROBLEM; goto return_results; } @@ -498,7 +500,7 @@ retry: /* transaction retry */ Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is referral\n", 0, 0, 0 ); #endif - + text = "new superior is a referral"; rc = LDAP_OTHER; goto return_results; } @@ -524,6 +526,7 @@ retry: /* transaction retry */ if ( ! rc ) { + rc = LDAP_INSUFFICIENT_ACCESS; #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ERR, "==>bdb_modrdn: no access to superior\n", 0, 0, 0 ); @@ -532,9 +535,7 @@ retry: /* transaction retry */ "no access to new superior\n", 0, 0, 0 ); #endif - send_ldap_result( conn, op, - LDAP_INSUFFICIENT_ACCESS, - NULL, NULL, NULL, NULL ); + text = "no write access to new superior's children"; goto return_results; } @@ -558,6 +559,7 @@ retry: /* transaction retry */ "& \"\" is not suffix\n", 0, 0, 0); #endif + text = "no write access to new superior's children"; rc = LDAP_INSUFFICIENT_ACCESS; goto return_results; } -- 2.39.5