summaryrefslogtreecommitdiffstats
path: root/source4/param
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-01-03 11:36:08 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-01-28 17:26:36 +1300
commit72c6645760e7e568933f6b0359a8a4284d9117ac (patch)
tree556f4d493e8c5072953dabd4e6306cc712f6d19a /source4/param
parent931a37061178b186db07b8a0b1377b7cc30a85e5 (diff)
downloadsamba-72c6645760e7e568933f6b0359a8a4284d9117ac.tar.gz
samba-72c6645760e7e568933f6b0359a8a4284d9117ac.tar.xz
samba-72c6645760e7e568933f6b0359a8a4284d9117ac.zip
s4-param: add error messages for failure to dump a parameter
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/pyparam.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 345cd9d44c4..e780c2ece8c 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -291,10 +291,11 @@ static PyObject *py_lp_dump_a_parameter(PyObject *self, PyObject *args)
{
PyObject *py_stream;
char *param_name;
- char *section_name = NULL;
+ const char *section_name = NULL;
FILE *f;
struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self);
struct loadparm_service *service;
+ bool ret;
if (!PyArg_ParseTuple(args, "Os|z", &py_stream, &param_name, &section_name))
return NULL;
@@ -309,14 +310,21 @@ static PyObject *py_lp_dump_a_parameter(PyObject *self, PyObject *args)
/* it's a share parameter */
service = lpcfg_service(lp_ctx, section_name);
if (service == NULL) {
- Py_RETURN_NONE;
+ PyErr_Format(PyExc_RuntimeError, "Unknown section %s", section_name);
+ return NULL;
}
} else {
/* it's global */
service = NULL;
+ section_name = "global";
}
- lpcfg_dump_a_parameter(lp_ctx, service, param_name, f);
+ ret = lpcfg_dump_a_parameter(lp_ctx, service, param_name, f);
+
+ if (!ret) {
+ PyErr_Format(PyExc_RuntimeError, "Parameter %s unknown for section %s", param_name, section_name);
+ return NULL;
+ }
Py_RETURN_NONE;