|
|
b6b438 |
From 2f7cd9ededefa6499f4fad15758fec27a15a5de3 Mon Sep 17 00:00:00 2001
|
|
|
b6b438 |
From: Andreas Schneider <asn@samba.org>
|
|
|
b6b438 |
Date: Wed, 24 Jul 2019 15:57:25 +0200
|
|
|
b6b438 |
Subject: [PATCH 041/187] s4:torture: Use init_samr_CryptPassword in
|
|
|
b6b438 |
test_SetUserPass_23
|
|
|
b6b438 |
|
|
|
b6b438 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
b6b438 |
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
|
|
|
b6b438 |
(cherry picked from commit b0b9cabc4de64497140d33d0fdaf2927f2915987)
|
|
|
b6b438 |
---
|
|
|
b6b438 |
source4/torture/rpc/samr.c | 24 +++++++++++++++++-------
|
|
|
b6b438 |
1 file changed, 17 insertions(+), 7 deletions(-)
|
|
|
b6b438 |
|
|
|
b6b438 |
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
|
|
|
b6b438 |
index f281be654cc..543ef64e9ac 100644
|
|
|
b6b438 |
--- a/source4/torture/rpc/samr.c
|
|
|
b6b438 |
+++ b/source4/torture/rpc/samr.c
|
|
|
b6b438 |
@@ -706,8 +706,6 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
|
|
|
b6b438 |
|
|
|
b6b438 |
u.info23.info.fields_present = fields_present;
|
|
|
b6b438 |
|
|
|
b6b438 |
- encode_pw_buffer(u.info23.password.data, newpass, STR_UNICODE);
|
|
|
b6b438 |
-
|
|
|
b6b438 |
status = dcerpc_fetch_session_key(p, &session_key);
|
|
|
b6b438 |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
b6b438 |
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
|
|
|
b6b438 |
@@ -715,7 +713,12 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
|
|
|
b6b438 |
return false;
|
|
|
b6b438 |
}
|
|
|
b6b438 |
|
|
|
b6b438 |
- arcfour_crypt_blob(u.info23.password.data, 516, &session_key);
|
|
|
b6b438 |
+ status = init_samr_CryptPassword(newpass,
|
|
|
b6b438 |
+ &session_key,
|
|
|
b6b438 |
+ &u.info23.password);
|
|
|
b6b438 |
+ torture_assert_ntstatus_ok(tctx,
|
|
|
b6b438 |
+ status,
|
|
|
b6b438 |
+ "init_samr_CryptPassword failed");
|
|
|
b6b438 |
|
|
|
b6b438 |
torture_comment(tctx, "Testing SetUserInfo level 23 (set password)\n");
|
|
|
b6b438 |
|
|
|
b6b438 |
@@ -732,8 +735,6 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
|
|
|
b6b438 |
*password = newpass;
|
|
|
b6b438 |
}
|
|
|
b6b438 |
|
|
|
b6b438 |
- encode_pw_buffer(u.info23.password.data, newpass, STR_UNICODE);
|
|
|
b6b438 |
-
|
|
|
b6b438 |
status = dcerpc_fetch_session_key(p, &session_key);
|
|
|
b6b438 |
if (!NT_STATUS_IS_OK(status)) {
|
|
|
b6b438 |
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
|
|
|
b6b438 |
@@ -742,8 +743,17 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
|
|
|
b6b438 |
}
|
|
|
b6b438 |
|
|
|
b6b438 |
/* This should break the key nicely */
|
|
|
b6b438 |
- session_key.length--;
|
|
|
b6b438 |
- arcfour_crypt_blob(u.info23.password.data, 516, &session_key);
|
|
|
b6b438 |
+ session_key.data[0]++;
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ status = init_samr_CryptPassword(newpass,
|
|
|
b6b438 |
+ &session_key,
|
|
|
b6b438 |
+ &u.info23.password);
|
|
|
b6b438 |
+ torture_assert_ntstatus_ok(tctx,
|
|
|
b6b438 |
+ status,
|
|
|
b6b438 |
+ "init_samr_CryptPassword failed");
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ /* Reset the session key */
|
|
|
b6b438 |
+ session_key.data[0]--;
|
|
|
b6b438 |
|
|
|
b6b438 |
torture_comment(tctx, "Testing SetUserInfo level 23 (set password) with wrong password\n");
|
|
|
b6b438 |
|
|
|
b6b438 |
--
|
|
|
b6b438 |
2.23.0
|
|
|
b6b438 |
|