summaryrefslogtreecommitdiff
path: root/lib/smbconf
diff options
context:
space:
mode:
authorJohn Mulligan <jmulligan@redhat.com>2022-04-24 08:17:53 -0400
committerJeremy Allison <jra@samba.org>2022-05-06 17:16:30 +0000
commitff603de514b0b6dc654d6b3465df6ef9552c7e3c (patch)
treee22ec655c23cbe40bf294b2868af5d2dd3b1d7bc /lib/smbconf
parenteb84f67e80cbbba47f572c5f1cbe35f39d224b10 (diff)
downloadsamba-ff603de514b0b6dc654d6b3465df6ef9552c7e3c.tar.gz
lib/smbconf: add drop method to SMBConf
Add a drop method wrapping smbconf_drop. 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.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/smbconf/pysmbconf.c b/lib/smbconf/pysmbconf.c
index b49673c1eb4..bf1540bbb50 100644
--- a/lib/smbconf/pysmbconf.c
+++ b/lib/smbconf/pysmbconf.c
@@ -296,6 +296,19 @@ static PyObject *obj_create_share(py_SMBConf_Object * self, PyObject * args)
Py_RETURN_NONE;
}
+static PyObject *obj_drop(py_SMBConf_Object * self,
+ PyObject * Py_UNUSED(ignored))
+{
+ sbcErr err;
+
+ err = smbconf_drop(self->conf_ctx);
+ 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"
@@ -331,6 +344,10 @@ PyDoc_STRVAR(obj_create_share_doc,
"Create a new empty share in the configuration. The share\n"
"name must not exist or an error will be raised.\n");
+PyDoc_STRVAR(obj_drop_doc,
+"drop() -> None\n"
+"Drop the entire configuration, resetting it to an empty state.\n");
+
static PyMethodDef py_smbconf_obj_methods[] = {
{ "requires_messaging", (PyCFunction) obj_requires_messaging,
METH_NOARGS, obj_requires_messaging_doc },
@@ -344,6 +361,8 @@ static PyMethodDef py_smbconf_obj_methods[] = {
obj_get_config_doc },
{ "create_share", (PyCFunction) obj_create_share, METH_VARARGS,
obj_create_share_doc },
+ { "drop", (PyCFunction) obj_drop, METH_NOARGS,
+ obj_drop_doc },
{ 0 },
};