Fix more unresolved symbols.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 22 Apr 2009 23:21:47 +0000 (01:21 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 2 Jun 2009 16:05:41 +0000 (18:05 +0200)
14 files changed:
source4/auth/credentials/pycredentials.c
source4/auth/credentials/pycredentials.h
source4/cldap_server/config.mk
source4/dsdb/config.mk
source4/dsdb/samdb/ldb_modules/config.mk
source4/lib/ldb/ldb.mk
source4/lib/ldb/pyldb.c
source4/lib/ldb/pyldb.h
source4/lib/ldb/python.mk
source4/librpc/rpc/pyrpc.c
source4/nbt_server/config.mk
source4/param/config.mk
source4/scripting/python/pyglue.c
source4/scripting/python/samba/__init__.py

index 3eacf9ada1fcd487f1b4281003ed153cf317b14c..de5cc87194769a54f90c082ccd952d91375be57d 100644 (file)
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
-{
-    if (py_obj == Py_None) {
-        return cli_credentials_init_anon(NULL);
-    }
-
-    return PyCredentials_AsCliCredentials(py_obj);
-}
-
 static PyObject *PyString_FromStringOrNULL(const char *str)
 {
        if (str == NULL)
index f2e15fad61d119f525dcabb538e75def20a7cec8..1889248f05c10951ed6e23021f4b05af28780ab8 100644 (file)
@@ -23,8 +23,8 @@
 #include "pytalloc.h"
 
 PyAPI_DATA(PyTypeObject) PyCredentials;
-struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
 #define PyCredentials_Check(py_obj) PyObject_TypeCheck(py_obj, &PyCredentials)
 #define PyCredentials_AsCliCredentials(py_obj) py_talloc_get_type(py_obj, struct cli_credentials)
+#define cli_credentials_from_py_object(py_obj) (py_obj == Py_None)?cli_credentials_init_anon(NULL):PyCredentials_AsCliCredentials(py_obj)
 
 #endif /*  _PYCREDENTIALS_H_ */
index 045fca3fd0087634c7bcde93e65473fab43bbc5e..49d2a1fba3806c0a4ad55c9c5524b80f388a0299 100644 (file)
@@ -1,17 +1,23 @@
 # CLDAP server subsystem
-
-#######################
-# Start SUBSYSTEM CLDAPD
-[MODULE::CLDAPD]
+#
+[MODULE::service_cldap]
 INIT_FUNCTION = server_service_cldapd_init
 SUBSYSTEM = service
 PRIVATE_DEPENDENCIES = \
-               LIBCLI_CLDAP LIBNETIF process_model
+               CLDAPD process_model LIBNETIF
+
+service_cldap_OBJ_FILES = $(addprefix $(cldap_serversrcdir)/, \
+               cldap_server.o)
+
+
+#######################
+# Start SUBSYSTEM CLDAPD
+[SUBSYSTEM::CLDAPD]
+PRIVATE_DEPENDENCIES = LIBCLI_CLDAP
 # End SUBSYSTEM CLDAPD
 #######################
 
 CLDAPD_OBJ_FILES = $(addprefix $(cldap_serversrcdir)/, \
-               cldap_server.o \
                netlogon.o \
                rootdse.o)
 
index 664f5150bebf4db797b0639bc1f41c3b1363a8d6..04386476983f7c686523ab4057fdd6aecb25a182 100644 (file)
@@ -5,11 +5,11 @@ mkinclude samdb/ldb_modules/config.mk
 ################################################
 # Start SUBSYSTEM SAMDB
 [SUBSYSTEM::SAMDB]
-PUBLIC_DEPENDENCIES = HEIMDAL_KRB5 
+PUBLIC_DEPENDENCIES = HEIMDAL_KRB5  
 PRIVATE_DEPENDENCIES = LIBNDR NDR_DRSUAPI NDR_DRSBLOBS NSS_WRAPPER \
                                           auth_system_session LDAP_ENCODE LIBCLI_AUTH LIBNDR \
                                           SAMDB_SCHEMA LDB_WRAP SAMDB_COMMON \
-                                               LIBCLI_DRSUAPI LIBCLI_LDAP_NDR
+                                               LIBCLI_DRSUAPI LIBCLI_LDAP_NDR LIBSAMBA-UTIL 
 
 
 SAMDB_OBJ_FILES = $(addprefix $(dsdbsrcdir)/, \
@@ -52,7 +52,8 @@ INIT_FUNCTION = server_service_drepl_init
 SUBSYSTEM = service
 PRIVATE_DEPENDENCIES = \
                SAMDB \
-               process_model 
+               process_model \
+               RPC_NDR_DRSUAPI
 # End SUBSYSTEM DREPL_SRV
 #######################
 
index 583d1dcf042e1a2a7bfc7dfa006132e4d5729386..c039dda065e767cbe50ff77762f8030f3390127d 100644 (file)
@@ -174,7 +174,7 @@ ldb_kludge_acl_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/kludge_acl.o
 # Start MODULE ldb_extended_dn_in
 [MODULE::ldb_extended_dn_in]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 INIT_FUNCTION = LDB_MODULE(extended_dn_in)
 # End MODULE ldb_extended_dn_in
 ################################################
@@ -185,7 +185,7 @@ ldb_extended_dn_in_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_in.o
 # Start MODULE ldb_extended_dn_out
 [MODULE::ldb_extended_dn_out]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR LIBSAMBA-UTIL SAMDB
 INIT_FUNCTION = LDB_MODULE(extended_dn_out_ldb),LDB_MODULE(extended_dn_out_dereference)
 ENABLE = YES
 ALIASES = extended_dn_out_ldb extended_dn_out_dereference
@@ -198,7 +198,7 @@ ldb_extended_dn_out_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_out.
 # Start MODULE ldb_extended_dn_store
 [MODULE::ldb_extended_dn_store]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL SAMDB
 INIT_FUNCTION = LDB_MODULE(extended_dn_store)
 # End MODULE ldb_extended_dn_store
 ################################################
@@ -209,7 +209,7 @@ ldb_extended_dn_store_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/extended_dn_st
 # Start MODULE ldb_show_deleted
 [MODULE::ldb_show_deleted]
 SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 INIT_FUNCTION = LDB_MODULE(show_deleted)
 # End MODULE ldb_show_deleted
 ################################################
@@ -256,7 +256,7 @@ ldb_objectclass_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/objectclass.o
 [MODULE::ldb_subtree_rename]
 INIT_FUNCTION = LDB_MODULE(subtree_rename)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_subtree_rename
 ################################################
@@ -268,7 +268,7 @@ ldb_subtree_rename_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/subtree_rename.o
 [MODULE::ldb_subtree_delete]
 INIT_FUNCTION = LDB_MODULE(subtree_delete)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_subtree_rename
 ################################################
@@ -292,7 +292,7 @@ ldb_linked_attributes_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/linked_attribu
 [MODULE::ldb_ranged_results]
 INIT_FUNCTION = LDB_MODULE(ranged_results)
 CFLAGS = -Ilib/ldb/include
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSAMBA-UTIL
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_ranged_results
 ################################################
index 0589baf5d4aa44ef210ee3898b96efd23c7b1122..a9a6dad46d5aeb5b0a93d33397fa4830fc4deec9 100644 (file)
@@ -67,8 +67,11 @@ build-python:: ldb.$(SHLIBEXT)
 pyldb.o: $(ldbdir)/pyldb.c
        $(CC) $(PICFLAG) -c $(ldbdir)/pyldb.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
 
-ldb.$(SHLIBEXT): pyldb.o
-       $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags`
+pyldb_util.o: $(ldbdir)/pyldb_util.c
+       $(CC) $(PICFLAG) -c $(ldbdir)/pyldb_util.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+
+ldb.$(SHLIBEXT): pyldb.o pyldb_util.o
+       $(SHLD) $(SHLD_FLAGS) -o ldb.$(SHLIBEXT) pyldb.o pyldb_util.o $(LIB_FLAGS) `$(PYTHON_CONFIG) --ldflags`
 
 install-python:: build-python
        mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
index bceda05e4fd4f7aa8077c551ba83b40f7e8df956..bfa152b34631c58d5831669fe00cdfbc2e648692 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/CIFS implementation.
 
-   Swig interface to ldb.
+   Python interface to ldb.
 
    Copyright (C) 2005,2006 Tim Potter <tpot@samba.org>
    Copyright (C) 2006 Simo Sorce <idra@samba.org>
@@ -41,25 +41,19 @@ typedef intargfunc ssizeargfunc;
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 #endif
 
-/* Picked out of thin air. To do this properly, we should probably have some part of the 
- * errors in LDB be allocated to bindings ? */
-#define LDB_ERR_PYTHON_EXCEPTION       142
-
 static PyObject *PyExc_LdbError;
 
-void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx)
-{
-       if (ret == LDB_ERR_PYTHON_EXCEPTION)
-               return; /* Python exception should already be set, just keep that */
-       PyErr_SetObject(PyExc_LdbError, Py_BuildValue(discard_const_p(char, "(i,s)"),
-                       ret, ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx)));
-}
+PyAPI_DATA(PyTypeObject) PyLdbMessage;
+PyAPI_DATA(PyTypeObject) PyLdbModule;
+PyAPI_DATA(PyTypeObject) PyLdbDn;
+PyAPI_DATA(PyTypeObject) PyLdb;
+PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
+PyAPI_DATA(PyTypeObject) PyLdbTree;
 
 static PyObject *PyObject_FromLdbValue(struct ldb_context *ldb_ctx, 
                                                           struct ldb_message_element *el, 
                                                           struct ldb_val *val)
 {
-       const struct ldb_schema_attribute *a;
        struct ldb_val new_val;
        TALLOC_CTX *mem_ctx = talloc_new(NULL);
        PyObject *ret;
@@ -390,7 +384,7 @@ static PyObject *py_ldb_set_debug(PyLdbObject *self, PyObject *args)
 
        Py_INCREF(cb);
        /* FIXME: Where do we DECREF cb ? */
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_set_debug(self->ldb_ctx, py_ldb_debug, cb), PyLdb_AsLdbContext(self));
        
        Py_RETURN_NONE;
 }
@@ -419,25 +413,25 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args)
 
 static PyObject *py_ldb_transaction_start(PyLdbObject *self)
 {
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_start(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
        Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_transaction_commit(PyLdbObject *self)
 {
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_commit(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
        Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_transaction_cancel(PyLdbObject *self)
 {
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_transaction_cancel(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
        Py_RETURN_NONE;
 }
 
 static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self)
 {
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_setup_wellknown_attributes(PyLdb_AsLdbContext(self)), PyLdb_AsLdbContext(self));
        Py_RETURN_NONE;
 }
 
@@ -529,7 +523,7 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs)
        if (url != NULL) {
                ret = ldb_connect(ldb, url, flags, options);
                if (ret != LDB_SUCCESS) {
-                       PyErr_SetLdbError(ret, ldb);
+                       PyErr_SetLdbError(PyExc_LdbError, ret, ldb);
                        return -1;
                }
        }
@@ -582,7 +576,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa
        ret = ldb_connect(PyLdb_AsLdbContext(self), url, flags, options);
        talloc_free(options);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, PyLdb_AsLdbContext(self));
 
        Py_RETURN_NONE;
 }
@@ -600,7 +594,7 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args)
        }
 
        ret = ldb_modify(PyLdb_AsLdbContext(self), PyLdbMessage_AsMessage(py_msg));
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, PyLdb_AsLdbContext(self));
 
        Py_RETURN_NONE;
 }
@@ -657,7 +651,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args)
        }
        
        ret = ldb_add(PyLdb_AsLdbContext(self), msg);
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, PyLdb_AsLdbContext(self));
 
        Py_RETURN_NONE;
 }
@@ -677,7 +671,7 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args)
                return NULL;
 
        ret = ldb_delete(ldb, dn);
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb);
 
        Py_RETURN_NONE;
 }
@@ -699,7 +693,7 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args)
                return NULL;
 
        ret = ldb_rename(ldb, dn1, dn2);
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb);
 
        Py_RETURN_NONE;
 }
@@ -725,7 +719,7 @@ static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args)
 
        ret = ldb_schema_attribute_add(PyLdb_AsLdbContext(self), attribute, flags, syntax);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, PyLdb_AsLdbContext(self));
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, PyLdb_AsLdbContext(self));
 
        Py_RETURN_NONE;
 }
@@ -860,7 +854,7 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar
 
        if (ret != LDB_SUCCESS) {
                talloc_free(res);
-               PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb_ctx);
+               PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx);
                return NULL;
        }
 
@@ -874,7 +868,7 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar
 
        if (ret != LDB_SUCCESS) {
                talloc_free(res);
-               PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb_ctx);
+               PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx);
                return NULL;
        }
 
@@ -1044,7 +1038,7 @@ static int py_ldb_contains(PyLdbObject *self, PyObject *obj)
 
        ret = ldb_search(ldb_ctx, ldb_ctx, &result, dn, LDB_SCOPE_BASE, NULL, NULL);
        if (ret != LDB_SUCCESS) {
-               PyErr_SetLdbError(ret, ldb_ctx);
+               PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx);
                return -1;
        }
 
@@ -1140,12 +1134,12 @@ static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, P
        ret = ldb_build_search_req(&req, mod->ldb, NULL, PyLdbDn_AsDn(py_base), 
                             scope, NULL /* expr */, py_attrs == Py_None?NULL:PyList_AsStringList(req, py_attrs, "attrs"),
                             NULL /* controls */, NULL, NULL, NULL);
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, mod->ldb);
 
        ret = mod->ops->search(mod, req);
        talloc_free(req);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, mod->ldb);
 
        return PyLdbResult_FromResult(req->op.search.res);
 }
@@ -1168,7 +1162,7 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args)
        mod = PyLdbModule_AsModule(self);
        ret = mod->ops->add(mod, req);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, mod->ldb);
 
        Py_RETURN_NONE;
 }
@@ -1190,7 +1184,7 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args)
        mod = PyLdbModule_AsModule(self);
        ret = mod->ops->modify(mod, req);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, mod->ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, mod->ldb);
 
        Py_RETURN_NONE;
 }
@@ -1210,7 +1204,7 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args)
        
        ret = PyLdbModule_AsModule(self)->ops->del(PyLdbModule_AsModule(self), req);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, NULL);
 
        Py_RETURN_NONE;
 }
@@ -1232,7 +1226,7 @@ static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args)
        
        ret = PyLdbModule_AsModule(self)->ops->rename(PyLdbModule_AsModule(self), req);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, NULL);
 
        Py_RETURN_NONE;
 }
@@ -2045,7 +2039,7 @@ static PyObject *py_register_module(PyObject *module, PyObject *args)
 
        ret = ldb_register_module(ops);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, NULL);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, NULL);
 
        Py_RETURN_NONE;
 }
index 731911a38793dc47696f729d26722d55bd787a4f..931dd7eeae2617d737c4c0fb8b529a961409e467 100644 (file)
@@ -34,7 +34,6 @@ typedef struct {
        TALLOC_CTX *mem_ctx;
 } PyLdbObject;
 
-PyAPI_DATA(PyTypeObject) PyLdb;
 PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx);
 #define PyLdb_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
 #define PyLdb_Check(ob) PyObject_TypeCheck(ob, &PyLdb)
@@ -45,7 +44,6 @@ typedef struct {
        TALLOC_CTX *mem_ctx;
 } PyLdbDnObject;
 
-PyAPI_DATA(PyTypeObject) PyLdbDn;
 PyObject *PyLdbDn_FromDn(struct ldb_dn *);
 bool PyObject_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
 #define PyLdbDn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
@@ -56,8 +54,6 @@ typedef struct {
        struct ldb_message *msg;
        TALLOC_CTX *mem_ctx;
 } PyLdbMessageObject;
-PyAPI_DATA(PyTypeObject) PyLdbMessage;
-PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
 #define PyLdbMessage_Check(ob) PyObject_TypeCheck(ob, &PyLdbMessage)
 #define PyLdbMessage_AsMessage(pyobj) ((PyLdbMessageObject *)pyobj)->msg
 
@@ -66,7 +62,7 @@ typedef struct {
        struct ldb_module *mod;
        TALLOC_CTX *mem_ctx;
 } PyLdbModuleObject;
-PyAPI_DATA(PyTypeObject) PyLdbModule;
+PyObject *PyLdbMessage_FromMessage(struct ldb_message *message);
 PyObject *PyLdbModule_FromModule(struct ldb_module *mod);
 #define PyLdbModule_AsModule(pyobj) ((PyLdbModuleObject *)pyobj)->mod
 
@@ -75,7 +71,6 @@ typedef struct {
        struct ldb_message_element *el;
        TALLOC_CTX *mem_ctx;
 } PyLdbMessageElementObject;
-PyAPI_DATA(PyTypeObject) PyLdbMessageElement;
 struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, PyObject *obj, int flags, const char *name);
 PyObject *PyLdbMessageElement_FromMessageElement(struct ldb_message_element *, TALLOC_CTX *mem_ctx);
 #define PyLdbMessageElement_AsMessageElement(pyobj) ((PyLdbMessageElementObject *)pyobj)->el
@@ -86,16 +81,18 @@ typedef struct {
        struct ldb_parse_tree *tree;
        TALLOC_CTX *mem_ctx;
 } PyLdbTreeObject;
-PyAPI_DATA(PyTypeObject) PyLdbTree;
 PyObject *PyLdbTree_FromTree(struct ldb_parse_tree *);
 #define PyLdbTree_AsTree(pyobj) ((PyLdbTreeObject *)pyobj)->tree
 
-void PyErr_SetLdbError(int ret, struct ldb_context *ldb_ctx);
-#define PyErr_LDB_ERROR_IS_ERR_RAISE(ret,ldb) \
+void PyErr_SetLdbError(PyObject *exctype, int ret, struct ldb_context *ldb_ctx);
+#define PyErr_LDB_ERROR_IS_ERR_RAISE(err,ret,ldb) \
        if (ret != LDB_SUCCESS) { \
-               PyErr_SetLdbError(ret, ldb); \
+               PyErr_SetLdbError(err, ret, ldb); \
                return NULL; \
        }
 
+/* Picked out of thin air. To do this properly, we should probably have some part of the 
+ * errors in LDB be allocated to bindings ? */
+#define LDB_ERR_PYTHON_EXCEPTION       142
 
 #endif /* _PYLDB_H_ */
index 6cc6d2e90e76fe5063803e44daee7df21771a9d0..90f62c9040f45faea17198ec42bb18390731c2ce 100644 (file)
@@ -1,6 +1,13 @@
 [PYTHON::pyldb]
 LIBRARY_REALNAME = ldb.$(SHLIBEXT)
 PUBLIC_DEPENDENCIES = LIBLDB PYTALLOC
+PRIVATE_DEPENDENCIES = pyldb_util
 
-pyldb_OBJ_FILES = $(ldbsrcdir)/pyldb.o
+pyldb_OBJ_FILES = $(ldbsrcdir)/pyldb.o 
+$(pyldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include
+
+[SUBSYSTEM::pyldb_util]
+PUBLIC_DEPENDENCIES = LIBPYTHON
+
+pyldb_util_OBJ_FILES = $(ldbsrcdir)/pyldb_util.o
 $(pyldb_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir)/include
index 82bb870f40b230c772ea6e83c07a17c5219e9e7e..e50a0776258e341001bb253cfe727a2e00e69726 100644 (file)
@@ -24,6 +24,7 @@
 #include "librpc/rpc/dcerpc.h"
 #include "lib/events/events.h"
 #include "param/pyparam.h"
+#include "auth/credentials/pycredentials.h"
 
 #ifndef Py_RETURN_NONE
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
@@ -311,7 +312,6 @@ PyObject *py_dcerpc_interface_init_helper(PyTypeObject *type, PyObject *args, Py
        const char *kwnames[] = {
                "binding", "lp_ctx", "credentials", "basis_connection", NULL
        };
-       extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|OOO:samr", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials, &py_basis)) {
                return NULL;
@@ -392,7 +392,6 @@ static PyObject *dcerpc_interface_new(PyTypeObject *self, PyObject *args, PyObje
        const char *kwnames[] = {
                "binding", "syntax", "lp_ctx", "credentials", "basis_connection", NULL
        };
-       extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
        struct ndr_interface_table *table;
 
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO|OOO:connect", discard_const_p(char *, kwnames), &binding_string, &syntax, &py_lp_ctx, &py_credentials, &py_basis)) {
index afd92421884b7718a38973876332bb6ff746495c..ba5531da7e2c972fc7f08d684bb0c7c1df5dc1a0 100644 (file)
@@ -41,7 +41,7 @@ $(eval $(call proto_header_template,$(nbt_serversrcdir)/wins/winsserver_proto.h,
 # Start SUBSYSTEM NBTD_DGRAM
 [SUBSYSTEM::NBTD_DGRAM]
 PRIVATE_DEPENDENCIES = \
-               LIBCLI_DGRAM
+               LIBCLI_DGRAM CLDAPD
 # End SUBSYSTEM NBTD_DGRAM
 #######################
 
index d420a3883cc51efa22cfb3cf4263483be725a2f6..6e5290b64d96aaf77eaa3c444fd37e3d77079a7e 100644 (file)
@@ -13,7 +13,7 @@ PUBLIC_HEADERS += param/param.h
 PC_FILES += $(paramsrcdir)/samba-hostconfig.pc
 
 [SUBSYSTEM::PROVISION]
-PRIVATE_DEPENDENCIES = LIBPYTHON pyldb
+PRIVATE_DEPENDENCIES = LIBPYTHON pyldb pyparam_util
 
 PROVISION_OBJ_FILES = $(paramsrcdir)/provision.o $(param_OBJ_FILES)
 
@@ -62,3 +62,8 @@ LIBRARY_REALNAME = samba/param.$(SHLIBEXT)
 PRIVATE_DEPENDENCIES = LIBSAMBA-HOSTCONFIG PYTALLOC
 
 param_OBJ_FILES = $(paramsrcdir)/pyparam.o
+
+[SUBSYSTEM::pyparam_util]
+PRIVATE_DEPENDENCIES = LIBPYTHON
+
+pyparam_util_OBJ_FILES = $(paramsrcdir)/pyparam_util.o
index 1480e54403667217a7b5c61fea773ac58e918376..5816d9637d8e3a973474c4e4ad91da86f01f5859 100644 (file)
@@ -31,6 +31,7 @@
 #include "libcli/security/security.h"
 #include "auth/pyauth.h"
 #include "param/pyparam.h"
+#include "auth/credentials/pycredentials.h"
 
 #ifndef Py_RETURN_NONE
 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
 
 /* FIXME: These should be in a header file somewhere, once we finish moving
  * away from SWIG .. */
-extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);
-
 #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
-       if (!PyLdb_Check(py_ldb)) { \
-               /*PyErr_SetString(PyExc_TypeError, "Ldb connection object required"); \
-               return NULL; \ */ \
-       } \
+/*     if (!PyLdb_Check(py_ldb)) { \
+               PyErr_SetString(py_ldb_get_exception(), "Ldb connection object required"); \
+               return NULL; \
+       } */\
        ldb = PyLdb_AsLdbContext(py_ldb);
 
 
+static PyObject *py_ldb_get_exception(void)
+{
+       PyObject *mod = PyImport_ImportModule("ldb");
+       if (mod == NULL)
+               return NULL;
+
+       return PyObject_GetAttrString(mod, "LdbError");
+}
+
 static PyObject *py_generate_random_str(PyObject *self, PyObject *args)
 {
        int len;
@@ -90,7 +98,7 @@ static PyObject *py_ldb_set_credentials(PyObject *self, PyObject *args)
                return NULL;
        }
 
-       ldb_set_opaque(ldb, "credentials", creds);
+       ldb_set_opaque(ldb, "credentials", creds);
 
        Py_RETURN_NONE;
 }
@@ -172,7 +180,7 @@ static PyObject *py_ldb_register_samba_handlers(PyObject *self, PyObject *args)
        PyErr_LDB_OR_RAISE(py_ldb, ldb);
        ret = ldb_register_samba_handlers(ldb);
 
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
        Py_RETURN_NONE;
 }
 
@@ -207,7 +215,7 @@ static PyObject *py_dsdb_set_global_schema(PyObject *self, PyObject *args)
        PyErr_LDB_OR_RAISE(py_ldb, ldb);
 
        ret = dsdb_set_global_schema(ldb);
-       PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb);
+       PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
 
        Py_RETURN_NONE;
 }
index 3ecb758595e2836d1ccb971ac661ef11bcf2f21f..f93b0eda6046f378123e33ee83b820f4c9d93cd0 100644 (file)
@@ -28,7 +28,7 @@ import os
 
 def _in_source_tree():
     """Check whether the script is being run from the source dir. """
-    return os.path.exists("%s/../../../samba4-skip" % os.path.dirname(__file__))
+    return os.path.exists("%s/../../../selftest/skip" % os.path.dirname(__file__))
 
 
 # When running, in-tree, make sure bin/python is in the PYTHONPATH