DB_TXN *ltid = NULL;
struct bdb_op_info opinfo;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
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;
+ struct berval id = { 0, NULL };
+ struct berval new = { 0, NULL };
rc = slap_passwd_parse( reqdata,
&id, NULL, &new, text );
Debug( LDAP_DEBUG_ARGS, "==> bdb_exop_passwd: \"%s\"\n",
rc = slap_passwd_parse( reqdata,
&id, NULL, &new, text );
Debug( LDAP_DEBUG_ARGS, "==> bdb_exop_passwd: \"%s\"\n",
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: retrying...\n", 0, 0, 0 );
- if( bdb->bi_txn ) {
- /* begin transaction */
- rc = txn_begin( bdb->bi_dbenv, NULL, <id,
- 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, <id,
+ 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;
- rc = bdb_dn2entry( be, ltid, dn, &e, NULL, 0 );
+ rc = bdb_dn2entry_w( be, ltid, dn, &e, NULL, 0 );
if( is_entry_alias( e ) ) {
/* entry is an alias, don't allow operation */
*text = "authorization entry is alias";
rc = LDAP_ALIAS_PROBLEM;
goto done;
}
if( is_entry_alias( e ) ) {
/* entry is an alias, don't allow operation */
*text = "authorization entry is alias";
rc = LDAP_ALIAS_PROBLEM;
goto done;
}
if( is_entry_referral( e ) ) {
/* entry is an referral, don't allow operation */
*text = "authorization entry is referral";
if( is_entry_referral( e ) ) {
/* entry is an referral, don't allow operation */
*text = "authorization entry is referral";
+ /* change the entry itself */
+ rc = bdb_id2entry_update( be, ltid, e );
+ if( rc != 0 ) {
+ switch(rc) {
+ case DB_LOCK_DEADLOCK:
+ case DB_LOCK_NOTGRANTED:
+ goto retry;
+ }
+ *text = "entry update failed";
+ rc = LDAP_OTHER;
+ }
- /* change the entry itself */
- rc = bdb_id2entry_update( be, ltid, e );
- if( rc != 0 ) {
- switch(rc) {
- case DB_LOCK_DEADLOCK:
- case DB_LOCK_NOTGRANTED:
- bdb_entry_return( be, e );
- e = NULL;
- goto retry;
+ if( rc == 0 ) {
+ if( op->o_noop ) {
+ rc = TXN_ABORT( ltid );
+ } else {
+ rc = TXN_COMMIT( ltid, 0 );
+ }
+ ltid = NULL;
- if( bdb->bi_txn && rc == 0 ) {
- rc = txn_commit( ltid, 0 );
- ltid = NULL;
+ if( rc == LDAP_SUCCESS ) {
+ replog( be, op, &e->e_name, &e->e_nname, &ml );
+ }