r15804: Fix SAMLOGON test
authorSimo Sorce <idra@samba.org>
Mon, 22 May 2006 15:17:12 +0000 (15:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:25 +0000 (14:08 -0500)
source/dsdb/samdb/ldb_modules/password_hash.c

index c1eb244e19eb7c8cafb934b32cb4a798b728e5f4..1a2ca629bcfe6e28cb413393ae7e6c4a92552f97 100644 (file)
@@ -769,23 +769,22 @@ static int add_password_hashes(struct ldb_module *module, struct ldb_message *ms
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       /* compute the new nt and lm hashes */
        if (is_mod) {
                if (ldb_msg_add_empty(msg, "ntPwdHash", LDB_FLAG_MOD_REPLACE) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
+               if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE) != 0) {
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
        }       
+
+       /* compute the new nt and lm hashes */
        E_md4hash(sambaPassword, tmp_hash.hash);
        if (samdb_msg_add_hash(module->ldb, msg, msg, "ntPwdHash", &tmp_hash) != 0) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
        if (E_deshash(sambaPassword, tmp_hash.hash)) {
-               if (is_mod) {
-                       if (ldb_msg_add_empty(msg, "lmPwdHash", LDB_FLAG_MOD_REPLACE) != 0) {
-                               return LDB_ERR_OPERATIONS_ERROR;
-                       }
-               }
                if (samdb_msg_add_hash(module->ldb, msg, msg, "lmPwdHash", &tmp_hash) != 0) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }