]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/passwd.c
Fix prev commit, config_obsolete
[openldap] / servers / slapd / passwd.c
index fef49ef8b7b8db917e6538c971df2d29b8f57db4..2b87fac6640bf949508f30de65beaf78021fe85c 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 
-#include <ac/krb.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/unistd.h>
@@ -33,6 +32,8 @@
 #include <lutil.h>
 #include <lutil_sha1.h>
 
+const struct berval slap_EXOP_MODIFY_PASSWD = BER_BVC(LDAP_EXOP_MODIFY_PASSWD);
+
 static const char *defhash[] = {
 #ifdef LUTIL_SHA1_BYTES
        "{SSHA}",
@@ -51,15 +52,12 @@ int passwd_extop(
        req_extended_s qext = op->oq_extended;
        Modifications *ml;
        slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
-       slap_callback cb2 = { NULL, slap_replog_cb, NULL, NULL };
        int i, nhash;
        char **hashes;
        int rc;
        BackendDB *op_be;
        int freenewpw = 0;
 
-       cb2.sc_next = &cb;
-
        assert( ber_bvcmp( &slap_EXOP_MODIFY_PASSWD, &op->ore_reqoid ) == 0 );
 
        if( op->o_dn.bv_len == 0 ) {
@@ -274,14 +272,19 @@ old_good:
                slap_callback *sc = op->o_callback;
 
                op->o_tag = LDAP_REQ_MODIFY;
-               op->o_callback = &cb2;
+               op->o_callback = &cb;
                op->orm_modlist = qpw->rs_mods;
-               cb2.sc_private = qpw;   /* let Modify know this was pwdMod,
+               cb.sc_private = qpw;    /* let Modify know this was pwdMod,
                                         * if it cares... */
 
                rs->sr_err = op->o_bd->be_modify( op, rs );
+
+               /* be_modify() might have shuffled modifications */
+               qpw->rs_mods = op->orm_modlist;
+
                if ( rs->sr_err == LDAP_SUCCESS ) {
                        rs->sr_rspdata = rsp;
+
                } else if ( rsp ) {
                        ber_bvfree( rsp );
                        rsp = NULL;
@@ -518,8 +521,7 @@ void
 slap_passwd_generate( struct berval *pass )
 {
        Debug( LDAP_DEBUG_TRACE, "slap_passwd_generate\n", 0, 0, 0 );
-       pass->bv_val = NULL;
-       pass->bv_len = 0;
+       BER_BVZERO( pass );
 
        /*
         * generate passwords of only 8 characters as some getpass(3)