mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s4:torture/samba3rpc: use pipe_bind_smb_auth()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
parent
810d630bd5
commit
e0bb97fde6
@ -337,28 +337,13 @@ static bool bindtest(struct torture_context *tctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
lsa_pipe = dcerpc_pipe_init(mem_ctx, tctx->ev);
|
||||
if (lsa_pipe == NULL) {
|
||||
torture_comment(tctx, "dcerpc_pipe_init failed\n");
|
||||
goto done;
|
||||
}
|
||||
status = pipe_bind_smb_auth(tctx, mem_ctx, cli->tree,
|
||||
credentials, auth_type, auth_level,
|
||||
"\\lsarpc", &ndr_table_lsarpc, &lsa_pipe);
|
||||
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
|
||||
"pipe_bind_smb_auth failed");
|
||||
lsa_handle = lsa_pipe->binding_handle;
|
||||
|
||||
status = dcerpc_pipe_open_smb(lsa_pipe, cli->tree, "\\lsarpc");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
torture_comment(tctx, "dcerpc_pipe_open_smb failed: %s\n",
|
||||
nt_errstr(status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = dcerpc_bind_auth(lsa_pipe, &ndr_table_lsarpc,
|
||||
credentials, lpcfg_gensec_settings(tctx->lp_ctx, tctx->lp_ctx), auth_type, auth_level,
|
||||
NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
torture_comment(tctx, "dcerpc_bind_auth failed: %s\n", nt_errstr(status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
openpolicy.in.system_name =talloc_asprintf(
|
||||
mem_ctx, "\\\\%s", dcerpc_server_name(lsa_pipe));
|
||||
ZERO_STRUCT(objectattr);
|
||||
@ -507,30 +492,22 @@ static bool get_usr_handle(struct torture_context *tctx,
|
||||
struct samr_CreateUser2 c;
|
||||
uint32_t user_rid,access_granted;
|
||||
|
||||
samr_pipe = dcerpc_pipe_init(mem_ctx, tctx->ev);
|
||||
torture_assert(tctx, samr_pipe, "dcerpc_pipe_init failed");
|
||||
if (admin_creds != NULL) {
|
||||
status = pipe_bind_smb_auth(tctx, mem_ctx, cli->tree,
|
||||
admin_creds, auth_type, auth_level,
|
||||
"\\samr", &ndr_table_samr, &samr_pipe);
|
||||
torture_assert_ntstatus_ok(tctx, status, "pipe_bind_smb_auth failed");
|
||||
} else {
|
||||
/* We must have an authenticated SMB connection */
|
||||
status = pipe_bind_smb(tctx, mem_ctx, cli->tree,
|
||||
"\\samr", &ndr_table_samr, &samr_pipe);
|
||||
torture_assert_ntstatus_ok(tctx, status, "pipe_bind_smb_auth failed");
|
||||
}
|
||||
#if 0
|
||||
samr_pipe->conn->flags |= DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT;
|
||||
#endif
|
||||
samr_handle = samr_pipe->binding_handle;
|
||||
|
||||
torture_assert_ntstatus_ok(tctx,
|
||||
dcerpc_pipe_open_smb(samr_pipe, cli->tree, "\\samr"),
|
||||
"dcerpc_pipe_open_smb failed");
|
||||
|
||||
if (admin_creds != NULL) {
|
||||
torture_assert_ntstatus_ok(tctx,
|
||||
dcerpc_bind_auth(samr_pipe, &ndr_table_samr,
|
||||
admin_creds, lpcfg_gensec_settings(tctx->lp_ctx, tctx->lp_ctx), auth_type, auth_level,
|
||||
NULL),
|
||||
"dcerpc_bind_auth failed");
|
||||
} else {
|
||||
/* We must have an authenticated SMB connection */
|
||||
torture_assert_ntstatus_ok(tctx,
|
||||
dcerpc_bind_auth_none(samr_pipe, &ndr_table_samr),
|
||||
"dcerpc_bind_auth_none failed");
|
||||
}
|
||||
|
||||
conn.in.system_name = talloc_asprintf(
|
||||
mem_ctx, "\\\\%s", dcerpc_server_name(samr_pipe));
|
||||
conn.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
|
||||
@ -1165,37 +1142,26 @@ static bool schan(struct torture_context *tctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
net_pipe = dcerpc_pipe_init(mem_ctx, tctx->ev);
|
||||
if (net_pipe == NULL) {
|
||||
torture_comment(tctx, "dcerpc_pipe_init failed\n");
|
||||
goto done;
|
||||
}
|
||||
net_handle = net_pipe->binding_handle;
|
||||
|
||||
status = dcerpc_pipe_open_smb(net_pipe, cli->tree, "\\netlogon");
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
torture_comment(tctx, "dcerpc_pipe_open_smb failed: %s\n",
|
||||
nt_errstr(status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
#if 1
|
||||
status = pipe_bind_smb_auth(tctx, mem_ctx, cli->tree,
|
||||
wks_creds,
|
||||
DCERPC_AUTH_TYPE_SCHANNEL,
|
||||
DCERPC_AUTH_LEVEL_PRIVACY,
|
||||
"\\netlogon", &ndr_table_netlogon, &net_pipe);
|
||||
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
|
||||
"pipe_bind_smb_auth failed");
|
||||
net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
|
||||
#else
|
||||
status = pipe_bind_smb(tctx, mem_ctx, cli->tree,
|
||||
"\\netlogon", &ndr_table_netlogon, &net_pipe);
|
||||
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
|
||||
"pipe_bind_smb failed");
|
||||
#endif
|
||||
#if 0
|
||||
net_pipe->conn->flags |= DCERPC_DEBUG_PRINT_IN |
|
||||
DCERPC_DEBUG_PRINT_OUT;
|
||||
#endif
|
||||
#if 1
|
||||
net_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
|
||||
status = dcerpc_bind_auth(net_pipe, &ndr_table_netlogon,
|
||||
wks_creds, lpcfg_gensec_settings(tctx->lp_ctx, tctx->lp_ctx), DCERPC_AUTH_TYPE_SCHANNEL,
|
||||
DCERPC_AUTH_LEVEL_PRIVACY,
|
||||
NULL);
|
||||
#else
|
||||
status = dcerpc_bind_auth_none(net_pipe, &ndr_table_netlogon);
|
||||
#endif
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
torture_comment(tctx, "schannel bind failed: %s\n", nt_errstr(status));
|
||||
goto done;
|
||||
}
|
||||
net_handle = net_pipe->binding_handle;
|
||||
|
||||
|
||||
for (i=2; i<4; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user