diff options
author | John Mulligan <jmulligan@redhat.com> | 2022-04-24 10:18:42 -0400 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-05-06 17:16:30 +0000 |
commit | 565d8ae8cdfae9e15e18a0c9350e2ebb4f502f92 (patch) | |
tree | f7e4c8ae62e2a6a45ce80d068cd8b399393a66b0 /lib/smbconf | |
parent | ff603de514b0b6dc654d6b3465df6ef9552c7e3c (diff) | |
download | samba-565d8ae8cdfae9e15e18a0c9350e2ebb4f502f92.tar.gz |
lib/smbconf: add set_parameter method to SMBConf
Add a set_parameter method wrapping smbconf_set_parameter.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/smbconf')
-rw-r--r-- | lib/smbconf/pysmbconf.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/smbconf/pysmbconf.c b/lib/smbconf/pysmbconf.c index bf1540bbb50..ae06c52f0c2 100644 --- a/lib/smbconf/pysmbconf.c +++ b/lib/smbconf/pysmbconf.c @@ -309,6 +309,25 @@ static PyObject *obj_drop(py_SMBConf_Object * self, Py_RETURN_NONE; } +static PyObject *obj_set_parameter(py_SMBConf_Object * self, PyObject * args) +{ + sbcErr err; + char *servicename = NULL; + char *param = NULL; + char *val = NULL; + + if (!PyArg_ParseTuple(args, "sss", &servicename, ¶m, &val)) { + return NULL; + } + + err = smbconf_set_parameter(self->conf_ctx, servicename, param, val); + if (err != SBC_ERR_OK) { + py_raise_SMBConfError(err); + return NULL; + } + Py_RETURN_NONE; +} + PyDoc_STRVAR(obj_requires_messaging_doc, "requires_messaging() -> bool\n" "\n" @@ -348,6 +367,11 @@ PyDoc_STRVAR(obj_drop_doc, "drop() -> None\n" "Drop the entire configuration, resetting it to an empty state.\n"); +PyDoc_STRVAR(obj_set_parameter_doc, +"set_parameter(str, str, str) -> None\n" +"Set a configuration parmeter. Specify service name, parameter name,\n" +"and parameter value.\n"); + static PyMethodDef py_smbconf_obj_methods[] = { { "requires_messaging", (PyCFunction) obj_requires_messaging, METH_NOARGS, obj_requires_messaging_doc }, @@ -363,6 +387,8 @@ static PyMethodDef py_smbconf_obj_methods[] = { obj_create_share_doc }, { "drop", (PyCFunction) obj_drop, METH_NOARGS, obj_drop_doc }, + { "set_parameter", (PyCFunction) obj_set_parameter, METH_VARARGS, + obj_set_parameter_doc }, { 0 }, }; |