The branch, master has been updated
       via  495758a73e125e59921092c893c6e32ba7091fe1 (commit)
      from  ba5fe7122586d8b382bf78f1e1cb5dbe4293c27b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 495758a73e125e59921092c893c6e32ba7091fe1
Author: Jelmer Vernooij <[EMAIL PROTECTED]>
Date:   Fri Sep 19 02:27:40 2008 +0200

    Fix COM compilation, add framework for COM python module.

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/com/com.h     |    2 +
 source4/lib/com/config.mk |    9 +++++-
 source4/lib/com/main.c    |   22 +-------------
 source4/lib/com/pycom.c   |   70 +++++++++++++++++++++++++++++++++++++++++++++
 source4/lib/com/rot.c     |    1 +
 5 files changed, 82 insertions(+), 22 deletions(-)
 create mode 100644 source4/lib/com/pycom.c


Changeset truncated at 500 lines:

diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h
index 2074bd1..5d594ad 100644
--- a/source4/lib/com/com.h
+++ b/source4/lib/com/com.h
@@ -47,4 +47,6 @@ WERROR com_create_object(struct com_context *ctx, struct GUID 
*clsid, int num_if
 WERROR com_get_class_object(struct com_context *ctx, struct GUID *clsid, 
struct GUID *iid, struct IUnknown **ip);
 NTSTATUS com_init(void);
 
+typedef struct IUnknown *(*get_class_object_function) (const struct GUID 
*clsid);
+
 #endif /* __SAMBA_COM_H__ */
diff --git a/source4/lib/com/config.mk b/source4/lib/com/config.mk
index 5c8e98d..c5c5a35 100644
--- a/source4/lib/com/config.mk
+++ b/source4/lib/com/config.mk
@@ -1,9 +1,10 @@
 [SUBSYSTEM::COM]
+PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG LIBEVENTS LIBNDR
 
 COM_OBJ_FILES = $(addprefix lib/com/, tables.o rot.o main.o)
 
 [SUBSYSTEM::DCOM]
-PUBLIC_DEPENDENCIES = com DCOM_PROXY_DCOM RPC_NDR_REMACT \
+PUBLIC_DEPENDENCIES = COM DCOM_PROXY_DCOM RPC_NDR_REMACT \
                                          RPC_NDR_OXIDRESOLVER
 
 DCOM_OBJ_FILES = $(addprefix lib/com/dcom/, main.o tables.o)
@@ -13,3 +14,9 @@ SUBSYSTEM = COM
 INIT_FUNCTION = com_simple_init
 
 com_simple_OBJ_FILES = lib/com/classes/simple.o
+
+[PYTHON::pycom]
+LIBRARY_REALNAME = samba/com.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = COM
+
+pycom_OBJ_FILES = lib/com/pycom.o
diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c
index 882b479..bcc5fa3 100644
--- a/source4/lib/com/main.c
+++ b/source4/lib/com/main.c
@@ -42,7 +42,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID 
*clsid, int num_if
        int i;
        struct GUID classfact_iid;
 
-       GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &classfact_iid);
+       GUID_from_string(NDR_ICLASSFACTORY_UUID, &classfact_iid);
 
        /* Obtain class object */
        error = com_get_class_object(ctx, clsid, &classfact_iid, (struct 
IUnknown **)&factory);
@@ -88,23 +88,3 @@ WERROR com_get_class_object(struct com_context *ctx, struct 
GUID *clsid, struct
        
        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/pycom.c b/source4/lib/com/pycom.c
new file mode 100644
index 0000000..b6d6b77
--- /dev/null
+++ b/source4/lib/com/pycom.c
@@ -0,0 +1,70 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Python bindings for COM library.
+   Copyright (C) Jelmer Vernooij <[EMAIL PROTECTED]> 2008
+   
+   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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include <Python.h>
+#include "lib/com/com.h"
+
+static PyObject *py_get_class_object(PyObject *self, PyObject *args)
+{
+       char *s_clsid, *s_iid;
+       struct GUID clsid, iid;
+       struct IUnknown *object;
+
+       if (!PyArg_ParseTuple(args, "ss", &s_clsid, &s_iid))
+               return NULL;
+
+       status = GUID_from_string(s_clsid, &clsid);
+       if (!NT_STATUS_IS_OK(status)) {
+               PyErr_FromNTSTATUS(status);
+               return NULL;
+       }
+
+       status = GUID_from_string(s_iid, &iid);
+       if (!NT_STATUS_IS_OK(status)) {
+               PyErr_FromNTSTATUS(status);
+               return NULL;
+       }
+
+       error = com_get_class_object(ctx, &clsid, &iid, &object);
+       if (!W_ERROR_IS_OK(error)) {
+               PyErr_FromWERROR(error);
+               return NULL;
+       }
+       
+       /* FIXME: Magic, integrate with stubs generated by pidl. */
+
+       return Py_None;
+}
+
+static struct PyMethodDef com_methods[] = {
+       { "get_class_object", (PyCFunction)py_get_class_object, METH_VARARGS, 
"S.get_class_object(clsid, iid) -> instance" },
+       { NULL },
+};
+
+void initcom(void)
+{
+       PyObject *m;
+
+       /* FIXME: Initialize COM context and attach it to m. */
+
+       m = Py_InitModule3("com", com_methods, "Simple COM implementation");
+       if (m == NULL)
+               return;
+}
diff --git a/source4/lib/com/rot.c b/source4/lib/com/rot.c
index 34a5671..0180a92 100644
--- a/source4/lib/com/rot.c
+++ b/source4/lib/com/rot.c
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "lib/com/com.h"
 
 struct dcom_interface_p *dcom_get_local_iface_p(struct GUID *ipid)
 {


-- 
Samba Shared Repository

Reply via email to