]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/passwd.c
update for new backend types
[openldap] / servers / slapd / passwd.c
index 3b5cac6d7b5635d7c5eba23b1d304ad9c5a38091..82acabab4a343a77d5b41ed08f82a2d431b662d2 100644 (file)
@@ -78,10 +78,9 @@ int passwd_extop(
                return rs->sr_err;
        }
 
-       if ( id.bv_len ) {
-               ber_dupbv_x( &op->o_req_dn, &id, op->o_tmpmemctx );
-               /* ndn is in tmpmem, so we don't need to free it */
-               rs->sr_err = dnNormalize( 0, NULL, NULL, &id, &op->o_req_ndn, op->o_tmpmemctx );
+       if ( !BER_BVISEMPTY( &id ) ) {
+               rs->sr_err = dnPrettyNormal( NULL, &id, &op->o_req_dn,
+                               &op->o_req_ndn, op->o_tmpmemctx );
                if ( rs->sr_err != LDAP_SUCCESS ) {
                        rs->sr_text = "Invalid DN";
                        rc = rs->sr_err;
@@ -214,6 +213,7 @@ int passwd_extop(
        ml->sml_nvalues = NULL;
        ml->sml_desc = slap_schema.si_ad_userPassword;
        ml->sml_op = LDAP_MOD_REPLACE;
+       ml->sml_flags = 0;
        ml->sml_next = qpw->rs_mods;
        qpw->rs_mods = ml;
 
@@ -315,7 +315,7 @@ int slap_passwd_parse( struct berval *reqdata,
                        goto decoding_error;
                }
 
-               tag = ber_peek_tag( ber, &len);
+               tag = ber_peek_tag( ber, &len );
        }
 
        if( tag == LDAP_TAG_EXOP_MODIFY_PASSWD_OLD ) {
@@ -470,7 +470,7 @@ slap_passwd_hash_type(
        new->bv_len = 0;
        new->bv_val = NULL;
 
-       assert( hash );
+       assert( hash != NULL );
 
        lutil_passwd_hash( cred , hash, new, text );
 }
@@ -495,7 +495,7 @@ slap_passwd_hash(
 static ldap_pvt_thread_mutex_t passwd_mutex;
 static lutil_cryptfunc slapd_crypt;
 
-int slapd_crypt( const char *key, const char *salt, char **hash )
+static int slapd_crypt( const char *key, const char *salt, char **hash )
 {
        char *cr;
        int rc;
@@ -510,8 +510,10 @@ int slapd_crypt( const char *key, const char *salt, char **hash )
                if ( hash ) {
                        *hash = ber_strdup( cr );
                        rc = LUTIL_PASSWD_OK;
+
+               } else {
+                       rc = strcmp( salt, cr ) ? LUTIL_PASSWD_ERR : LUTIL_PASSWD_OK;
                }
-               rc = strcmp( salt, cr ) ? LUTIL_PASSWD_ERR : LUTIL_PASSWD_OK;
        }
 
        ldap_pvt_thread_mutex_unlock( &passwd_mutex );