]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/passwd.c
Add pointer to an existing document since the netscape.com URLs are dead.
[openldap] / servers / slapd / passwd.c
index 5c4390c3379c56dbd75de4726378f48e44d0954f..327de020e045e2217832e45791be01459a74ce83 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}",
@@ -153,9 +154,8 @@ int passwd_extop(
                goto error_return;
        }
 
-#ifndef SLAPD_MULTIMASTER
        /* This does not apply to multi-master case */
-       if(!( !SLAP_SHADOW( op->o_bd ) || be_isupdate( op ))) {
+       if(!( !SLAP_SINGLE_SHADOW( op->o_bd ) || be_isupdate( op ))) {
                /* we SHOULD return a referral in this case */
                BerVarray defref = op->o_bd->be_update_refs
                        ? op->o_bd->be_update_refs : default_referral; 
@@ -177,7 +177,6 @@ int passwd_extop(
                rc = LDAP_UNWILLING_TO_PERFORM;
                goto error_return;
        }
-#endif /* !SLAPD_MULTIMASTER */
 
        /* generate a new password if none was provided */
        if ( qpw->rs_new.bv_len == 0 ) {
@@ -282,8 +281,13 @@ old_good:
                                         * 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;
@@ -520,8 +524,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)