]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/passwd.c
Switch to openldap-data directory
[openldap] / servers / slapd / back-bdb / passwd.c
index cb9b51aa6225fdb317191575022a38590d39d245..bec86197894430933f815cbd5ff677c2b8bbcab5 100644 (file)
@@ -91,7 +91,7 @@ retry:        /* transaction retry */
                        bdb_cache_return_entry_w(&bdb->bi_cache, e);
                }
                Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
-               rc = txn_abort( ltid );
+               rc = TXN_ABORT( ltid );
                ltid = NULL;
                op->o_private = NULL;
                if( rc != 0 ) {
@@ -102,19 +102,17 @@ retry:    /* transaction retry */
                ldap_pvt_thread_yield();
        }
 
-       if( bdb->bi_txn ) {
-               /* begin transaction */
-               rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 
-                       bdb->bi_db_opflags );
-               *text = NULL;
-               if( rc != 0 ) {
-                       Debug( LDAP_DEBUG_TRACE,
-                               "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
-                               db_strerror(rc), rc, 0 );
-                       rc = LDAP_OTHER;
-                       *text = "internal error";
-                       goto done;
-               }
+       /* begin transaction */
+       rc = TXN_BEGIN( bdb->bi_dbenv, NULL, &ltid, 
+               bdb->bi_db_opflags );
+       *text = NULL;
+       if( rc != 0 ) {
+               Debug( LDAP_DEBUG_TRACE,
+                       "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
+                       db_strerror(rc), rc, 0 );
+               rc = LDAP_OTHER;
+               *text = "internal error";
+               goto done;
        }
 
        opinfo.boi_bdb = be;
@@ -144,18 +142,27 @@ retry:    /* transaction retry */
                goto done;
        }
 
+#ifdef BDB_SUBENTRIES
+       if( is_entry_subentries( e ) ) {
+               /* entry is an alias, don't allow operation */
+               *text = "authorization entry is subentry";
+               rc = LDAP_OTHER;
+               goto done;
+       }
+#endif
+#ifdef BDB_ALIASES
        if( is_entry_alias( e ) ) {
                /* entry is an alias, don't allow operation */
                *text = "authorization entry is alias";
                rc = LDAP_ALIAS_PROBLEM;
                goto done;
        }
-
+#endif
 
        if( is_entry_referral( e ) ) {
                /* entry is an referral, don't allow operation */
                *text = "authorization entry is referral";
-               rc = LDAP_OPERATIONS_ERROR;
+               rc = LDAP_OTHER;
                goto done;
        }
 
@@ -199,8 +206,12 @@ retry:     /* transaction retry */
                        rc = LDAP_OTHER;
                }
 
-               if( bdb->bi_txn && rc == 0 ) {
-                       rc = txn_commit( ltid, 0 );
+               if( rc == 0 ) {
+                       if( op->o_noop ) {
+                               rc = TXN_ABORT( ltid );
+                       } else {
+                               rc = TXN_COMMIT( ltid, 0 );
+                       }
                        ltid = NULL;
                }
                op->o_private = NULL;
@@ -220,7 +231,7 @@ done:
        }
 
        if( ltid != NULL ) {
-               txn_abort( ltid );
+               TXN_ABORT( ltid );
                op->o_private = NULL;
        }