diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/com/classes/simple.c | 116 | ||||
-rw-r--r-- | source4/lib/com/com.h | 30 | ||||
-rw-r--r-- | source4/lib/com/config.mk | 10 | ||||
-rw-r--r-- | source4/lib/com/main.c | 85 | ||||
-rw-r--r-- | source4/lib/com/rot.c (renamed from source4/lib/dcom/common/rot.c) | 2 | ||||
-rw-r--r-- | source4/lib/com/tables.c | 107 | ||||
-rw-r--r-- | source4/lib/dcom/classes/simple.c | 66 | ||||
-rw-r--r-- | source4/lib/dcom/common/dcom.h | 33 | ||||
-rw-r--r-- | source4/lib/dcom/common/main.c | 120 | ||||
-rw-r--r-- | source4/lib/dcom/common/tables.c | 107 | ||||
-rw-r--r-- | source4/lib/dcom/config.mk | 26 |
11 files changed, 378 insertions, 324 deletions
diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c new file mode 100644 index 0000000000..2c72d56f94 --- /dev/null +++ b/source4/lib/com/classes/simple.c @@ -0,0 +1,116 @@ +/* + Unix SMB/CIFS implementation. + Simple class + Copyright (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org> + + 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 WERROR simple_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) +{ + *iun = d; + return WERR_OK; +} + +static uint32_t simple_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) +{ + return 1; +} + +static uint32_t simple_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) +{ + return 1; +} + +static WERROR simple_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_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 struct IStream_vtable simple_istream_vtable = { + simple_QueryInterface, + simple_AddRef, + simple_Release, + simple_Read, + simple_Write +}; + +static WERROR simpleclass_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_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 = ret; + + return WERR_OK; +} + +static uint32_t simpleclass_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) +{ + return 1; +} + +static uint32_t simpleclass_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 = { + simpleclass_QueryInterface, + simpleclass_AddRef, + simpleclass_Release, + simpleclass_CreateInstance, + NULL, + NULL, + NULL +}; + +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("5e9ddec7-5767-11cf-beab-00aa006c3606", &clsid); + + return com_register_running_class(&clsid, "Samba.Simple", class_object); +} diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h new file mode 100644 index 0000000000..be7dcde5b5 --- /dev/null +++ b/source4/lib/com/com.h @@ -0,0 +1,30 @@ +/* + 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 com_context +{ +}; + +typedef struct IUnknown *(*get_class_object_function) (const struct GUID *clsid); + +#endif /* _COM_H */ diff --git a/source4/lib/com/config.mk b/source4/lib/com/config.mk new file mode 100644 index 0000000000..006ea212c1 --- /dev/null +++ b/source4/lib/com/config.mk @@ -0,0 +1,10 @@ +[SUBSYSTEM::LIBCOM] +INIT_OBJ_FILES = \ + lib/com/tables.o \ + lib/com/rot.o \ + lib/com/main.o + +[MODULE::com_simple] +SUBSYSTEM = LIBCOM +INIT_OBJ_FILES = lib/com/classes/simple.o +INIT_FUNCTION = com_simple_init diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c new file mode 100644 index 0000000000..378c3738b9 --- /dev/null +++ b/source4/lib/com/main.c @@ -0,0 +1,85 @@ +/* + Unix SMB/CIFS implementation. + Main COM functionality + Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org> + + 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/com_dcom.h" + +WERROR com_init(struct com_context **ctx) +{ + *ctx = talloc(NULL, struct com_context); + 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); +} diff --git a/source4/lib/dcom/common/rot.c b/source4/lib/com/rot.c index 7acdbe066e..34a5671f5b 100644 --- a/source4/lib/dcom/common/rot.c +++ b/source4/lib/com/rot.c @@ -3,7 +3,7 @@ Running object table functions - Copyright (C) Jelmer Vernooij 2004 + 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 diff --git a/source4/lib/com/tables.c b/source4/lib/com/tables.c new file mode 100644 index 0000000000..cf63e7e9a2 --- /dev/null +++ b/source4/lib/com/tables.c @@ -0,0 +1,107 @@ +/* + Unix SMB/CIFS implementation. + COM class tables + Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org> + + 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" + +/* 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 = sys_dlopen(mod_name, 0); + + if (!mod) { + return NULL; + } + + f = sys_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/lib/dcom/classes/simple.c b/source4/lib/dcom/classes/simple.c deleted file mode 100644 index 13cf4616b2..0000000000 --- a/source4/lib/dcom/classes/simple.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Simple class - Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org> - - 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/dcom/common/dcom.h" - -NTSTATUS simple_QueryInterface (struct dcom_interface_p *d, TALLOC_CTX *mem_ctx, struct QueryInterface *r) -{ - return NT_STATUS_NOT_SUPPORTED; -} - -static NTSTATUS simple_CreateInstance (struct dcom_interface_p *d, TALLOC_CTX *mem_ctx, struct CreateInstance *r) -{ - return NT_STATUS_NOT_SUPPORTED; -} - -/* Everything below this line should be autogenerated later on */ - -static struct dcom_IClassFactory_vtable simple_classobject = { - { simple_QueryInterface, NULL, NULL }, - simple_CreateInstance, - NULL, - NULL, - NULL -}; - -NTSTATUS dcom_simple_init(void) -{ - struct GUID iid; - struct dcom_class simple_class = { - "Samba.Simple", - }; - - GUID_from_string(DCERPC_IUNKNOWN_UUID, &iid); - - simple_class.class_object = dcom_new_local_ifacep( - talloc_autofree_context(), - &iid, - &simple_classobject, NULL); - - if (!simple_class.class_object) { - DEBUG(1, ("Unable to create class object for simple class\n")); - return NT_STATUS_OK; - } - - GUID_from_string("5e9ddec7-5767-11cf-beab-00aa006c3606", &simple_class.clsid); - - return dcom_register_class(&simple_class); -} diff --git a/source4/lib/dcom/common/dcom.h b/source4/lib/dcom/common/dcom.h index 0bc4a256f1..dd21bb9d29 100644 --- a/source4/lib/dcom/common/dcom.h +++ b/source4/lib/dcom/common/dcom.h @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. DCOM standard objects - Copyright (C) Jelmer Vernooij 2004. + 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 @@ -23,11 +23,6 @@ #include "librpc/ndr/ndr_dcom.h" -struct IUnknown_AddRef; -struct IUnknown_Release; -struct IUnknown_QueryInterface; -struct dcom_interface_p; - struct dcom_context { struct dcom_object_exporter { @@ -49,34 +44,16 @@ struct dcom_context uint32_t dcerpc_flags; }; -/* Specific implementation of one or more interfaces */ -struct dcom_class -{ - const char *prog_id; - struct GUID clsid; - - /* IUnknown */ - struct dcom_interface_p *class_object; -}; - -struct dcom_interface -{ - struct GUID iid; - int num_methods; - struct GUID base_iid; - const void *proxy_vtable; -}; - struct dcom_interface_p { - struct dcom_context *ctx; - const struct dcom_interface *interface; + struct com_context *ctx; + const struct com_interface *interface; const void *vtable; /* Points to one of the available implementations */ struct GUID ipid; - struct dcom_object *object; + struct com_object *object; int objref_flags; int orpc_flags; - struct dcom_object_exporter *ox; + struct com_object_exporter *ox; uint32_t private_references; }; diff --git a/source4/lib/dcom/common/main.c b/source4/lib/dcom/common/main.c index a8324606f1..315912ba3c 100644 --- a/source4/lib/dcom/common/main.c +++ b/source4/lib/dcom/common/main.c @@ -117,7 +117,7 @@ WERROR dcom_init(struct dcom_context **ctx, const char *domain, const char *user return WERR_OK; } -static struct dcom_object_exporter *oxid_mapping_by_oxid (struct dcom_context *ctx, uint64_t oxid) +struct dcom_object_exporter *oxid_mapping_by_oxid (struct dcom_context *ctx, uint64_t oxid) { struct dcom_object_exporter *m; @@ -144,7 +144,7 @@ WERROR dcom_ping(struct dcom_context *ctx) return WERR_OK; } -static WERROR dcom_create_object_remote(struct dcom_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct dcom_interface_p ***ip, WERROR *results) +static WERROR dcom_create_object(struct dcom_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct dcom_interface_p ***ip, WERROR *results) { uint16_t protseq[] = DCOM_NEGOTIATED_PROTOCOLS; struct dcerpc_pipe *p; @@ -154,6 +154,10 @@ static WERROR dcom_create_object_remote(struct dcom_context *ctx, struct GUID *c struct DUALSTRINGARRAY dualstring; int i; + if (!server) { + return com_create_object(ctx, clsid, num_ifaces, iid, ip, results); + } + 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))); @@ -208,60 +212,7 @@ static WERROR dcom_create_object_remote(struct dcom_context *ctx, struct GUID *c return WERR_OK; } -WERROR dcom_create_object(struct dcom_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct dcom_interface_p ***ip, WERROR *results) -{ - struct dcom_interface_p *factory, *iunk = NULL; - struct QueryInterface qr; - struct Release rr; - struct CreateInstance cr; - WERROR error; - int i; - NTSTATUS status; - - if (server != NULL) { - return dcom_create_object_remote(ctx, clsid, server, num_ifaces, iid, ip, results); - } - - /* Obtain class object */ - error = dcom_get_class_object(ctx, clsid, server, iid, &factory); - if (!W_ERROR_IS_OK(error)) { - DEBUG(3, ("Unable to obtain class object for %s\n", GUID_string(NULL, clsid))); - return error; - } - - dcom_OBJREF_from_ifacep(ctx, &cr.in.pUnknown->obj, factory); - - GUID_from_string(DCERPC_ICLASSFACTORY_UUID, cr.in.iid); - - /* Run IClassFactory::CreateInstance() */ - status = dcom_IClassFactory_CreateInstance(factory, ctx, &cr); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(3, ("Error while calling IClassFactory::CreateInstance : %s\n", nt_errstr(status))); - return ntstatus_to_werror(status); - } - - /* Release class object */ - status = dcom_IUnknown_Release(factory, ctx, &rr); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(3, ("Error freeing class factory: %s\n", nt_errstr(status))); - return ntstatus_to_werror(status); - } - - /* Do one or more QueryInterface calls */ - for (i = 0; i < num_ifaces; i++) { - qr.in.iid = &iid[i]; - status = dcom_IUnknown_QueryInterface(iunk, ctx, &qr); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(4, ("Error obtaining interface %s : %s\n", GUID_string(NULL, &iid[i]), nt_errstr(status))); - return ntstatus_to_werror(status); - } - results[i] = qr.out.result; - } - - return WERR_OK; -} - -WERROR dcom_get_class_object_remote(struct dcom_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct dcom_interface_p **ip) +WERROR dcom_get_class_object(struct dcom_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct dcom_interface_p **ip) { struct dcom_object_exporter *m; struct RemoteActivation r; @@ -271,6 +222,10 @@ WERROR dcom_get_class_object_remote(struct dcom_context *ctx, struct GUID *clsid struct pMInterfacePointer pm; 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))); @@ -312,36 +267,6 @@ WERROR dcom_get_class_object_remote(struct dcom_context *ctx, struct GUID *clsid return WERR_OK; } -WERROR dcom_get_class_object(struct dcom_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct dcom_interface_p **ip) -{ - const struct dcom_class *c; - struct QueryInterface qi; - NTSTATUS status; - - if (server != NULL) { - return dcom_get_class_object_remote(ctx, clsid, server, iid, ip); - } - - c = dcom_class_by_clsid(clsid); - if (!c) { - /* FIXME: Better error code.. */ - return WERR_DEST_NOT_FOUND; - } - - qi.in.iid = iid; - - status = dcom_IUnknown_QueryInterface(c->class_object, ctx, &qi ); - if (NT_STATUS_IS_ERR(status)) { - return ntstatus_to_werror(status); - } - - if (!W_ERROR_IS_OK(qi.out.result)) { return qi.out.result; } - - dcom_ifacep_from_OBJREF(ctx, ip, &qi.out.data->obj); - - return WERR_OK; -} - NTSTATUS dcom_get_pipe (struct dcom_interface_p *iface, struct dcerpc_pipe **pp) { struct dcerpc_binding binding; @@ -549,26 +474,3 @@ uint64_t dcom_get_current_oxid(void) { return getpid(); } - -struct dcom_interface_p *dcom_new_local_ifacep(struct dcom_context *ctx, const struct GUID *iid, void *vtable, struct dcom_object *object) -{ - struct dcom_interface_p *ip = talloc(ctx, struct dcom_interface_p); - const struct dcom_interface *iface = dcom_interface_by_iid(iid); - - if (!iface) { - DEBUG (1, ("Unable to find interface with IID %s\n", GUID_string(ctx, iid))); - return NULL; - } - - ip->ctx = ctx; - ip->interface = iface; - ip->vtable = vtable; - ip->ipid = GUID_random(); - ip->object = object; - ip->objref_flags = 0; - ip->orpc_flags = 0; - ip->ox = NULL; - ip->private_references = 1; - - return ip; -} diff --git a/source4/lib/dcom/common/tables.c b/source4/lib/dcom/common/tables.c deleted file mode 100644 index cd7e0867ee..0000000000 --- a/source4/lib/dcom/common/tables.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - Unix SMB/CIFS implementation. - DCOM interface and class tables - Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org> - - 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" - -static struct class_list { - struct class_list *prev, *next; - struct dcom_class class; -} *classes = NULL; - -static struct interface_list { - struct interface_list *prev, *next; - struct dcom_interface interface; -} *interfaces = NULL; - -const struct dcom_interface *dcom_interface_by_iid(const struct GUID *iid) -{ - struct interface_list *l = interfaces; - - while(l) { - - if (GUID_equal(iid, &l->interface.iid)) - return &l->interface; - - l = l->next; - } - - return NULL; -} - -const struct dcom_class *dcom_class_by_clsid(const struct GUID *clsid) -{ - struct class_list *c = classes; - - while(c) { - - if (GUID_equal(clsid, &c->class.clsid)) { - return &c->class; - } - - c = c->next; - } - - return NULL; -} - -const void *dcom_proxy_vtable_by_iid(const struct GUID *iid) -{ - const struct dcom_interface *iface = dcom_interface_by_iid(iid); - - if (!iface) { - return NULL; - } - - return iface->proxy_vtable; -} - -NTSTATUS dcom_register_interface(const void *_iface) -{ - const struct dcom_interface *iface = _iface; - struct interface_list *l; - TALLOC_CTX *lcl_ctx = talloc_init("dcom_register_interface"); - - DEBUG(5, ("Adding DCOM interface %s\n", GUID_string(lcl_ctx, &iface->iid))); - - talloc_free(lcl_ctx); - - l = talloc_zero(interfaces?interfaces:talloc_autofree_context(), - struct interface_list); - - l->interface = *iface; - - DLIST_ADD(interfaces, l); - - return NT_STATUS_OK; -} - -NTSTATUS dcom_register_class(const void *_class) -{ - const struct dcom_class *class = _class; - struct class_list *l = talloc_zero(classes?classes:talloc_autofree_context(), - struct class_list); - - l->class = *class; - - DLIST_ADD(classes, l); - - return NT_STATUS_OK; -} diff --git a/source4/lib/dcom/config.mk b/source4/lib/dcom/config.mk index ca280884ea..ae8fe9c4b0 100644 --- a/source4/lib/dcom/config.mk +++ b/source4/lib/dcom/config.mk @@ -1,19 +1,19 @@ ################################################ # Start SUBSYSTEM LIBDCOM -[SUBSYSTEM::LIBDCOM] -INIT_OBJ_FILES = \ - lib/dcom/common/main.o \ - lib/dcom/common/tables.o \ - lib/dcom/common/rot.o -REQUIRED_SUBSYSTEMS = DCOM_PROXY_DCOM RPC_NDR_REMACT \ - RPC_NDR_OXIDRESOLVER +#[SUBSYSTEM::LIBDCOM] +#ENABLE = NO +#INIT_OBJ_FILES = \ +# lib/dcom/common/main.o +#REQUIRED_SUBSYSTEMS = LIBCOM DCOM_PROXY_DCOM RPC_NDR_REMACT \ +# RPC_NDR_OXIDRESOLVER -[MODULE::DCOM_SIMPLE] -SUBSYSTEM = LIBDCOM -REQUIRED_SUBSYSTEMS = DCOM_PROXY_DCOM -INIT_FUNCTION = dcom_simple_init -INIT_OBJ_FILES = \ - lib/dcom/classes/simple.o +#[MODULE::DCOM_SIMPLE] +#ENABLE = NO +#SUBSYSTEM = LIBDCOM +#REQUIRED_SUBSYSTEMS = DCOM_PROXY_DCOM +#INIT_FUNCTION = dcom_simple_init +#INIT_OBJ_FILES = \ +# lib/dcom/classes/simple.o # # End SUBSYSTEM LIBDCOM ################################################ |