diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-09-23 14:22:36 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-09-23 15:24:10 +0200 |
commit | adf66e75c060e6462b9f8819944d0f8ff1ef2c1b (patch) | |
tree | 065d546b71c18bea3eebeb5275279a85c97cbb1f | |
parent | c5615211d436efea992d94b798c7a843cbf076c7 (diff) | |
download | samba-adf66e75c060e6462b9f8819944d0f8ff1ef2c1b.tar.gz samba-adf66e75c060e6462b9f8819944d0f8ff1ef2c1b.tar.bz2 samba-adf66e75c060e6462b9f8819944d0f8ff1ef2c1b.zip |
Check for PyString_FromString being NULL.
-rw-r--r-- | source4/param/provision.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/param/provision.c b/source4/param/provision.c index 8a522e40a9..cb74f96820 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -36,6 +36,14 @@ #include "lib/ldb/pyldb.h" #include "param/pyparam.h" +static PyObject *provision_module(void) +{ + PyObject *name = PyString_FromString("samba.provision"); + if (name == NULL) + return NULL; + return PyImport_Import(name); +} + NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct provision_settings *settings, struct provision_result *result) @@ -49,7 +57,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, Py_Initialize(); py_update_path("bin"); /* FIXME: Can't assume this is always the case */ - provision_mod = PyImport_Import(PyString_FromString("samba.provision")); + provision_mod = provision_module(); if (provision_mod == NULL) { PyErr_Print(); @@ -152,7 +160,6 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, } extern void initldb(void); -extern void initsecurity(void); static PyObject *py_dom_sid_FromSid(struct dom_sid *sid) { @@ -206,8 +213,7 @@ NTSTATUS provision_store_self_join(TALLOC_CTX *mem_ctx, struct loadparm_context Py_Initialize(); py_update_path("bin"); /* FIXME: Can't assume this is always the case */ initldb(); - initsecurity(); - provision_mod = PyImport_Import(PyString_FromString("samba.provision")); + provision_mod = provision_module(); if (provision_mod == NULL) { PyErr_Print(); |