From 92a1bd505e5bb9c793f05b386d4e9ee2b2b74027 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 24 Jul 2019 15:56:08 +0200 Subject: [PATCH 040/187] s4:torture: Use init_samr_CryptPassword in test_SetUserPass Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit 70e05d7eb78a0c363dbd72cbbf4f3a264636c840) --- source4/torture/rpc/samr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index eb1bb14a555..f281be654cc 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -31,7 +31,7 @@ #include "librpc/gen_ndr/ndr_netlogon_c.h" #include "librpc/gen_ndr/ndr_samr_c.h" #include "librpc/gen_ndr/ndr_lsa_c.h" -#include "../lib/crypto/crypto.h" +#include "lib/crypto/crypto.h" #include "libcli/auth/libcli_auth.h" #include "libcli/security/security.h" #include "torture/rpc/torture_rpc.h" @@ -40,6 +40,8 @@ #include "auth/gensec/gensec_proto.h" #include "../libcli/auth/schannel.h" #include "torture/util.h" +#include "source4/librpc/rpc/dcerpc.h" +#include "source3/rpc_client/init_samr.h" #define TEST_ACCOUNT_NAME "samrtorturetest" #define TEST_ACCOUNT_NAME_PWD "samrpwdlastset" @@ -637,7 +639,6 @@ static bool test_SetUserPass(struct dcerpc_pipe *p, struct torture_context *tctx s.in.info = &u; s.in.level = 24; - encode_pw_buffer(u.info24.password.data, newpass, STR_UNICODE); u.info24.password_expired = 0; status = dcerpc_fetch_session_key(p, &session_key); @@ -647,7 +648,12 @@ static bool test_SetUserPass(struct dcerpc_pipe *p, struct torture_context *tctx return false; } - arcfour_crypt_blob(u.info24.password.data, 516, &session_key); + status = init_samr_CryptPassword(newpass, + &session_key, + &u.info24.password); + torture_assert_ntstatus_ok(tctx, + status, + "init_samr_CryptPassword failed"); torture_comment(tctx, "Testing SetUserInfo level 24 (set password)\n"); -- 2.23.0