From 53a1ed9b6caa7b8ea2c5b4f1cae6faba19e09708 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 14 Dec 2009 20:54:33 +0100 Subject: s3: Factor password_in_history() out of check_passwd_history() --- source3/include/proto.h | 3 +++ source3/smbd/chgpasswd.c | 66 ++++++++++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 5b16120294..c0ca96bb92 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -6116,6 +6116,9 @@ NTSTATUS pass_oem_change(char *user, uchar password_encrypted_with_nt_hash[516], const uchar old_nt_hash_encrypted[16], enum samPwdChangeReason *reject_reason); +bool password_in_history(uint8_t nt_pw[NT_HASH_LEN], + uint32_t pw_history_len, + const uint8_t *pw_history); NTSTATUS check_password_complexity(const char *username, const char *password, enum samPwdChangeReason *samr_reject_reason); diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index 70ce75c552..c858c2dfa0 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -1008,6 +1008,41 @@ static NTSTATUS check_oem_password(const char *user, return NT_STATUS_WRONG_PASSWORD; } +bool password_in_history(uint8_t nt_pw[NT_HASH_LEN], + uint32_t pw_history_len, + const uint8_t *pw_history) +{ + static const uint8_t zero_md5_nt_pw[SALTED_MD5_HASH_LEN] = { 0, }; + int i; + + dump_data(100, nt_pw, NT_HASH_LEN); + dump_data(100, pw_history, PW_HISTORY_ENTRY_LEN * pw_history_len); + + for (i=0; i