]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Use init_samr_CryptPassword in test_ChangePasswordUser2
authorAndrew Bartlett <abartlet@samba.org>
Thu, 25 Jul 2019 04:46:06 +0000 (16:46 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Jul 2019 01:48:25 +0000 (01:48 +0000)
This allows the use of GnuTLS for the RC4 crypto operation

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/rpc/samr.c

index eb032905dc84acc69c34f3372293a5f1c5fdf1a1..6cc508a2d44ea0f74aa009f996d704616827f706 100644 (file)
@@ -2259,11 +2259,13 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
        struct dcerpc_binding_handle *b = p->binding_handle;
        uint8_t old_nt_hash[16], new_nt_hash[16];
        uint8_t old_lm_hash[16], new_lm_hash[16];
-
+       DATA_BLOB old_nt_hash_blob
+               = data_blob_const(old_nt_hash, sizeof(old_nt_hash));
        struct samr_GetDomPwInfo dom_pw_info;
        struct samr_PwInfo info;
 
        struct lsa_String domain_name;
+       NTSTATUS status;
 
        domain_name.string = "";
        dom_pw_info.in.domain_name = &domain_name;
@@ -2299,8 +2301,13 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
        arcfour_crypt(lm_pass.data, old_lm_hash, 516);
        E_old_pw_hash(new_nt_hash, old_lm_hash, lm_verifier.hash);
 
-       encode_pw_buffer(nt_pass.data, newpass, STR_UNICODE);
-       arcfour_crypt(nt_pass.data, old_nt_hash, 516);
+       status = init_samr_CryptPassword(newpass,
+                                        &old_nt_hash_blob,
+                                        &nt_pass);
+       torture_assert_ntstatus_ok(tctx,
+                                  status,
+                                  "init_samr_CryptPassword failed");
+
        E_old_pw_hash(new_nt_hash, old_nt_hash, nt_verifier.hash);
 
        r.in.server = &server;