diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-09 08:34:05 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:34 -0500 |
commit | 6836f5d0b167027908da9a08b9b219520997b563 (patch) | |
tree | be9fcc45bd4cb753a7be128a4b9fed39666ed010 /source4/torture | |
parent | 3feb4423f3ec35dd3dfa2c358797a4f6a86b2fb5 (diff) | |
download | samba-6836f5d0b167027908da9a08b9b219520997b563.tar.gz samba-6836f5d0b167027908da9a08b9b219520997b563.tar.bz2 samba-6836f5d0b167027908da9a08b9b219520997b563.zip |
r4616: the first phase in the addition of proper support for
dcerpc_alter_context and multiple context_ids in the dcerpc client
library.
This stage does the following:
- split "struct dcerpc_pipe" into two parts, the main part being "struct dcerpc_connection", which
contains all the parts not dependent on the context, and "struct dcerpc_pipe" which has
the context dependent part. This is similar to the layering in libcli_*() for SMB
- disable the current dcerpc_alter code. I've used a #warning until i
get the 2nd phase finished. I don't know how portable #warning is, but
it won't be long before I add full alter context support anyway, so it won't last long
- cleanup the allocation of dcerpc_pipe structures. The previous code
was quite awkward.
(This used to be commit 4004c69937be7e5dae56f9567ca607f982d395d3)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/mgmt.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/samlogon.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/samsync.c | 5 | ||||
-rw-r--r-- | source4/torture/rpc/scanner.c | 4 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/spoolss.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/xplogin.c | 62 |
8 files changed, 41 insertions, 42 deletions
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c index 0353dd6189..1dea24517d 100644 --- a/source4/torture/rpc/mgmt.c +++ b/source4/torture/rpc/mgmt.c @@ -180,7 +180,7 @@ BOOL torture_rpc_mgmt(void) TALLOC_CTX *mem_ctx; BOOL ret = True; const char *binding = lp_parm_string(-1, "torture", "binding"); - struct dcerpc_interface_list *l; + const struct dcerpc_interface_list *l; struct dcerpc_binding b; mem_ctx = talloc_init("torture_rpc_mgmt"); @@ -196,7 +196,7 @@ BOOL torture_rpc_mgmt(void) return False; } - for (l=dcerpc_pipes;l;l=l->next) { + for (l=librpc_dcerpc_pipes();l;l=l->next) { /* some interfaces are not mappable */ if (l->table->num_calls == 0 || strcmp(l->table->name, "mgmt") == 0) { diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 774abbdf82..67e0bc9393 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -1110,7 +1110,7 @@ static BOOL test_ManyGetDCName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) int i; BOOL ret = True; - if (p->transport.transport != NCACN_NP) { + if (p->conn->transport.transport != NCACN_NP) { return True; } diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 56631a4a16..3e12054e03 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1261,7 +1261,7 @@ BOOL torture_rpc_samlogon(void) goto failed; } - status = dcerpc_schannel_creds(p->security_state.generic_state, mem_ctx, &creds); + status = dcerpc_schannel_creds(p->conn->security_state.generic_state, mem_ctx, &creds); if (!NT_STATUS_IS_OK(status)) { ret = False; goto failed; diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 4c47870015..4a71e90957 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -1313,7 +1313,7 @@ BOOL torture_rpc_samsync(void) goto failed; } - status = dcerpc_schannel_creds(samsync_state->p->security_state.generic_state, mem_ctx, &samsync_state->creds); + status = dcerpc_schannel_creds(samsync_state->p->conn->security_state.generic_state, mem_ctx, &samsync_state->creds); if (!NT_STATUS_IS_OK(status)) { ret = False; } @@ -1342,7 +1342,8 @@ BOOL torture_rpc_samsync(void) goto failed; } - status = dcerpc_schannel_creds(samsync_state->p_netlogon_wksta->security_state.generic_state, mem_ctx, &samsync_state->creds_netlogon_wksta); + status = dcerpc_schannel_creds(samsync_state->p_netlogon_wksta->conn->security_state.generic_state, + mem_ctx, &samsync_state->creds_netlogon_wksta); if (!NT_STATUS_IS_OK(status)) { ret = False; } diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c index f9a4d337af..a0ebf9d642 100644 --- a/source4/torture/rpc/scanner.c +++ b/source4/torture/rpc/scanner.c @@ -134,7 +134,7 @@ BOOL torture_rpc_scanner(void) struct dcerpc_pipe *p; TALLOC_CTX *mem_ctx; BOOL ret = True; - struct dcerpc_interface_list *l; + const struct dcerpc_interface_list *l; const char *binding = lp_parm_string(-1, "torture", "binding"); struct dcerpc_binding b; @@ -151,7 +151,7 @@ BOOL torture_rpc_scanner(void) return False; } - for (l=dcerpc_pipes;l;l=l->next) { + for (l=librpc_dcerpc_pipes();l;l=l->next) { /* some interfaces are not mappable */ if (l->table->num_calls == 0 || strcmp(l->table->name, "mgmt") == 0) { diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index b220b9ff65..f791492e6d 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -184,7 +184,7 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx, goto failed; } - status = dcerpc_schannel_creds(p_netlogon->security_state.generic_state, mem_ctx, &creds); + status = dcerpc_schannel_creds(p_netlogon->conn->security_state.generic_state, mem_ctx, &creds); if (!NT_STATUS_IS_OK(status)) { goto failed; } diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index bfd03810c2..6f2edf9f47 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -649,7 +649,7 @@ static BOOL test_SecondaryClosePrinter(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct BOOL ret = True; /* only makes sense on SMB */ - if (p->transport.transport != NCACN_NP) { + if (p->conn->transport.transport != NCACN_NP) { return True; } diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c index c50a489e42..a60a73c195 100644 --- a/source4/torture/rpc/xplogin.c +++ b/source4/torture/rpc/xplogin.c @@ -180,14 +180,8 @@ static NTSTATUS anon_ipc(struct smbcli_transport *transport, return NT_STATUS_OK; } -static int close_pipe(void *ptr) -{ - struct dcerpc_pipe *p = ptr; - dcerpc_pipe_close(p); - return 0; -} - -static NTSTATUS connect_to_pipe(struct dcerpc_pipe **p, +static NTSTATUS connect_to_pipe(struct dcerpc_pipe **pp, + TALLOC_CTX *mem_ctx, struct smbcli_transport *transport, const char *pipe_name, const char *pipe_uuid, @@ -196,26 +190,30 @@ static NTSTATUS connect_to_pipe(struct dcerpc_pipe **p, const char *binding = lp_parm_string(-1, "torture", "binding"); struct dcerpc_binding b; NTSTATUS status; - TALLOC_CTX *mem_ctx; + struct dcerpc_pipe *p; + TALLOC_CTX *tmp_ctx; struct smbcli_tree *tree; - + if (!NT_STATUS_IS_OK(status = anon_ipc(transport, &tree))) return status; if (binding == NULL) return NT_STATUS_INVALID_PARAMETER; - mem_ctx = talloc_init("dcerpc_pipe_connect"); - if (!mem_ctx) return NT_STATUS_NO_MEMORY; + p = dcerpc_pipe_init(mem_ctx); + if (p == NULL) { + return NT_STATUS_NO_MEMORY; + } + tmp_ctx = talloc_new(p); - status = dcerpc_parse_binding(mem_ctx, binding, &b); + status = dcerpc_parse_binding(tmp_ctx, binding, &b); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse dcerpc binding '%s'\n", binding)); - talloc_destroy(mem_ctx); + talloc_free(p); return status; } - DEBUG(3,("Using binding %s\n", dcerpc_binding_string(mem_ctx, &b))); + DEBUG(3,("Using binding %s\n", dcerpc_binding_string(tmp_ctx, &b))); if (b.endpoint == NULL) { const struct dcerpc_interface_table *table = @@ -226,14 +224,14 @@ static NTSTATUS connect_to_pipe(struct dcerpc_pipe **p, if (!table) { DEBUG(0,("Unknown interface endpoint '%s'\n", pipe_uuid)); - talloc_destroy(mem_ctx); + talloc_free(tmp_ctx); return NT_STATUS_INVALID_PARAMETER; } /* Find one of the default pipes for this interface */ for (i = 0; i < table->endpoints->count; i++) { const char * const *names = table->endpoints->names; - status = dcerpc_parse_binding(mem_ctx, names[i], + status = dcerpc_parse_binding(tmp_ctx, names[i], &default_binding); if (NT_STATUS_IS_OK(status) && @@ -248,23 +246,23 @@ static NTSTATUS connect_to_pipe(struct dcerpc_pipe **p, if (!strncasecmp(pipe_name, "/pipe/", 6) || !strncasecmp(pipe_name, "\\pipe\\", 6)) { - pipe_name+=6; + pipe_name += 6; } if (pipe_name[0] != '\\') { pipe_name = talloc_asprintf(mem_ctx, "\\%s", pipe_name); } - status = dcerpc_pipe_open_smb(p, tree, pipe_name); + status = dcerpc_pipe_open_smb(p->conn, tree, pipe_name); - if (!NT_STATUS_IS_OK(status)) + if (!NT_STATUS_IS_OK(status)) { + talloc_free(p); return status; + } - talloc_destroy(mem_ctx); + talloc_free(tmp_ctx); + (*pp) = p; - talloc_set_destructor(*p, close_pipe); - talloc_steal(*p, tree); - return NT_STATUS_OK; } @@ -284,7 +282,7 @@ static NTSTATUS test_enumtrusts(struct smbcli_transport *transport) if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(&p, transport, DCERPC_LSARPC_NAME, + status = connect_to_pipe(&p, mem_ctx, transport, DCERPC_LSARPC_NAME, DCERPC_LSARPC_UUID, DCERPC_LSARPC_VERSION); @@ -355,7 +353,7 @@ static NTSTATUS test_lookupnames(struct smbcli_transport *transport, if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(&p, transport, DCERPC_LSARPC_NAME, + status = connect_to_pipe(&p, mem_ctx, transport, DCERPC_LSARPC_NAME, DCERPC_LSARPC_UUID, DCERPC_LSARPC_VERSION); @@ -462,7 +460,7 @@ static NTSTATUS setup_netlogon_creds(struct smbcli_transport *transport, if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(p, transport, DCERPC_NETLOGON_NAME, + status = connect_to_pipe(p, mem_ctx, transport, DCERPC_NETLOGON_NAME, DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION); @@ -621,7 +619,7 @@ static NTSTATUS test_getgroups(struct smbcli_transport *transport, if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(&p, transport, DCERPC_SAMR_NAME, + status = connect_to_pipe(&p, mem_ctx, transport, DCERPC_SAMR_NAME, DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION); @@ -785,7 +783,7 @@ static NTSTATUS test_getallsids(struct smbcli_transport *transport, if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(&p, transport, DCERPC_SAMR_NAME, + status = connect_to_pipe(&p, mem_ctx, transport, DCERPC_SAMR_NAME, DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION); @@ -984,7 +982,7 @@ static NTSTATUS test_remoteTOD(struct smbcli_transport *transport) if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - status = connect_to_pipe(&p, transport, DCERPC_SRVSVC_NAME, + status = connect_to_pipe(&p, mem_ctx, transport, DCERPC_SRVSVC_NAME, DCERPC_SRVSVC_UUID, DCERPC_SRVSVC_VERSION); @@ -1054,14 +1052,14 @@ static BOOL xp_login(const char *dcname, const char *wksname, return False; status = connect_to_pipe(&netlogon_schannel_pipe, - transport, DCERPC_NETLOGON_NAME, + mem_ctx, transport, DCERPC_NETLOGON_NAME, DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION); if (!NT_STATUS_IS_OK(status)) return False; - netlogon_schannel_pipe->flags |= DCERPC_SEAL; + netlogon_schannel_pipe->conn->flags |= DCERPC_SEAL; status = dcerpc_bind_auth_schannel_withkey(netlogon_schannel_pipe, DCERPC_NETLOGON_UUID, |