]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/passwd.c
NVALUES: fix a couple of value_find_ex() calls
[openldap] / servers / slapd / back-bdb / passwd.c
index 87451ba30734db2b5b7546820e40bd208e8fe1f6..685a187cbd2c60ac522861181e3309a8279defd6 100644 (file)
 
 #include "back-bdb.h"
 #include "external.h"
+#include "lber_pvt.h"
 
 int
 bdb_exop_passwd(
        Backend         *be,
        Connection              *conn,
        Operation               *op,
-       const char              *reqoid,
+       struct berval           *reqoid,
        struct berval   *reqdata,
        char                    **rspoid,
        struct berval   **rspdata,
@@ -45,7 +46,7 @@ bdb_exop_passwd(
        DB_LOCK         lock;
 
        assert( reqoid != NULL );
-       assert( strcmp( LDAP_EXOP_MODIFY_PASSWD, reqoid ) == 0 );
+       assert( ber_bvcmp( &slap_EXOP_MODIFY_PASSWD, reqoid ) == 0 );
 
        rc = slap_passwd_parse( reqdata,
                &id, NULL, &new, text );
@@ -112,7 +113,7 @@ bdb_exop_passwd(
 retry: /* transaction retry */
                if ( e != NULL ) {
                        bdb_cache_delete_entry(&bdb->bi_cache, e);
-                       bdb_cache_return_entry_w(bdb->bi_dbenv, &bdb->bi_cache, e, &lock);
+                       bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
                }
 #ifdef NEW_LOGGING
                LDAP_LOG ( ACL, DETAIL1, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
@@ -122,6 +123,7 @@ retry:      /* transaction retry */
                rc = TXN_ABORT( ltid );
                ltid = NULL;
                op->o_private = NULL;
+               op->o_do_not_cache = opinfo.boi_acl_cache;
                if( rc != 0 ) {
                        rc = LDAP_OTHER;
                        *text = "internal error";
@@ -155,6 +157,7 @@ retry:      /* transaction retry */
        opinfo.boi_txn = ltid;
        opinfo.boi_locker = locker;
        opinfo.boi_err = 0;
+       opinfo.boi_acl_cache = op->o_do_not_cache;
        op->o_private = &opinfo;
 
        /* get entry */
@@ -214,13 +217,19 @@ retry:    /* transaction retry */
                vals[1].bv_val = NULL;
 
                ml.sml_desc = slap_schema.si_ad_userPassword;
-               ml.sml_bvalues = vals;
+               ml.sml_values = vals;
+#ifdef SLAP_NVALUES
+               ml.sml_nvalues = vals;
+#endif
                ml.sml_op = LDAP_MOD_REPLACE;
                ml.sml_next = NULL;
 
                rc = bdb_modify_internal( be, conn, op, ltid,
                        &ml, e, text, textbuf, textlen );
 
+               if ( (rc == LDAP_INSUFFICIENT_ACCESS) && opinfo.boi_err ) {
+                       rc = opinfo.boi_err;
+               }
                switch(rc) {
                case DB_LOCK_DEADLOCK:
                case DB_LOCK_NOTGRANTED:
@@ -264,7 +273,7 @@ retry:      /* transaction retry */
 
 done:
        if( e != NULL ) {
-               bdb_cache_return_entry_w( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
+               bdb_unlocked_cache_return_entry_w( &bdb->bi_cache, e );
        }
                
        if( hash.bv_val != NULL ) {