diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-06-16 02:24:43 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-06-16 02:28:10 +0200 |
commit | 308de544f4dd1e23197d3b6d3be85cef1f5f9ded (patch) | |
tree | 04f2cba70adbb472f494bb7551a99dac62d9734b /source4/param | |
parent | f7ada51c29a517e841843c2a869ac9d16c7057d4 (diff) | |
download | samba-308de544f4dd1e23197d3b6d3be85cef1f5f9ded.tar.gz samba-308de544f4dd1e23197d3b6d3be85cef1f5f9ded.tar.bz2 samba-308de544f4dd1e23197d3b6d3be85cef1f5f9ded.zip |
python: Provide way to iterate over available shares.
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/pyparam.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index d8dabe3458..4f6e2fff49 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -232,6 +232,20 @@ static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args) return ret; } +static PyObject *py_lp_ctx_services(py_talloc_Object *self) +{ + struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self); + const char **names; + PyObject *ret; + int i; + names = lp_server_services(lp_ctx); + ret = PyList_New(str_list_length(names)); + for (i = 0; names[i]; i++) { + PyList_SetItem(ret, i, PyString_FromString(names[i])); + } + return ret; +} + static PyMethodDef py_lp_ctx_methods[] = { { "load", (PyCFunction)py_lp_ctx_load, METH_VARARGS, "S.load(filename) -> None\n" @@ -253,6 +267,8 @@ static PyMethodDef py_lp_ctx_methods[] = { "Change a parameter." }, { "private_path", (PyCFunction)py_lp_ctx_private_path, METH_VARARGS, "S.private_path(name) -> path\n" }, + { "services", (PyCFunction)py_lp_ctx_services, METH_NOARGS, + "S.services() -> list" }, { NULL } }; |