#include "librpc/gen_ndr/ndr_remact_c.h"
#include "librpc/gen_ndr/com_dcom.h"
#include "librpc/gen_ndr/dcom.h"
+#include "librpc/rpc/dcerpc.h"
#include "lib/com/dcom/dcom.h"
#include "librpc/ndr/ndr_table.h"
#include "lib/util/dlinklist.h"
DLIST_ADD(ctx->dcom->credentials, c);
}
-void dcom_update_credentials_for_aliases(struct com_context *ctx, const char *server, struct DUALSTRINGARRAY *pds)
+void dcom_update_credentials_for_aliases(struct com_context *ctx,
+ const char *server,
+ struct DUALSTRINGARRAY *pds)
{
struct cli_credentials *cc;
struct dcerpc_binding *b;
cc = dcom_get_server_credentials(ctx, server);
for (i = 0; pds->stringbindings[i]; ++i) {
- if (pds->stringbindings[i]->wTowerId != EPM_PROTOCOL_TCP) continue;
+ if (pds->stringbindings[i]->wTowerId != EPM_PROTOCOL_TCP)
+ continue;
status = dcerpc_binding_from_STRINGBINDING(ctx, &b, pds->stringbindings[i]);
- if (!NT_STATUS_IS_OK(status)) continue;
- dcom_set_server_credentials(ctx, b->host, cc);
+ if (!NT_STATUS_IS_OK(status))
+ continue;
+ dcom_add_server_credentials(ctx, b->host, cc);
talloc_free(b);
}
}
cli_credentials_set_conf(credentials, ctx->lp_ctx);
cli_credentials_parse_string(credentials, "%", CRED_SPECIFIED);
}
- dcom_set_server_credentials(ctx, NULL, credentials);
+ dcom_add_server_credentials(ctx, NULL, credentials);
return ctx->dcom;
}
-static NTSTATUS dcom_connect_host(struct com_context *ctx, struct dcerpc_pipe **p, const char *server)
+static NTSTATUS dcom_connect_host(struct com_context *ctx,
+ struct dcerpc_pipe **p, const char *server)
{
struct dcerpc_binding *bd;
const char * available_transports[] = { "ncacn_ip_tcp", "ncacn_np" };
loc_ctx = talloc_new(ctx);
/* Allow server name to contain a binding string */
- if (strchr(server, ':') && NT_STATUS_IS_OK(dcerpc_parse_binding(loc_ctx, server, &bd))) {
+ if (strchr(server, ':') &&
+ NT_STATUS_IS_OK(dcerpc_parse_binding(loc_ctx, server, &bd))) {
if (DEBUGLVL(11))
bd->flags |= DCERPC_DEBUG_PRINT_BOTH;
status = dcerpc_pipe_connect_b(ctx->event_ctx, p, bd,
if (!binding) {
status = NT_STATUS_NO_MEMORY;
goto end;
- };
- status = dcerpc_pipe_connect(ctx->event_ctx, p, binding, &ndr_table_IRemoteActivation,
- dcom_get_server_credentials(ctx, server), ctx->event_ctx, ctx->lp_ctx);
+ }
+ status = dcerpc_pipe_connect(ctx->event_ctx, p, binding,
+ &ndr_table_IRemoteActivation,
+ dcom_get_server_credentials(ctx, server),
+ ctx->event_ctx, ctx->lp_ctx);
if (NT_STATUS_IS_OK(status)) {
if (DEBUGLVL(11))
return status;
}
-struct dcom_object_exporter *object_exporter_by_oxid(struct com_context *ctx, uint64_t oxid)
+struct dcom_object_exporter *object_exporter_by_oxid(struct com_context *ctx,
+ uint64_t oxid)
{
struct dcom_object_exporter *ox;
for (ox = ctx->dcom->object_exporters; ox; ox = ox->next) {
return NT_STATUS_OK;
}
-NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p)
+NTSTATUS dcom_OBJREF_from_IUnknown(TALLLOC_CTX *mem_ctx, struct OBJREF *o, struct IUnknown *p)
{
/* FIXME: Cache generated objref objects? */
ZERO_STRUCTP(o);
marshal = dcom_marshal_by_clsid(&o->u_objref.u_custom.clsid);
if (marshal) {
- return marshal(p, o);
+ return marshal(mem_ctx, p, o);
} else {
return NT_STATUS_NOT_SUPPORTED;
}
return NT_STATUS_OK;
}
-NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o)
+enum ndr_err_code dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o)
{
struct IUnknown *p;
struct dcom_object_exporter *ox;
+ unmarshal_fn unmarshal;
switch(o->flags) {
case OBJREF_NULL:
*_p = NULL;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
case OBJREF_STANDARD:
p = talloc_zero(ctx, struct IUnknown);
if (!p->vtable) {
DEBUG(0, ("Unable to find proxy class for interface with IID %s\n", GUID_string(ctx, &o->iid)));
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_INVALID_POINTER;
}
p->vtable->Release_send = dcom_release_send;
ox = object_exporter_by_oxid(ctx, o->u_objref.u_standard.std.oxid);
/* FIXME: Add object to list of objects to ping */
*_p = p;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
case OBJREF_HANDLER:
p = talloc_zero(ctx, struct IUnknown);
p->ctx = ctx;
p->vtable = NULL;
p->obj = *o;
- unmarshal_fn unmarshal;
unmarshal = dcom_unmarshal_by_clsid(&o->u_objref.u_custom.clsid);
*_p = p;
if (unmarshal) {
return unmarshal(ctx, o, _p);
} else {
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_BAD_SWITCH;
}
}
- return NT_STATUS_NOT_SUPPORTED;
+ return NDR_ERR_BAD_SWITCH;
}
uint64_t dcom_get_current_oxid(void)