]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/passwd.c
Added bdb_attribute and bdb_group ACL support routines
[openldap] / servers / slapd / back-bdb / passwd.c
index 09b4bc4ed5352d5d96a0d0d1ead4f4dbcca79cbb..3642eacfc568cb844a58b89273e685e80dd5e895 100644 (file)
@@ -32,6 +32,8 @@ bdb_exop_passwd(
        struct berval *hash = NULL;
        DB_TXN *ltid = NULL;
        struct bdb_op_info opinfo;
+       char textbuf[SLAP_TEXT_BUFLEN];
+       size_t textlen = sizeof textbuf;
 
        struct berval *id = NULL;
        struct berval *new = NULL;
@@ -73,7 +75,7 @@ bdb_exop_passwd(
 
        dn = id ? id->bv_val : op->o_dn;
 
-       Debug( LDAP_DEBUG_TRACE, "passwd: \"%s\"%s\n",
+       Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: \"%s\"%s\n",
                dn, id ? " (proxy)" : "", 0 );
 
        if( dn == NULL || dn[0] == '\0' ) {
@@ -83,8 +85,9 @@ bdb_exop_passwd(
        }
 
        if (0) {
-               /* transaction retry */
-retry: rc = txn_abort( ltid );
+retry: /* transaction retry */
+               Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
+               rc = txn_abort( ltid );
                ltid = NULL;
                op->o_private = NULL;
                if( rc != 0 ) {
@@ -96,6 +99,7 @@ retry:        rc = txn_abort( ltid );
 
        /* begin transaction */
        rc = txn_begin( bdb->bi_dbenv, NULL, &ltid, 0 );
+       *text = NULL;
        if( rc != 0 ) {
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_exop_passwd: txn_begin failed: %s (%d)\n",
@@ -128,7 +132,7 @@ retry:      rc = txn_abort( ltid );
 
        if( e == NULL ) {
                *text = "could not locate authorization entry";
-               rc = LDAP_OPERATIONS_ERROR;
+               rc = LDAP_NO_SUCH_OBJECT;
                goto done;
        }
 
@@ -160,11 +164,12 @@ retry:    rc = txn_abort( ltid );
                ml.sml_next = NULL;
 
                rc = bdb_modify_internal( be, conn, op, ltid,
-                       &ml, e, text );
+                       &ml, e, text, textbuf, textlen );
 
                switch(rc) {
                case DB_LOCK_DEADLOCK:
                case DB_LOCK_NOTGRANTED:
+                       *text = NULL;
                        bdb_entry_return( be, e );
                        e = NULL;
                        goto retry;
@@ -185,11 +190,11 @@ retry:    rc = txn_abort( ltid );
                case DB_LOCK_DEADLOCK:
                case DB_LOCK_NOTGRANTED:
                        bdb_entry_return( be, e );
+                       e = NULL;
                        goto retry;
                }
                *text = "entry update failed";
                rc = LDAP_OTHER;
-               goto done;
        }
 
 done: