65 lines
2.0 KiB
Diff
65 lines
2.0 KiB
Diff
From 7839408010ba413f766e950192dd5a0632234ce7 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@samba.org>
|
|
Date: Wed, 20 Feb 2019 15:52:49 +0100
|
|
Subject: [PATCH 038/187] s4:torture: Use GnuTLS RC4 for RAP SAM test
|
|
|
|
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031
|
|
|
|
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
|
|
(cherry picked from commit 811c412da5c24d7274f9aa4c7d653bbb1191e6a6)
|
|
---
|
|
source4/torture/rap/sam.c | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/source4/torture/rap/sam.c b/source4/torture/rap/sam.c
|
|
index 4ca7b793dec..3c13849b398 100644
|
|
--- a/source4/torture/rap/sam.c
|
|
+++ b/source4/torture/rap/sam.c
|
|
@@ -26,10 +26,12 @@
|
|
#include "torture/util.h"
|
|
#include "libcli/rap/rap.h"
|
|
#include "torture/rap/proto.h"
|
|
-#include "../lib/crypto/crypto.h"
|
|
#include "../libcli/auth/libcli_auth.h"
|
|
#include "torture/rpc/torture_rpc.h"
|
|
|
|
+#include <gnutls/gnutls.h>
|
|
+#include <gnutls/crypto.h>
|
|
+
|
|
#define TEST_RAP_USER "torture_rap_user"
|
|
|
|
static char *samr_rand_pass(TALLOC_CTX *mem_ctx, int min_len)
|
|
@@ -137,6 +139,11 @@ static bool test_oemchangepassword_args(struct torture_context *tctx,
|
|
char *newpass = samr_rand_pass(tctx, 9);
|
|
uint8_t old_pw_hash[16];
|
|
uint8_t new_pw_hash[16];
|
|
+ gnutls_cipher_hd_t cipher_hnd = NULL;
|
|
+ gnutls_datum_t pw_key = {
|
|
+ .data = old_pw_hash,
|
|
+ .size = sizeof(old_pw_hash),
|
|
+ };
|
|
|
|
r.in.UserName = username;
|
|
|
|
@@ -144,7 +151,15 @@ static bool test_oemchangepassword_args(struct torture_context *tctx,
|
|
E_deshash(newpass, new_pw_hash);
|
|
|
|
encode_pw_buffer(r.in.crypt_password, newpass, STR_ASCII);
|
|
- arcfour_crypt(r.in.crypt_password, old_pw_hash, 516);
|
|
+
|
|
+ gnutls_cipher_init(&cipher_hnd,
|
|
+ GNUTLS_CIPHER_ARCFOUR_128,
|
|
+ &pw_key,
|
|
+ NULL);
|
|
+ gnutls_cipher_encrypt(cipher_hnd,
|
|
+ r.in.crypt_password,
|
|
+ 516);
|
|
+ gnutls_cipher_deinit(cipher_hnd);
|
|
E_old_pw_hash(new_pw_hash, old_pw_hash, r.in.password_hash);
|
|
|
|
torture_comment(tctx, "Testing rap_NetOEMChangePassword(%s)\n", r.in.UserName);
|
|
--
|
|
2.23.0
|
|
|