From dbfc18985a04e58aebf43a98a8f7c798b4ff6d7b Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 12 Mar 2002 22:46:13 +0000 Subject: [PATCH] Align with back-ldbm version --- servers/slapd/back-bdb/passwd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/servers/slapd/back-bdb/passwd.c b/servers/slapd/back-bdb/passwd.c index bec8619789..8be81e0080 100644 --- a/servers/slapd/back-bdb/passwd.c +++ b/servers/slapd/back-bdb/passwd.c @@ -38,7 +38,8 @@ bdb_exop_passwd( struct berval id = { 0, NULL }; struct berval new = { 0, NULL }; - struct berval *dn; + struct berval dn; + struct berval ndn; assert( reqoid != NULL ); assert( strcmp( LDAP_EXOP_MODIFY_PASSWD, reqoid ) == 0 ); @@ -73,17 +74,27 @@ bdb_exop_passwd( goto done; } - dn = id.bv_val ? &id : &op->o_dn; + if( id.bv_len ) { + dn = id; + } else { + dn = op->o_dn; + } Debug( LDAP_DEBUG_TRACE, "bdb_exop_passwd: \"%s\"%s\n", - dn->bv_val, id.bv_val ? " (proxy)" : "", 0 ); + dn.bv_val, id.bv_len ? " (proxy)" : "", 0 ); - if( dn->bv_len == 0 ) { + if( dn.bv_len == 0 ) { *text = "No password is associated with the Root DSE"; rc = LDAP_OPERATIONS_ERROR; goto done; } + rc = dnNormalize2( NULL, &dn, &ndn ); + if( rc != LDAP_SUCCESS ) { + *text = "Invalid DN"; + goto done; + } + if( 0 ) { retry: /* transaction retry */ if ( e != NULL ) { @@ -121,7 +132,7 @@ retry: /* transaction retry */ op->o_private = &opinfo; /* get entry */ - rc = bdb_dn2entry_w( be, ltid, dn, &e, NULL, 0 ); + rc = bdb_dn2entry_w( be, ltid, &ndn, &e, NULL, 0 ); switch(rc) { case DB_LOCK_DEADLOCK: -- 2.39.5