From: Andreas Schneider Date: Wed, 24 Jul 2019 13:57:25 +0000 (+0200) Subject: s4:torture: Use init_samr_CryptPassword in test_SetUserPass_23 X-Git-Tag: tdb-1.4.2~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0b9cabc4de64497140d33d0fdaf2927f2915987;p=thirdparty%2Fsamba.git s4:torture: Use init_samr_CryptPassword in test_SetUserPass_23 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index f281be654cc..543ef64e9ac 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -706,8 +706,6 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t u.info23.info.fields_present = fields_present; - encode_pw_buffer(u.info23.password.data, newpass, STR_UNICODE); - status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n", @@ -715,7 +713,12 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t return false; } - arcfour_crypt_blob(u.info23.password.data, 516, &session_key); + status = init_samr_CryptPassword(newpass, + &session_key, + &u.info23.password); + torture_assert_ntstatus_ok(tctx, + status, + "init_samr_CryptPassword failed"); torture_comment(tctx, "Testing SetUserInfo level 23 (set password)\n"); @@ -732,8 +735,6 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t *password = newpass; } - encode_pw_buffer(u.info23.password.data, newpass, STR_UNICODE); - status = dcerpc_fetch_session_key(p, &session_key); if (!NT_STATUS_IS_OK(status)) { torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n", @@ -742,8 +743,17 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t } /* This should break the key nicely */ - session_key.length--; - arcfour_crypt_blob(u.info23.password.data, 516, &session_key); + session_key.data[0]++; + + status = init_samr_CryptPassword(newpass, + &session_key, + &u.info23.password); + torture_assert_ntstatus_ok(tctx, + status, + "init_samr_CryptPassword failed"); + + /* Reset the session key */ + session_key.data[0]--; torture_comment(tctx, "Testing SetUserInfo level 23 (set password) with wrong password\n");