summaryrefslogtreecommitdiff
path: root/source4/lib/dcom/common
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-09 11:32:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:34 -0500
commite74b3ed6f195e66cb5fa0f387cea0f59fb66711b (patch)
tree0e57da2f311045035ff0f6d63a4d016fecb3adc1 /source4/lib/dcom/common
parentab9ca559269f9ef921eb3e6ec3007d2e249c6cfe (diff)
downloadsamba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.tar.gz
samba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.tar.bz2
samba-e74b3ed6f195e66cb5fa0f387cea0f59fb66711b.zip
r4618: - tidied up the alter_context client code a bit
- there is no alter_nak or alter_ack packet, its all done in an alter_response - auto-allocated the contex_ids - tried to fix up the dcom code to work again with alter_context. Jelmer, please take a look :) (This used to be commit dd1c54add8884376601f2f8a56c01bfb8add030c)
Diffstat (limited to 'source4/lib/dcom/common')
-rw-r--r--source4/lib/dcom/common/main.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/source4/lib/dcom/common/main.c b/source4/lib/dcom/common/main.c
index 02e1dea139..b9f6127c6c 100644
--- a/source4/lib/dcom/common/main.c
+++ b/source4/lib/dcom/common/main.c
@@ -341,41 +341,54 @@ WERROR dcom_get_class_object(struct dcom_context *ctx, struct GUID *clsid, const
return WERR_OK;
}
-NTSTATUS dcom_get_pipe (struct dcom_interface_p *iface, struct dcerpc_pipe **p)
+NTSTATUS dcom_get_pipe (struct dcom_interface_p *iface, struct dcerpc_pipe **pp)
{
struct dcerpc_binding binding;
struct GUID iid;
HYPER_T oxid;
NTSTATUS status;
int i;
+ struct dcerpc_pipe *p;
+ TALLOC_CTX *tmp_ctx;
+ const char *uuid;
+
+ tmp_ctx = talloc_new(NULL);
- *p = NULL;
+ p = iface->ox->pipe;
oxid = iface->ox->oxid;
iid = iface->interface->iid;
-#warning "dcerpc_alter needed"
-#if 0
- if (iface->ox->pipe) {
- if (!GUID_equal(&iface->ox->pipe->syntax.uuid, &iid)) {
+ uuid = GUID_string(tmp_ctx, &iid);
+
+ if (p) {
+ if (!GUID_equal(&p->syntax.uuid, &iid)) {
+ struct dcerpc_pipe *p2;
iface->ox->pipe->syntax.uuid = iid;
- status = dcerpc_alter(iface->ox->pipe, iface->ctx);
- if (NT_STATUS_IS_ERR(status)) {
- return status;
+ status = dcerpc_secondary_context(p, &p2, uuid, 0);
+ if (NT_STATUS_IS_OK(status)) {
+ p = p2;
}
+ } else {
+ p = talloc_reference(NULL, p);
}
- *p = iface->ox->pipe;
- return NT_STATUS_OK;
+ *pp = p;
+ talloc_free(tmp_ctx);
+ return status;
}
-#endif
+
i = 0;
do {
- status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, iface->ox->bindings.stringbindings[i]);
- if (NT_STATUS_IS_ERR(status)) {
+ status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding,
+ iface->ox->bindings.stringbindings[i]);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Error parsing string binding"));
} else {
binding.flags = iface->ctx->dcerpc_flags;
- status = dcerpc_pipe_connect_b(&iface->ox->pipe, &binding, GUID_string(iface->ctx, &iid) , 0.0, iface->ctx->domain, iface->ctx->user, iface->ctx->password);
+ status = dcerpc_pipe_connect_b(&p, &binding,
+ uuid, 0.0,
+ iface->ctx->domain, iface->ctx->user,
+ iface->ctx->password);
}
i++;
@@ -383,12 +396,15 @@ NTSTATUS dcom_get_pipe (struct dcom_interface_p *iface, struct dcerpc_pipe **p)
if (NT_STATUS_IS_ERR(status)) {
DEBUG(0, ("Unable to connect to remote host - %s\n", nt_errstr(status)));
+ talloc_free(tmp_ctx);
return status;
}
DEBUG(2, ("Successfully connected to OXID %llx\n", oxid));
- *p = iface->ox->pipe;
+ *pp = p;
+ talloc_free(tmp_ctx);
+
return NT_STATUS_OK;
}