summaryrefslogtreecommitdiff
path: root/source4/lib/dcom
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-01-09 21:35:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:35 -0500
commit1b1b678cc8c79dacc3b80de4f8203154d47c0345 (patch)
tree91a0bea56f16740a41ff64ba95914c4c06f89b11 /source4/lib/dcom
parent1303f51099c2054c3966c6ba34490c5ffad85c13 (diff)
downloadsamba-1b1b678cc8c79dacc3b80de4f8203154d47c0345.tar.gz
samba-1b1b678cc8c79dacc3b80de4f8203154d47c0345.tar.bz2
samba-1b1b678cc8c79dacc3b80de4f8203154d47c0345.zip
r4624: Several crash fixes for DCOM
More work on the example class implementation (This used to be commit 1f8f4dd179d5aa0472c676d115dc2fc1749ce32d)
Diffstat (limited to 'source4/lib/dcom')
-rw-r--r--source4/lib/dcom/classes/simple.c31
-rw-r--r--source4/lib/dcom/common/main.c8
-rw-r--r--source4/lib/dcom/common/tables.c5
-rw-r--r--source4/lib/dcom/config.mk1
4 files changed, 41 insertions, 4 deletions
diff --git a/source4/lib/dcom/classes/simple.c b/source4/lib/dcom/classes/simple.c
index 90dda6bc84..e5b5bf3f41 100644
--- a/source4/lib/dcom/classes/simple.c
+++ b/source4/lib/dcom/classes/simple.c
@@ -21,7 +21,25 @@
#include "includes.h"
#include "lib/dcom/common/dcom.h"
-static struct dcom_IClassFactory_vtable simple_classobject;
+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)
{
@@ -32,10 +50,17 @@ NTSTATUS dcom_simple_init(void)
GUID_from_string(DCERPC_IUNKNOWN_UUID, &iid);
- simple_class.class_object = dcom_new_local_ifacep(talloc_autofree_context(),
- dcom_interface_by_iid(&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_FOOBAR;
+ }
+
GUID_from_string("5e9ddec7-5767-11cf-beab-00aa006c3606", &simple_class.clsid);
+
return dcom_register_class(&simple_class);
}
diff --git a/source4/lib/dcom/common/main.c b/source4/lib/dcom/common/main.c
index b9f6127c6c..48b5ec946b 100644
--- a/source4/lib/dcom/common/main.c
+++ b/source4/lib/dcom/common/main.c
@@ -549,9 +549,15 @@ HYPER_T dcom_get_current_oxid(void)
return getpid();
}
-struct dcom_interface_p *dcom_new_local_ifacep(struct dcom_context *ctx, const struct dcom_interface *iface, void *vtable, struct dcom_object *object)
+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_p(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;
diff --git a/source4/lib/dcom/common/tables.c b/source4/lib/dcom/common/tables.c
index faf67710e0..8a764d0a65 100644
--- a/source4/lib/dcom/common/tables.c
+++ b/source4/lib/dcom/common/tables.c
@@ -77,7 +77,12 @@ 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_destroy(lcl_ctx);
+
l = talloc_zero_p(interfaces?interfaces:talloc_autofree_context(),
struct interface_list);
diff --git a/source4/lib/dcom/config.mk b/source4/lib/dcom/config.mk
index d599231525..ca280884ea 100644
--- a/source4/lib/dcom/config.mk
+++ b/source4/lib/dcom/config.mk
@@ -10,6 +10,7 @@ REQUIRED_SUBSYSTEMS = DCOM_PROXY_DCOM RPC_NDR_REMACT \
[MODULE::DCOM_SIMPLE]
SUBSYSTEM = LIBDCOM
+REQUIRED_SUBSYSTEMS = DCOM_PROXY_DCOM
INIT_FUNCTION = dcom_simple_init
INIT_OBJ_FILES = \
lib/dcom/classes/simple.o