diff options
author | Günther Deschner <gd@samba.org> | 2010-05-07 22:58:42 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-05-12 00:21:06 +0200 |
commit | b73b237a6b5e2a596c89608301454f0577f650ab (patch) | |
tree | dc2f85783d24eea882972abae03557ec64117111 /source4 | |
parent | 1cee92caaaca9f98e4e18aa597666297c2d347e1 (diff) | |
download | samba-b73b237a6b5e2a596c89608301454f0577f650ab.tar.gz samba-b73b237a6b5e2a596c89608301454f0577f650ab.tar.bz2 samba-b73b237a6b5e2a596c89608301454f0577f650ab.zip |
s4-smbtorture: add test_oemchangepassword to RAP-SAM.
Guenther
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/rap/sam.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c index f3ad5b9699..67cfeb8c73 100644 --- a/source4/torture/rap/sam.c +++ b/source4/torture/rap/sam.c @@ -50,11 +50,40 @@ static bool test_userpasswordset2(struct torture_context *tctx, return true; } +static bool test_oemchangepassword(struct torture_context *tctx, + struct smbcli_state *cli) +{ + struct rap_NetOEMChangePassword r; + + const char *oldpass = "secret"; + const char *newpass = "newpwd"; + uint8_t old_pw_hash[16]; + uint8_t new_pw_hash[16]; + + r.in.UserName = "gd"; + + E_deshash(oldpass, old_pw_hash); + E_deshash(newpass, new_pw_hash); + + encode_pw_buffer(r.in.crypt_password, newpass, STR_ASCII); + arcfour_crypt(r.in.crypt_password, old_pw_hash, 516); + E_old_pw_hash(new_pw_hash, old_pw_hash, r.in.password_hash); + + torture_comment(tctx, "Testing rap_NetOEMChangePassword(%s)\n", r.in.UserName); + + torture_assert_ntstatus_ok(tctx, + smbcli_rap_netoemchangepassword(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), + "smbcli_rap_netoemchangepassword failed"); + + return true; +} + struct torture_suite *torture_rap_sam(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "SAM"); torture_suite_add_1smb_test(suite, "userpasswordset2", test_userpasswordset2); + torture_suite_add_1smb_test(suite, "oemchangepassword", test_oemchangepassword); return suite; } |