summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/samba3rpc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-16 07:20:37 +0100
committerGünther Deschner <gd@samba.org>2015-07-07 14:05:28 +0200
commite0bb97fde61bf3577651a8624bc1014561087d31 (patch)
tree1665b2b3f69586a30d5451eab4b45437c43c789a /source4/torture/rpc/samba3rpc.c
parent810d630bd5120f12540ce9ab09e106c41a028347 (diff)
downloadsamba-e0bb97fde61bf3577651a8624bc1014561087d31.tar.gz
s4:torture/samba3rpc: use pipe_bind_smb_auth()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4/torture/rpc/samba3rpc.c')
-rw-r--r--source4/torture/rpc/samba3rpc.c98
1 files changed, 32 insertions, 66 deletions
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index 83cee633db4..ade4a404636 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -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,29 +492,21 @@ 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 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");
+ 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 */
- torture_assert_ntstatus_ok(tctx,
- dcerpc_bind_auth_none(samr_pipe, &ndr_table_samr),
- "dcerpc_bind_auth_none failed");
+ 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;
conn.in.system_name = talloc_asprintf(
mem_ctx, "\\\\%s", dcerpc_server_name(samr_pipe));
@@ -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 0
- net_pipe->conn->flags |= DCERPC_DEBUG_PRINT_IN |
- DCERPC_DEBUG_PRINT_OUT;
-#endif
#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);
- 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);
+ 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 (!NT_STATUS_IS_OK(status)) {
- torture_comment(tctx, "schannel bind failed: %s\n", nt_errstr(status));
- goto done;
- }
+#if 0
+ net_pipe->conn->flags |= DCERPC_DEBUG_PRINT_IN |
+ DCERPC_DEBUG_PRINT_OUT;
+#endif
+ net_handle = net_pipe->binding_handle;
for (i=2; i<4; i++) {