From aecb20a2646520d04e09fe37ea10cd5cc0a93f7b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 25 May 2006 19:34:05 +0000 Subject: r15892: Remove the COM management code - DCOM should be based on Mono and its' COM support and utilize Samba's DCE/RPC + ORPC code instead of having our own COM implementation in Samba, which is too much work to implement and harder to code (C). This only removes some of the code that I started working on to implement the bits of COM I thought were needed to support DCOM from just Samba. This code has never functioned properly, contains a couple of nasty hacks and there should be no reason to pick it up again later, the processes are all documented in the DCOM whitepaper. This does NOT remove the marshalling code for the ORPC code or the torture code that tested some of the ORPC code. (This used to be commit 11df14219bf0b35329b293cae3234e064aabde54) --- source4/lib/basic.mk | 1 - source4/lib/com/README | 9 - source4/lib/com/classes/simple.c | 122 ---------- source4/lib/com/com.h | 37 ---- source4/lib/com/config.mk | 23 -- source4/lib/com/dcom/dcom.h | 41 ---- source4/lib/com/dcom/main.c | 394 --------------------------------- source4/lib/com/dcom/tables.c | 49 ---- source4/lib/com/main.c | 111 ---------- source4/lib/com/rot.c | 34 --- source4/lib/com/tables.c | 109 --------- source4/pidl/TODO | 7 +- source4/rpc_server/config.mk | 18 -- source4/rpc_server/dcom/oxidresolver.c | 118 ---------- source4/rpc_server/dcom/remact.c | 95 -------- source4/rpc_server/dcom/rodb.c | 40 ---- source4/rpc_server/dcom/rot.c | 113 ---------- source4/torture/com/simple.c | 104 --------- source4/torture/config.mk | 10 - source4/torture/torture.c | 1 - 20 files changed, 2 insertions(+), 1434 deletions(-) delete mode 100644 source4/lib/com/README delete mode 100644 source4/lib/com/classes/simple.c delete mode 100644 source4/lib/com/com.h delete mode 100644 source4/lib/com/config.mk delete mode 100644 source4/lib/com/dcom/dcom.h delete mode 100644 source4/lib/com/dcom/main.c delete mode 100644 source4/lib/com/dcom/tables.c delete mode 100644 source4/lib/com/main.c delete mode 100644 source4/lib/com/rot.c delete mode 100644 source4/lib/com/tables.c delete mode 100644 source4/rpc_server/dcom/oxidresolver.c delete mode 100644 source4/rpc_server/dcom/remact.c delete mode 100644 source4/rpc_server/dcom/rodb.c delete mode 100644 source4/rpc_server/dcom/rot.c delete mode 100644 source4/torture/com/simple.c diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index c60e95e0c4..6faa6b3da7 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -1,5 +1,4 @@ # LIB BASIC subsystem -include com/config.mk include samba3/config.mk include socket/config.mk include charset/config.mk diff --git a/source4/lib/com/README b/source4/lib/com/README deleted file mode 100644 index 361024e02c..0000000000 --- a/source4/lib/com/README +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains Samba's very simple COM implementation. -It is by no means finished yet. - -The main aim of this implementation is for use by our DCOM implementation, -which lives in the dcom subdirectory. The local version is used mostly for -testing. - -More information on this effort can be found in the DCOM whitepaper in -the lorikeet repository. diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c deleted file mode 100644 index 295f113207..0000000000 --- a/source4/lib/com/classes/simple.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Simple class - Copyright (C) 2004-2005 Jelmer Vernooij - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "lib/com/com.h" -#include "librpc/gen_ndr/com_dcom.h" - -static struct IClassFactory_vtable simple_classobject_vtable; -static struct IStream_vtable simple_IStream_vtable; - -static WERROR simple_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) -{ - *iun = d; - return WERR_OK; -} - -static uint32_t simple_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) -{ - return 1; -} - -static uint32_t simple_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) -{ - return 1; -} - -static WERROR simple_IStream_Read (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *pv, uint32_t num_requested, uint32_t *num_readx, uint32_t num_read) -{ - printf("%d bytes are being read\n", num_read); - return WERR_OK; -} - -static WERROR simple_IStream_Write (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t num_requested, uint32_t num_written) -{ - printf("%d bytes are being written\n", num_requested); - return WERR_OK; -} - -static WERROR simpleclass_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) -{ - /* FIXME: Return WERR_IFACE_NOT_SUPPORTED if IID != IID_IUNKNOWN and IID != IID_CLASSFACTORY */ - *iun = d; - return WERR_OK; -} - -static WERROR simpleclass_IClassFactory_CreateInstance (struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID *iid, struct IUnknown **ppv) -{ - struct IStream *ret; - /* FIXME: Check whether IID == ISTREAM_IID */ - ret = talloc(mem_ctx, struct IStream); - ret->ctx = NULL; - ret->vtable = &simple_IStream_vtable; - ret->object_data = NULL; - - *ppv = (struct IUnknown *)ret; - - return WERR_OK; -} - -static uint32_t simpleclass_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) -{ - return 1; -} - -static uint32_t simpleclass_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) -{ - return 1; -} - -/* Everything below this line should be autogenerated later on */ -static struct IClassFactory_vtable simple_classobject_vtable = { - { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } }, - simpleclass_IUnknown_QueryInterface, - simpleclass_IUnknown_AddRef, - simpleclass_IUnknown_Release, - simpleclass_IClassFactory_CreateInstance, - NULL, - NULL, - NULL -}; - -static struct IStream_vtable simple_IStream_vtable = { - { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } }, - simple_IUnknown_QueryInterface, - simple_IUnknown_AddRef, - simple_IUnknown_Release, - simple_IStream_Read, - simple_IStream_Write -}; - -NTSTATUS com_simple_init(void) -{ - struct GUID clsid; - struct IUnknown *class_object = talloc(talloc_autofree_context(), struct IUnknown); - - class_object->ctx = NULL; - class_object->object_data = NULL; - class_object->vtable = (struct IUnknown_vtable *)&simple_classobject_vtable; - - GUID_from_string(CLSID_SIMPLE, &clsid); - GUID_from_string(COM_ICLASSFACTORY_UUID, &simple_classobject_vtable.iid); - GUID_from_string(COM_ISTREAM_UUID, &simple_IStream_vtable.iid); - - return com_register_running_class(&clsid, PROGID_SIMPLE, class_object); -} diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h deleted file mode 100644 index c4dd872ff7..0000000000 --- a/source4/lib/com/com.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Unix SMB/CIFS implementation. - COM standard objects - Copyright (C) Jelmer Vernooij 2004-2005. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _COM_H /* _COM_H */ -#define _COM_H - -struct IUnknown_vtable; - -struct com_context -{ - struct dcom_client_context *dcom; - struct event_context *event_ctx; -}; - -typedef struct IUnknown *(*get_class_object_function) (const struct GUID *clsid); - - -#include "lib/com/proto.h" - -#endif /* _COM_H */ diff --git a/source4/lib/com/config.mk b/source4/lib/com/config.mk deleted file mode 100644 index 08c459a5f6..0000000000 --- a/source4/lib/com/config.mk +++ /dev/null @@ -1,23 +0,0 @@ -[LIBRARY::com] -VERSION = 0.0.1 -SO_VERSION = 0 -PRIVATE_PROTO_HEADER = proto.h -OBJ_FILES = \ - tables.o \ - rot.o \ - main.o - -[LIBRARY::dcom] -VERSION = 0.0.1 -SO_VERSION = 0 -PRIVATE_PROTO_HEADER = dcom/proto.h -OBJ_FILES = \ - dcom/main.o \ - dcom/tables.o -PUBLIC_DEPENDENCIES = com DCOM_PROXY_DCOM RPC_NDR_REMACT \ - RPC_NDR_OXIDRESOLVER - -[MODULE::com_simple] -SUBSYSTEM = com -OBJ_FILES = classes/simple.o -INIT_FUNCTION = com_simple_init diff --git a/source4/lib/com/dcom/dcom.h b/source4/lib/com/dcom/dcom.h deleted file mode 100644 index 65a4d0f6e9..0000000000 --- a/source4/lib/com/dcom/dcom.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Unix SMB/CIFS implementation. - COM standard objects - Copyright (C) Jelmer Vernooij 2004-2005. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _DCOM_H /* _DCOM_H */ -#define _DCOM_H - -struct cli_credentials; -struct dcerpc_pipe; - -#include "lib/com/com.h" -#include "librpc/gen_ndr/orpc.h" -#include "lib/com/dcom/proto.h" - -struct dcom_client_context { - struct cli_credentials *credentials; - struct dcom_object_exporter { - uint64_t oxid; - struct DUALSTRINGARRAY bindings; - struct dcerpc_pipe *pipe; - struct dcom_object_exporter *prev, *next; - } *object_exporters; -}; - -#endif /* _DCOM_H */ diff --git a/source4/lib/com/dcom/main.c b/source4/lib/com/dcom/main.c deleted file mode 100644 index 14a7287c59..0000000000 --- a/source4/lib/com/dcom/main.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Main DCOM functionality - Copyright (C) 2004 Jelmer Vernooij - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "system/filesys.h" -#include "librpc/gen_ndr/epmapper.h" -#include "librpc/gen_ndr/ndr_remact_c.h" -#include "librpc/gen_ndr/com_dcom.h" -#include "lib/com/dcom/dcom.h" -#include "librpc/rpc/dcerpc_table.h" - -#define DCOM_NEGOTIATED_PROTOCOLS { EPM_PROTOCOL_TCP, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NCALRPC } - -struct dcom_client_context *dcom_client_init(struct com_context *ctx, struct cli_credentials *credentials) -{ - ctx->dcom = talloc(ctx, struct dcom_client_context); - ctx->dcom->credentials = credentials; - - return ctx->dcom; -} - -static NTSTATUS dcerpc_binding_from_STRINGBINDING(TALLOC_CTX *mem_ctx, struct dcerpc_binding **b_out, struct STRINGBINDING *bd) -{ - char *host, *endpoint; - struct dcerpc_binding *b; - - b = talloc_zero(mem_ctx, struct dcerpc_binding); - if (!b) { - return NT_STATUS_NO_MEMORY; - } - - b->transport = dcerpc_transport_by_endpoint_protocol(bd->wTowerId); - - if (b->transport == -1) { - DEBUG(1, ("Can't find transport match endpoint protocol %d\n", bd->wTowerId)); - return NT_STATUS_NOT_SUPPORTED; - } - - host = talloc_strdup(b, bd->NetworkAddr); - endpoint = strchr(host, '['); - - if (endpoint) { - *endpoint = '\0'; - endpoint++; - - endpoint[strlen(endpoint)-1] = '\0'; - } - - b->host = host; - b->endpoint = talloc_strdup(b, endpoint); - - *b_out = b; - return NT_STATUS_OK; -} - -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" }; - int i; - NTSTATUS status; - TALLOC_CTX *mem_ctx = talloc_init("dcom_connect"); - - if (server == NULL) { - return dcerpc_pipe_connect(ctx, p, "ncalrpc", - &dcerpc_table_IRemoteActivation, - ctx->dcom->credentials, ctx->event_ctx); - } - - /* Allow server name to contain a binding string */ - if (NT_STATUS_IS_OK(dcerpc_parse_binding(mem_ctx, server, &bd))) { - status = dcerpc_pipe_connect_b(ctx, p, bd, - &dcerpc_table_IRemoteActivation, - ctx->dcom->credentials, ctx->event_ctx); - - talloc_free(mem_ctx); - return status; - } - - for (i = 0; i < ARRAY_SIZE(available_transports); i++) - { - char *binding = talloc_asprintf(mem_ctx, "%s:%s", available_transports[i], server); - if (!binding) { - talloc_free(mem_ctx); - return NT_STATUS_NO_MEMORY; - } - - status = dcerpc_pipe_connect(ctx, p, binding, - &dcerpc_table_IRemoteActivation, - ctx->dcom->credentials, ctx->event_ctx); - - if (NT_STATUS_IS_OK(status)) { - talloc_free(mem_ctx); - return status; - } - } - - talloc_free(mem_ctx); - return status; -} - -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) { - if (ox->oxid == oxid) { - return ox; - } - } - - return NULL; -} - -struct dcom_object_exporter *object_exporter_by_ip(struct com_context *ctx, struct IUnknown *ip) -{ - return NULL; /* FIXME */ -} - -WERROR dcom_create_object(struct com_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct IUnknown ***ip, WERROR *results) -{ - uint16_t protseq[] = DCOM_NEGOTIATED_PROTOCOLS; - struct dcerpc_pipe *p; - struct dcom_object_exporter *m; - NTSTATUS status; - struct RemoteActivation r; - struct DUALSTRINGARRAY dualstring; - int i; - - status = dcom_connect_host(ctx, &p, server); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Unable to connect to %s - %s\n", server, nt_errstr(status))); - return ntstatus_to_werror(status); - } - - ZERO_STRUCT(r.in); - r.in.this.version.MajorVersion = COM_MAJOR_VERSION; - r.in.this.version.MinorVersion = COM_MINOR_VERSION; - r.in.this.cid = GUID_random(); - r.in.Clsid = *clsid; - r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY; - r.in.num_protseqs = ARRAY_SIZE(protseq); - r.in.protseq = protseq; - r.in.Interfaces = num_ifaces; - r.in.pIIDs = iid; - r.out.ifaces = talloc_array(ctx, struct MInterfacePointer *, num_ifaces); - r.out.pdsaOxidBindings = &dualstring; - - status = dcerpc_RemoteActivation(p, ctx, &r); - if(NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Error while running RemoteActivation %s\n", nt_errstr(status))); - return ntstatus_to_werror(status); - } - - if(!W_ERROR_IS_OK(r.out.result)) { - return r.out.result; - } - - if(!W_ERROR_IS_OK(r.out.hr)) { - return r.out.hr; - } - - *ip = talloc_array(ctx, struct IUnknown *, num_ifaces); - for (i = 0; i < num_ifaces; i++) { - results[i] = r.out.results[i]; - (*ip)[i] = NULL; - if (W_ERROR_IS_OK(results[i])) { - status = dcom_IUnknown_from_OBJREF(ctx, &(*ip)[i], &r.out.ifaces[i]->obj); - if (!NT_STATUS_IS_OK(status)) { - results[i] = ntstatus_to_werror(status); - } - } - } - - /* Add the OXID data for the returned oxid */ - m = object_exporter_by_oxid(ctx, r.out.pOxid); - m->bindings = *r.out.pdsaOxidBindings; - - return WERR_OK; -} - -WERROR dcom_get_class_object(struct com_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct IUnknown **ip) -{ - struct dcom_object_exporter *m; - struct RemoteActivation r; - struct dcerpc_pipe *p; - struct DUALSTRINGARRAY dualstring; - NTSTATUS status; - struct MInterfacePointer pm; - struct MInterfacePointer *ifaces[1]; - uint16_t protseq[] = DCOM_NEGOTIATED_PROTOCOLS; - - if (!server) { - return com_get_class_object(ctx, clsid, iid, ip); - } - - status = dcom_connect_host(ctx, &p, server); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Unable to connect to %s - %s\n", server, nt_errstr(status))); - return ntstatus_to_werror(status); - } - - ZERO_STRUCT(r.in); - r.in.this.version.MajorVersion = COM_MAJOR_VERSION; - r.in.this.version.MinorVersion = COM_MINOR_VERSION; - r.in.this.cid = GUID_random(); - r.in.Clsid = *clsid; - r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY; - r.in.num_protseqs = ARRAY_SIZE(protseq); - r.in.protseq = protseq; - r.in.Interfaces = 1; - r.in.pIIDs = iid; - r.in.Mode = MODE_GET_CLASS_OBJECT; - r.out.ifaces = ifaces; - ifaces[0] = ± - r.out.pdsaOxidBindings = &dualstring; - - status = dcerpc_RemoteActivation(p, ctx, &r); - if(NT_STATUS_IS_ERR(status)) { - DEBUG(1, ("Error while running RemoteActivation - %s\n", nt_errstr(status))); - return ntstatus_to_werror(status); - } - - if(!W_ERROR_IS_OK(r.out.result)) { return r.out.result; } - if(!W_ERROR_IS_OK(r.out.hr)) { return r.out.hr; } - if(!W_ERROR_IS_OK(r.out.results[0])) { return r.out.results[0]; } - - /* Set up the interface data */ - dcom_IUnknown_from_OBJREF(ctx, ip, &pm.obj); - - /* Add the OXID data for the returned oxid */ - m = object_exporter_by_oxid(ctx, r.out.pOxid); - m->bindings = *r.out.pdsaOxidBindings; - - return WERR_OK; -} - -NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp) -{ - struct dcerpc_binding *binding; - struct GUID iid; - uint64_t oxid; - NTSTATUS status; - int i; - struct dcerpc_pipe *p; - TALLOC_CTX *tmp_ctx; - struct dcom_object_exporter *ox; - - ox = object_exporter_by_ip(iface->ctx, iface); - - tmp_ctx = talloc_new(NULL); - - p = ox->pipe; - - iid = iface->vtable->iid; - - if (p) { - if (!GUID_equal(&p->syntax.uuid, &iid)) { - struct dcerpc_pipe *p2; - ox->pipe->syntax.uuid = iid; - - /* interface will always be present, so - * idl_iface_by_uuid can't return NULL */ - status = dcerpc_secondary_context(p, &p2, idl_iface_by_uuid(&iid)); - - if (NT_STATUS_IS_OK(status)) { - p = p2; - } - } else { - p = talloc_reference(NULL, p); - } - *pp = p; - talloc_free(tmp_ctx); - return status; - } - - i = 0; - do { - status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, - ox->bindings.stringbindings[i]); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Error parsing string binding")); - } else { - status = dcerpc_pipe_connect_b(NULL, &p, binding, - idl_iface_by_uuid(&iid), - iface->ctx->dcom->credentials, - iface->ctx->event_ctx); - } - talloc_free(binding); - i++; - } while (!NT_STATUS_IS_OK(status) && ox->bindings.stringbindings[i]); - - 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", (long long)oxid)); - - *pp = p; - talloc_free(tmp_ctx); - - return NT_STATUS_OK; -} - -NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p) -{ - /* FIXME: Cache generated objref objects? */ - ZERO_STRUCTP(o); - - o->signature = OBJREF_SIGNATURE; - - if (!p) { - o->flags = OBJREF_NULL; - } else { - o->iid = p->vtable->iid; - /* - OBJREF_STANDARD - OBJREF_CUSTOM - OBJREF_HANDLER - */ - } - - return NT_STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o) -{ - struct IUnknown *p; - struct dcom_object_exporter *ox; - - switch(o->flags) { - case OBJREF_NULL: - *_p = NULL; - return NT_STATUS_OK; - - case OBJREF_STANDARD: - p = talloc(ctx, struct IUnknown); - p->ctx = ctx; - p->vtable = dcom_proxy_vtable_by_iid(&o->iid); - 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; - } - - 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; - - case OBJREF_HANDLER: - p = talloc(ctx, struct IUnknown); - p->ctx = ctx; - ox = object_exporter_by_oxid(ctx, o->u_objref.u_handler.std.oxid ); - /* FIXME: Add object to list of objects to ping */ -/*FIXME p->vtable = dcom_vtable_by_clsid(&o->u_objref.u_handler.clsid);*/ - /* FIXME: Do the custom unmarshaling call */ - - *_p = p; - return NT_STATUS_OK; - - case OBJREF_CUSTOM: - p = talloc(ctx, struct IUnknown); - p->ctx = ctx; - p->vtable = NULL; - /* FIXME: Do the actual custom unmarshaling call */ - *_p = p; - return NT_STATUS_NOT_SUPPORTED; - } - - return NT_STATUS_NOT_SUPPORTED; -} - -uint64_t dcom_get_current_oxid(void) -{ - return getpid(); -} diff --git a/source4/lib/com/dcom/tables.c b/source4/lib/com/dcom/tables.c deleted file mode 100644 index ce4f672d37..0000000000 --- a/source4/lib/com/dcom/tables.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - Unix SMB/CIFS implementation. - DCOM proxy tables functionality - Copyright (C) 2005 Jelmer Vernooij - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "dlinklist.h" -#include "librpc/gen_ndr/com_dcom.h" - -static struct dcom_proxy { - struct IUnknown_vtable *vtable; - struct dcom_proxy *prev, *next; -} *proxies = NULL; - -NTSTATUS dcom_register_proxy(struct IUnknown_vtable *proxy_vtable) -{ - struct dcom_proxy *proxy = talloc(talloc_autofree_context(), struct dcom_proxy); - - proxy->vtable = proxy_vtable; - DLIST_ADD(proxies, proxy); - - return NT_STATUS_OK; -} - -struct IUnknown_vtable *dcom_proxy_vtable_by_iid(struct GUID *iid) -{ - struct dcom_proxy *p; - for (p = proxies; p; p = p->next) { - if (GUID_equal(&p->vtable->iid, iid)) { - return p->vtable; - } - } - return NULL; -} diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c deleted file mode 100644 index 3e4127f246..0000000000 --- a/source4/lib/com/main.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Main COM functionality - Copyright (C) 2004 Jelmer Vernooij - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "dlinklist.h" -#include "lib/com/com.h" -#include "lib/events/events.h" -#include "librpc/gen_ndr/com_dcom.h" -#include "build.h" - -WERROR com_init_ctx(struct com_context **ctx, struct event_context *event_ctx) -{ - *ctx = talloc(NULL, struct com_context); - if (event_ctx == NULL) { - event_ctx = event_context_init(*ctx); - } - (*ctx)->event_ctx = event_ctx; - return WERR_OK; -} - -WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_ifaces, struct GUID *iid, struct IUnknown **ip, WERROR *results) -{ - struct IUnknown *iunk = NULL; - struct IClassFactory *factory; - WERROR error; - int i; - struct GUID classfact_iid; - - GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &classfact_iid); - - /* Obtain class object */ - error = com_get_class_object(ctx, clsid, &classfact_iid, (struct IUnknown **)&factory); - if (!W_ERROR_IS_OK(error)) { - DEBUG(3, ("Unable to obtain class object for %s\n", GUID_string(NULL, clsid))); - return error; - } - - /* Run IClassFactory::CreateInstance() */ - error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, &iunk); - if (!W_ERROR_IS_OK(error)) { - DEBUG(3, ("Error while calling IClassFactory::CreateInstance : %s\n", win_errstr(error))); - return error; - } - - if (!iunk) { - DEBUG(0, ("IClassFactory_CreateInstance returned success but result pointer is still NULL!\n")); - return WERR_GENERAL_FAILURE; - } - - /* Release class object */ - IUnknown_Release(factory, ctx); - - error = WERR_OK; - - /* Do one or more QueryInterface calls */ - for (i = 0; i < num_ifaces; i++) { - results[i] = IUnknown_QueryInterface(iunk, ctx, &iid[i], &ip[i]); - if (!W_ERROR_IS_OK(results[i])) error = results[i]; - } - - return error; -} - -WERROR com_get_class_object(struct com_context *ctx, struct GUID *clsid, struct GUID *iid, struct IUnknown **ip) -{ - struct IUnknown *iu; - - iu = com_class_by_clsid(ctx, clsid); - if (!iu) { - return WERR_CLASS_NOT_REGISTERED; - } - - return IUnknown_QueryInterface(iu, ctx, iid, ip); -} - -NTSTATUS com_init(void) -{ - static BOOL initialized = False; - - init_module_fn static_init[] = STATIC_com_MODULES; - init_module_fn *shared_init; - - if (initialized) return NT_STATUS_OK; - initialized = True; - - shared_init = load_samba_modules(NULL, "com"); - - run_init_functions(static_init); - run_init_functions(shared_init); - - talloc_free(shared_init); - - return NT_STATUS_OK; -} diff --git a/source4/lib/com/rot.c b/source4/lib/com/rot.c deleted file mode 100644 index 34a5671f5b..0000000000 --- a/source4/lib/com/rot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Running object table functions - - Copyright (C) Jelmer Vernooij 2004-2005 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -struct dcom_interface_p *dcom_get_local_iface_p(struct GUID *ipid) -{ - /* FIXME: Call the local ROT and do a - * rot_get_interface_pointer call */ - - /* FIXME: Perhaps have a local (thread-local) table with - * local DCOM objects so that not every DCOM call requires a lookup - * to the ROT? */ - return NULL; -} diff --git a/source4/lib/com/tables.c b/source4/lib/com/tables.c deleted file mode 100644 index d9989ecdbe..0000000000 --- a/source4/lib/com/tables.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - Unix SMB/CIFS implementation. - COM class tables - Copyright (C) 2004 Jelmer Vernooij - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "dlinklist.h" -#include "lib/com/com.h" -#include "librpc/gen_ndr/ndr_misc.h" - -/* Specific implementation of one or more interfaces */ -struct com_class -{ - const char *progid; - struct GUID clsid; - - struct IUnknown *class_object; - struct com_class *prev, *next; -} * running_classes = NULL; - -static struct IUnknown *get_com_class_running(const struct GUID *clsid) -{ - struct com_class *c = running_classes; - - while(c) { - - if (GUID_equal(clsid, &c->clsid)) { - return c->class_object; - } - - c = c->next; - } - - return NULL; -} - -static struct IUnknown *get_com_class_so(TALLOC_CTX *mem_ctx, const struct GUID *clsid) -{ - char *mod_name; - char *clsid_str; - void *mod; - get_class_object_function f; - - clsid_str = GUID_string(mem_ctx, clsid); - mod_name = talloc_asprintf(mem_ctx, "%s.so", clsid_str); - talloc_free(clsid_str); - - mod = dlopen(mod_name, 0); - - if (!mod) { - return NULL; - } - - f = dlsym(mod, "get_class_object"); - - if (!f) { - return NULL; - } - - return f(clsid); -} - -struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID *clsid) -{ - struct IUnknown *c; - - /* Check list of running COM classes first */ - c = get_com_class_running(clsid); - - if (c != NULL) { - return c; - } - - c = get_com_class_so(ctx, clsid); - - if (c != NULL) { - return c; - } - - return NULL; -} - -NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, struct IUnknown *p) -{ - struct com_class *l = talloc_zero(running_classes?running_classes:talloc_autofree_context(), struct com_class); - - l->clsid = *clsid; - l->progid = talloc_strdup(l, progid); - l->class_object = p; - - DLIST_ADD(running_classes, l); - - return NT_STATUS_OK; -} diff --git a/source4/pidl/TODO b/source4/pidl/TODO index 3098a44a8f..9358b399f7 100644 --- a/source4/pidl/TODO +++ b/source4/pidl/TODO @@ -3,14 +3,9 @@ - compatibility mode for generating MIDL-readable data: - strip out pidl-specific properties -- don't be so strict on array boundaries.. arrays can and will be empty when - a (regular) remote error occurs - - support nested elements - generate names for anonymous tagged types -- auto-alloc [ref] pointers for Samba4 during pull if they were NULL - - improve represent_as() - --explain-ndr option that dumps out parse tree ? @@ -18,3 +13,5 @@ - seperate tables for NDR and DCE/RPC - allow data structures outside of interfaces + +- mem_ctx in the interface rather then as struct ndr member. diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index 473b0a3df7..afe18217c1 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -12,24 +12,6 @@ OBJ_FILES = \ # End SUBSYSTEM DCERPC_COMMON ################################################ -################################################ -# Start MODULE dcerpc_dcom -[MODULE::dcerpc_dcom] -ENABLE = NO -INIT_FUNCTION = dcerpc_server_dcom_init -SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - dcom/oxidresolver.o \ - dcom/rot.o \ - dcom/rodb.o \ - dcom/remact.o \ - librpc/gen_ndr/ndr_dcom_d.o -PUBLIC_DEPENDENCIES = \ - DCERPC_COMMON \ - dcom -# End MODULE dcerpc_dcom -################################################ - ################################################ # Start MODULE dcerpc_rpcecho [MODULE::dcerpc_rpcecho] diff --git a/source4/rpc_server/dcom/oxidresolver.c b/source4/rpc_server/dcom/oxidresolver.c deleted file mode 100644 index 1880d6f8dc..0000000000 --- a/source4/rpc_server/dcom/oxidresolver.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - endpoint server for the IOXIDResolver pipe - - Copyright (C) Jelmer Vernooij 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "librpc/gen_ndr/ndr_oxidresolver.h" -#include "rpc_server/dcerpc_server.h" - -struct OXIDObject -{ - struct GUID OID; -}; - -struct PingSet -{ - uint64_t id; - struct OXIDObject *objects; - struct PingSet *prev, *next; -}; - -/* Maximum number of missed ping calls before a client is presumed - * gone */ -#define MAX_MISSED_PINGS 3 - -/* Maximum number of seconds between two ping calls */ -#define MAX_PING_TIME 60 - -/* - ResolveOxid -*/ -static WERROR ResolveOxid(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ResolveOxid *r) -{ - return WERR_NOT_SUPPORTED; -} - - -/* - SimplePing -*/ -static WERROR SimplePing(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct SimplePing *r) -{ - return WERR_NOT_SUPPORTED; -} - -/* - ComplexPing -*/ -static WERROR ComplexPing(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ComplexPing *r) -{ - /* struct PingSet *ps; */ - - /* If r->in.SetId == 0, create new PingSet */ - - /* Otherwise, look up pingset by id */ - - return WERR_NOT_SUPPORTED; -} - - -/* - ServerAlive -*/ -static WERROR ServerAlive(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ServerAlive *r) -{ - return WERR_OK; -} - - -/* - ResolveOxid2 -*/ -static WERROR ResolveOxid2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ResolveOxid2 *r) -{ - ZERO_STRUCT(r->out); - r->out.ComVersion.MajorVersion = COM_MAJOR_VERSION; - r->out.ComVersion.MinorVersion = COM_MINOR_VERSION; - return WERR_NOT_SUPPORTED; -} - -struct DUALSTRINGARRAY *dcom_server_generate_dual_string(TALLOC_CTX *mem_ctx, struct dcesrv_call_state *state) -{ - return NULL; /* FIXME */ -} - -/* - ServerAlive2 -*/ -static WERROR ServerAlive2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ServerAlive2 *r) -{ - ZERO_STRUCT(r->out); - r->out.info.version.MajorVersion = COM_MAJOR_VERSION; - r->out.info.version.MinorVersion = COM_MINOR_VERSION; - r->out.dualstring = *dcom_server_generate_dual_string(mem_ctx, dce_call); - return WERR_OK; -} - -/* FIXME: Garbage collect objects that haven't been pinged */ - -/* include the generated boilerplate */ -#include "librpc/gen_ndr/ndr_oxidresolver_s.c" diff --git a/source4/rpc_server/dcom/remact.c b/source4/rpc_server/dcom/remact.c deleted file mode 100644 index 506417d7e4..0000000000 --- a/source4/rpc_server/dcom/remact.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - endpoint server for the IRemoteActivation pipe - - Copyright (C) Jelmer Vernooij 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "rpc_server/dcerpc_server.h" -#include "rpc_server/common/common.h" -#include "librpc/gen_ndr/ndr_remact.h" -#include "librpc/gen_ndr/ndr_oxidresolver.h" - -struct dcom_interface_pointer *dcom_interface_pointer_by_ipid(struct GUID *ipid) -{ - /* FIXME */ - return NULL; -} - -/* - RemoteActivation -*/ -static WERROR RemoteActivation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct RemoteActivation *r) -{ - struct CreateInstance *cr = NULL; - /*struct Release *ur;*/ - struct dcom_interface_p *o = NULL; - int i; - - /* FIXME: CoGetClassObject() */ - /* FIXME: IClassFactory::CreateInstance() */ - /* FIXME: IUnknown::Release() */ - - ZERO_STRUCT(r->out); - r->out.ServerVersion.MajorVersion = COM_MAJOR_VERSION; - r->out.ServerVersion.MinorVersion = COM_MINOR_VERSION; - - r->out.AuthnHint = DCERPC_AUTH_LEVEL_DEFAULT; - r->out.pdsaOxidBindings = dcom_server_generate_dual_string(mem_ctx, dce_call); - - /* FIXME: Loop thru given interfaces and set r->out.results and - * r->out.interfaces */ - r->out.ifaces = talloc_array(mem_ctx, struct pMInterfacePointer, r->in.Interfaces); - r->out.results = talloc_array(mem_ctx, WERROR, r->in.Interfaces); - r->out.hr = cr->out.result; - - for (i = 0; i < r->in.Interfaces; i++) { - struct QueryInterface rr; - rr.in.iid = &r->in.pIIDs[i]; - dcom_IUnknown_QueryInterface(o, mem_ctx, &rr); - ZERO_STRUCT(r->out.ifaces[i]); - r->out.results[i] = rr.out.result; - } - - /* FIXME: */ - r->out.pOxid = 0; - ZERO_STRUCT(r->out.ipidRemUnknown); - - return WERR_OK; -} - - -NTSTATUS dcerpc_server_dcom_init(void) -{ - NTSTATUS status; - status = dcerpc_server_IOXIDResolver_init(); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - - status = dcerpc_server_IRemoteActivation_init(); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - - return NT_STATUS_OK; -} - -/* include the generated boilerplate */ -#include "librpc/gen_ndr/ndr_remact_s.c" diff --git a/source4/rpc_server/dcom/rodb.c b/source4/rpc_server/dcom/rodb.c deleted file mode 100644 index 76f3d2da80..0000000000 --- a/source4/rpc_server/dcom/rodb.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Running objects database - - Copyright (C) Jelmer Vernooij 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "system/filesys.h" -#include "rpc_server/dcerpc_server.h" -#include "librpc/gen_ndr/ndr_rot.h" -#include "rpc_server/common/common.h" - -struct tdb_wrap *openrodb(TALLOC_CTX *mem_ctx) -{ - struct tdb_wrap *wrap; - char *rodb_name = NULL; - - rodb_name = smbd_tmp_path(mem_ctx, "rot.tdb"); - wrap = tdb_wrap_open(mem_ctx, rodb_name, 0, 0, O_RDWR|O_CREAT, 0600); - SAFE_FREE(rodb_name); - - return wrap; -} - diff --git a/source4/rpc_server/dcom/rot.c b/source4/rpc_server/dcom/rot.c deleted file mode 100644 index f36eaf20d1..0000000000 --- a/source4/rpc_server/dcom/rot.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - endpoint server for the rot pipe - - Copyright (C) Jelmer Vernooij 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "rpc_server/dcerpc_server.h" -#include "librpc/gen_ndr/ndr_rot.h" -#include "rpc_server/common/common.h" - -/* - rot_add -*/ -static WERROR rot_add(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_add *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_remove -*/ -static WERROR rot_remove(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_remove *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_is_listed -*/ -static WERROR rot_is_listed(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_is_listed *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_get_interface_pointer -*/ -static WERROR rot_get_interface_pointer(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_get_interface_pointer *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_set_modification_time -*/ -static WERROR rot_set_modification_time(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_set_modification_time *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_get_modification_time -*/ -static WERROR rot_get_modification_time(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_get_modification_time *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* - rot_enum -*/ -static WERROR rot_enum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct rot_enum *r) -{ - struct tdb_wrap *db = openrodb(mem_ctx); - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); - talloc_free(db); -} - - -/* include the generated boilerplate */ -#include "librpc/gen_ndr/ndr_rot_s.c" diff --git a/source4/torture/com/simple.c b/source4/torture/com/simple.c deleted file mode 100644 index 82aab476be..0000000000 --- a/source4/torture/com/simple.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - Unix SMB/CIFS implementation. - run the "simple" example (D)COM program - - Copyright (C) Jelmer Vernooij 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "lib/com/com.h" -#include "lib/com/dcom/dcom.h" -#include "librpc/gen_ndr/com_dcom.h" -#include "lib/cmdline/popt_common.h" -#include "librpc/rpc/dcerpc.h" -#include "torture/torture.h" - -#define DEFAULT_TRANS 4096 - -static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host) -{ - BOOL ret = True; - struct GUID IID[2]; - struct GUID clsid; - WERROR error; - struct IUnknown *interfaces[3]; - WERROR results[2]; - struct com_context *ctx; - uint8_t test_data[5]; - int i; - - com_init(); - - com_init_ctx(&ctx, NULL); - dcom_client_init(ctx, cmdline_credentials); - - IID[0] = dcerpc_table_IStream.syntax_id.uuid; - IID[1] = dcerpc_table_IUnknown.syntax_id.uuid; - GUID_from_string(CLSID_SIMPLE, &clsid); - - if (host) { - error = dcom_create_object(ctx, &clsid, - host, 2, IID, - (struct IUnknown ***)&interfaces, - results); - } else { - error = com_create_object(ctx, &clsid, 2, IID, interfaces, results); - } - - if (!W_ERROR_IS_OK(error)) { - printf("(d)com_create_object failed - %s\n", win_errstr(error)); - return False; - } - - error = IStream_Read((struct IStream *)interfaces[0], mem_ctx, NULL, 20, 20, 30); - if (!W_ERROR_IS_OK(error)) { - printf("IStream::Read() failed - %s\n", win_errstr(error)); - ret = False; - } - - for (i = 0; i < 5; i++) { - test_data[i] = i+1; - } - - error = IStream_Write((struct IStream *)interfaces[0], mem_ctx, test_data, 5, NULL); - if (!W_ERROR_IS_OK(error)) { - printf("IStream::Write() failed - %s\n", win_errstr(error)); - ret = False; - } - - IUnknown_Release((struct IUnknown *)interfaces[1], mem_ctx); - - return True; -} - -BOOL torture_com_simple(struct torture_context *torture) -{ - BOOL ret = True; - TALLOC_CTX *mem_ctx = talloc_init("torture_dcom_simple"); - const char *host = lp_parm_string(-1, "dcom", "host"); - - ret &= test_readwrite(mem_ctx, host); - - talloc_free(mem_ctx); - - return ret; -} - -NTSTATUS torture_com_init(void) -{ - return register_torture_op("COM-SIMPLE", torture_com_simple, 0); -} diff --git a/source4/torture/config.mk b/source4/torture/config.mk index c674cd82f1..818778e479 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -97,16 +97,6 @@ PUBLIC_DEPENDENCIES = \ include smb2/config.mk -[MODULE::torture_com] -INIT_FUNCTION = torture_com_init -SUBSYSTEM = torture -PRIVATE_PROTO_HEADER = \ - com/proto.h -OBJ_FILES = \ - com/simple.o -PUBLIC_DEPENDENCIES = \ - com dcom POPT_CREDENTIALS - [MODULE::torture_rpc] # TORTURE_NET and TORTURE_NBT use functions from torture_rpc... OUTPUT_TYPE = INTEGRATED diff --git a/source4/torture/torture.c b/source4/torture/torture.c index b7cb74480c..fb4985fe1e 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -42,7 +42,6 @@ #include "torture/local/proto.h" #include "torture/nbench/proto.h" #include "torture/ldap/proto.h" -#include "torture/com/proto.h" #include "torture/nbt/proto.h" #include "torture/libnet/proto.h" #include "torture/util.h" -- cgit