1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

s4:torture/rpc: make use of dcerpc_binding_handle_transport_session_key()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-09-14 14:31:58 +02:00 committed by Ralph Boehme
parent 57905603e0
commit 4ccd2dd8a2
9 changed files with 43 additions and 32 deletions

View File

@ -1842,8 +1842,9 @@ static bool test_ServerWrap_encrypt_decrypt_manual(struct torture_context *tctx,
preferred_key.data = r_query_secret.out.new_val->buf->data;
preferred_key.length = r_query_secret.out.new_val->buf->size;
torture_assert_ntstatus_ok(tctx, dcerpc_fetch_session_key(lsa_p, &session_key),
"dcerpc_fetch_session_key failed");
torture_assert_ntstatus_ok(tctx,
dcerpc_binding_handle_transport_session_key(lsa_b, tctx, &session_key),
"transport_session_key failed");
torture_assert_ntstatus_ok(tctx,
sess_decrypt_blob(tctx,

View File

@ -813,6 +813,7 @@ static bool test_setup_trust(struct torture_context *tctx,
DATA_BLOB *auth_blob)
{
struct dcerpc_binding_handle *b = p->binding_handle;
DATA_BLOB session_key;
struct lsa_TrustDomainInfoAuthInfoInternal authinfo;
NTSTATUS status;
@ -826,9 +827,9 @@ static bool test_setup_trust(struct torture_context *tctx,
return false;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, p, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed - %s\n",
torture_comment(tctx, "transport_session_key failed - %s\n",
nt_errstr(status));
return false;
}

View File

@ -1730,8 +1730,9 @@ static bool test_CreateSecret(struct dcerpc_pipe *p,
torture_assert_ntstatus_ok(tctx, r2.out.result,
"OpenSecret failed");
torture_assert_ntstatus_ok(tctx, dcerpc_fetch_session_key(p, &session_key),
"dcerpc_fetch_session_key failed");
torture_assert_ntstatus_ok(tctx,
dcerpc_binding_handle_transport_session_key(b, tctx, &session_key),
"transport_session_key failed");
enc_key = sess_encrypt_string(secret1, &session_key);
@ -4655,9 +4656,9 @@ static bool test_CreateTrustedDomainEx_common(struct dcerpc_pipe *p,
domsid = talloc_array(tctx, struct dom_sid *, num_trusts);
trustdom_handle = talloc_array(tctx, struct policy_handle, num_trusts);
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed - %s\n", nt_errstr(status));
torture_comment(tctx, "transport_session_key failed - %s\n", nt_errstr(status));
return false;
}

View File

@ -668,9 +668,11 @@ static bool create_user(struct torture_context *tctx,
encode_pw_buffer(u_info.info23.password.data, password,
STR_UNICODE);
status = dcerpc_fetch_session_key(samr_pipe, &session_key);
status = dcerpc_binding_handle_transport_session_key(samr_handle,
tctx,
&session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed\n");
torture_comment(tctx, "transport_session_key failed\n");
goto done;
}
@ -890,9 +892,11 @@ static bool join3(struct torture_context *tctx,
i21->password_expired = 1;
*/
status = dcerpc_fetch_session_key(samr_pipe, &session_key);
status = dcerpc_binding_handle_transport_session_key(samr_handle,
tctx,
&session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed: %s\n",
torture_comment(tctx, "transport_session_key failed: %s\n",
nt_errstr(status));
goto done;
}
@ -928,9 +932,11 @@ static bool join3(struct torture_context *tctx,
/* just to make this test pass */
u_info.info24.password_expired = 1;
status = dcerpc_fetch_session_key(samr_pipe, &session_key);
status = dcerpc_binding_handle_transport_session_key(samr_handle,
tctx,
&session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed\n");
torture_comment(tctx, "transport_session_key failed\n");
goto done;
}

View File

@ -645,7 +645,7 @@ static bool test_SetUserPass(struct dcerpc_pipe *p, struct torture_context *tctx
u.info24.password_expired = 0;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -710,7 +710,7 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
u.info23.info.fields_present = fields_present;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -739,7 +739,7 @@ static bool test_SetUserPass_23(struct dcerpc_pipe *p, struct torture_context *t
*password = newpass;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -813,7 +813,7 @@ static bool test_SetUserPass_32(struct dcerpc_pipe *p, struct torture_context *t
u.info32.info.fields_present = fields_present;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx,
TORTURE_FAIL,
@ -938,7 +938,7 @@ static bool test_SetUserPass_31(struct dcerpc_pipe *p, struct torture_context *t
u.info31.password_expired = 0;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -1040,7 +1040,7 @@ static bool test_SetUserPassEx(struct dcerpc_pipe *p, struct torture_context *tc
u.info26.password_expired = 0;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -1133,7 +1133,7 @@ static bool test_SetUserPass_25(struct dcerpc_pipe *p, struct torture_context *t
u.info25.info.fields_present = fields_present;
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -1228,7 +1228,7 @@ static bool test_SetUserPass_18(struct dcerpc_pipe *p, struct torture_context *t
E_md4hash(newpass, nt_hash);
E_deshash(newpass, lm_hash);
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -1316,7 +1316,7 @@ static bool test_SetUserPass_21(struct dcerpc_pipe *p, struct torture_context *t
u.info21.nt_password_set = true;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -1506,7 +1506,7 @@ static bool test_SetUserPass_level_ex(struct dcerpc_pipe *p,
break;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));
@ -3218,7 +3218,7 @@ bool test_ChangePasswordRandomBytes(struct dcerpc_pipe *p, struct torture_contex
pw_data = data_blob_const(u.info25.password.data, 516);
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_result(tctx, TORTURE_FAIL, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));

View File

@ -933,9 +933,11 @@ static bool samsync_handle_secret(struct torture_context *tctx,
We would like to do this, but it is NOT_SUPPORTED on win2k3
TEST_SEC_DESC_EQUAL(secret->sdbuf, lsa, &sec_handle);
*/
status = dcerpc_fetch_session_key(samsync_state->p_lsa, &session_key);
status = dcerpc_binding_handle_transport_session_key(samsync_state->b_lsa,
mem_ctx,
&session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "dcerpc_fetch_session_key failed - %s\n", nt_errstr(status));
torture_comment(tctx, "transport_session_key failed - %s\n", nt_errstr(status));
return false;
}

View File

@ -66,8 +66,8 @@ static bool test_CreateSecret_basic(struct dcerpc_pipe *p,
"CreateSecret failed");
torture_assert_ntstatus_ok(tctx, r.out.result, "CreateSecret failed");
status = dcerpc_fetch_session_key(p, &session_key);
torture_assert_ntstatus_ok(tctx, status, "dcerpc_fetch_session_key failed");
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
torture_assert_ntstatus_ok(tctx, status, "transport_session_key failed");
enc_key = sess_encrypt_string(secret1, &session_key);

View File

@ -332,7 +332,7 @@ again:
u.info24.password_expired = 0;
status = dcerpc_fetch_session_key(join->p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(tctx, "SetUserInfo level %u - no session key - %s\n",
s.in.level, nt_errstr(status));

View File

@ -1236,7 +1236,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
return false;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
@ -1324,7 +1324,7 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
return false;
}
status = dcerpc_fetch_session_key(p, &session_key);
status = dcerpc_binding_handle_transport_session_key(b, tctx, &session_key);
if (!NT_STATUS_IS_OK(status)) {
return false;
}