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