From b73b237a6b5e2a596c89608301454f0577f650ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Fri, 7 May 2010 22:58:42 +0200 Subject: s4-smbtorture: add test_oemchangepassword to RAP-SAM. Guenther --- source4/torture/rap/sam.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source4/torture/rap') diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c index f3ad5b9699a..67cfeb8c735 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; } -- cgit v1.2.1