diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-04-23 01:21:47 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-06-02 18:05:41 +0200 |
commit | 6ace18904d638f1fb49c31041ba23353d97b40cb (patch) | |
tree | 5f9d99d9762fe435355dca79f430166b666a9060 | |
parent | fe2b04b4bba6585ee5377d44b8e2627d32d404c4 (diff) | |
download | samba-6ace18904d638f1fb49c31041ba23353d97b40cb.tar.gz |
Fix more unresolved symbols.
-rw-r--r-- | source4/auth/credentials/pycredentials.c | 9 | ||||
-rw-r--r-- | source4/auth/credentials/pycredentials.h | 2 | ||||
-rw-r--r-- | source4/cldap_server/config.mk | 18 | ||||
-rw-r--r-- | source4/dsdb/config.mk | 7 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/config.mk | 14 | ||||
-rw-r--r-- | source4/lib/ldb/ldb.mk | 7 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.c | 64 | ||||
-rw-r--r-- | source4/lib/ldb/pyldb.h | 17 | ||||
-rw-r--r-- | source4/lib/ldb/python.mk | 9 | ||||
-rw-r--r-- | source4/librpc/rpc/pyrpc.c | 3 | ||||
-rw-r--r-- | source4/nbt_server/config.mk | 2 | ||||
-rw-r--r-- | source4/param/config.mk | 7 | ||||
-rw-r--r-- | source4/scripting/python/pyglue.c | 26 | ||||
-rw-r--r-- | source4/scripting/python/samba/__init__.py | 2 |
14 files changed, 99 insertions, 88 deletions
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c index 3eacf9ada1f..de5cc871947 100644 --- a/source4/auth/credentials/pycredentials.c +++ b/source4/auth/credentials/pycredentials.c @@ -29,15 +29,6 @@ #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) diff --git a/source4/auth/credentials/pycredentials.h b/source4/auth/credentials/pycredentials.h index f2e15fad61d..1889248f05c 100644 --- a/source4/auth/credentials/pycredentials.h +++ b/source4/auth/credentials/pycredentials.h @@ -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_ */ diff --git a/source4/cldap_server/config.mk b/source4/cldap_server/config.mk index 045fca3fd00..49d2a1fba38 100644 --- a/source4/cldap_server/config.mk +++ b/source4/cldap_server/config.mk @@ -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) diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk index 664f5150beb..04386476983 100644 --- a/source4/dsdb/config.mk +++ b/source4/dsdb/config.mk @@ -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 ####################### diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index 583d1dcf042..c039dda065e 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -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 ################################################ diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index 0589baf5d4a..a9a6dad46d5 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -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)')"` diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index bceda05e4fd..bfa152b3463 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -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; } diff --git a/source4/lib/ldb/pyldb.h b/source4/lib/ldb/pyldb.h index 731911a3879..931dd7eeae2 100644 --- a/source4/lib/ldb/pyldb.h +++ b/source4/lib/ldb/pyldb.h @@ -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_ */ diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 6cc6d2e90e7..90f62c9040f 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -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 diff --git a/source4/librpc/rpc/pyrpc.c b/source4/librpc/rpc/pyrpc.c index 82bb870f40b..e50a0776258 100644 --- a/source4/librpc/rpc/pyrpc.c +++ b/source4/librpc/rpc/pyrpc.c @@ -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)) { diff --git a/source4/nbt_server/config.mk b/source4/nbt_server/config.mk index afd92421884..ba5531da7e2 100644 --- a/source4/nbt_server/config.mk +++ b/source4/nbt_server/config.mk @@ -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 ####################### diff --git a/source4/param/config.mk b/source4/param/config.mk index d420a3883cc..6e5290b64d9 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -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 diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index 1480e544036..5816d9637d8 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -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 @@ -38,16 +39,23 @@ /* 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; } diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 3ecb758595e..f93b0eda604 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -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 |