diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-07-15 05:13:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:36 -0500 |
commit | f348037f7bb7ec0638d8d4c96e06a7d3d7406151 (patch) | |
tree | 27609b8226f97cf60eeca99cfa5f6519debf6858 /source4 | |
parent | 2392e9aaa7de6fcaf292050714a5c6cc229ea77c (diff) | |
download | samba-f348037f7bb7ec0638d8d4c96e06a7d3d7406151.tar.gz samba-f348037f7bb7ec0638d8d4c96e06a7d3d7406151.tar.bz2 samba-f348037f7bb7ec0638d8d4c96e06a7d3d7406151.zip |
r1510: add a commented out routine I used to test password change on NT3.
(This used to be commit fb5796b0dccf7cd518db03e6456d986f17e50345)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rpc/samr.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index bd5c44a732..9bc35fbbd2 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -727,6 +727,67 @@ static NTSTATUS test_OpenUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return status; } +#if 0 +static BOOL test_ChangePasswordNT3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct samr_ChangePasswordUser r; + BOOL ret = True; + struct samr_Password hash1, hash2, hash3, hash4, hash5, hash6; + struct policy_handle user_handle; + char *oldpass = "test"; + char *newpass = "test2"; + uint8_t old_nt_hash[16], new_nt_hash[16]; + uint8_t old_lm_hash[16], new_lm_hash[16]; + + status = test_OpenUser_byname(p, mem_ctx, handle, "testuser", &user_handle); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + printf("Testing ChangePasswordUser for user 'testuser'\n"); + + printf("old password: %s\n", oldpass); + printf("new password: %s\n", newpass); + + E_md4hash(oldpass, old_nt_hash); + E_md4hash(newpass, new_nt_hash); + E_deshash(oldpass, old_lm_hash); + E_deshash(newpass, new_lm_hash); + + E_old_pw_hash(new_lm_hash, old_lm_hash, hash1.hash); + E_old_pw_hash(old_lm_hash, new_lm_hash, hash2.hash); + E_old_pw_hash(new_nt_hash, old_nt_hash, hash3.hash); + E_old_pw_hash(old_nt_hash, new_nt_hash, hash4.hash); + E_old_pw_hash(old_lm_hash, new_nt_hash, hash5.hash); + E_old_pw_hash(old_nt_hash, new_lm_hash, hash6.hash); + + r.in.handle = &user_handle; + r.in.lm_present = 1; + r.in.old_lm_crypted = &hash1; + r.in.new_lm_crypted = &hash2; + r.in.nt_present = 1; + r.in.old_nt_crypted = &hash3; + r.in.new_nt_crypted = &hash4; + r.in.cross1_present = 1; + r.in.nt_cross = &hash5; + r.in.cross2_present = 1; + r.in.lm_cross = &hash6; + + status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); + ret = False; + } + + if (!test_Close(p, mem_ctx, &user_handle)) { + ret = False; + } + + return ret; +} +#endif static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, char **password) |