diff options
author | John Mulligan <jmulligan@redhat.com> | 2022-04-24 08:10:36 -0400 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-05-06 17:16:30 +0000 |
commit | eb84f67e80cbbba47f572c5f1cbe35f39d224b10 (patch) | |
tree | bbc7e200c02a640aa9f71959ef85d42a69bb3826 /lib/smbconf | |
parent | 67807a642a8b20943c5ed80e71ae05fe8d21fce0 (diff) | |
download | samba-eb84f67e80cbbba47f572c5f1cbe35f39d224b10.tar.gz |
lib/smbconf: add create_share method to SMBConf
Add a create_share method wrapping smbconf_create_share.
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 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/smbconf/pysmbconf.c b/lib/smbconf/pysmbconf.c index efb11d0432c..b49673c1eb4 100644 --- a/lib/smbconf/pysmbconf.c +++ b/lib/smbconf/pysmbconf.c @@ -279,6 +279,23 @@ static PyObject *obj_get_config(py_SMBConf_Object * self, return svclist; } +static PyObject *obj_create_share(py_SMBConf_Object * self, PyObject * args) +{ + sbcErr err; + char *servicename = NULL; + + if (!PyArg_ParseTuple(args, "s", &servicename)) { + return NULL; + } + + err = smbconf_create_share(self->conf_ctx, servicename); + 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" @@ -309,6 +326,11 @@ PyDoc_STRVAR(obj_get_config_doc, "configuration. Each tuple in the list is the same as described\n" "for get_share().\n"); +PyDoc_STRVAR(obj_create_share_doc, +"create_share(name: str) -> None\n" +"Create a new empty share in the configuration. The share\n" +"name must not exist or an error will be raised.\n"); + static PyMethodDef py_smbconf_obj_methods[] = { { "requires_messaging", (PyCFunction) obj_requires_messaging, METH_NOARGS, obj_requires_messaging_doc }, @@ -320,6 +342,8 @@ static PyMethodDef py_smbconf_obj_methods[] = { obj_get_share_doc }, { "get_config", (PyCFunction) obj_get_config, METH_NOARGS, obj_get_config_doc }, + { "create_share", (PyCFunction) obj_create_share, METH_VARARGS, + obj_create_share_doc }, { 0 }, }; |