]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/passwd.c
fix previous commit
[openldap] / servers / slapd / passwd.c
index 65710aaff5367a49b31cb7ad6b317f587b769c81..270b1148b21e920f1d56f9877d7f2d002eece78d 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;
@@ -315,7 +314,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 ) {
@@ -494,17 +493,8 @@ slap_passwd_hash(
 #ifdef SLAPD_CRYPT
 static ldap_pvt_thread_mutex_t passwd_mutex;
 static lutil_cryptfunc slapd_crypt;
-#endif
 
-void slap_passwd_init()
-{
-#ifdef SLAPD_CRYPT
-       ldap_pvt_thread_mutex_init( &passwd_mutex );
-       lutil_cryptptr = slapd_crypt;
-#endif
-}
-#ifdef 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;
@@ -528,3 +518,11 @@ int slapd_crypt( const char *key, const char *salt, char **hash )
 }
 #endif /* SLAPD_CRYPT */
 
+void slap_passwd_init()
+{
+#ifdef SLAPD_CRYPT
+       ldap_pvt_thread_mutex_init( &passwd_mutex );
+       lutil_cryptptr = slapd_crypt;
+#endif
+}
+