python/loadparm: Get shares listing working.
authorRicardo Jorge <rvelhote@gmail.com>
Mon, 3 Aug 2009 22:00:25 +0000 (00:00 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 3 Aug 2009 22:18:42 +0000 (00:18 +0200)
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
source4/param/pyparam.c

index 979182c6782db21b15bf3b96caf007f1b0f61120..37e882e1cc876433aa1e1b89902341f320c6807e 100644 (file)
@@ -235,13 +235,14 @@ static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args)
 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]));
+       ret = PyList_New(lp_numservices(lp_ctx));
+       for (i = 0; i < lp_numservices(lp_ctx); i++) {
+               struct loadparm_service *service = lp_servicebynum(lp_ctx, i);
+               if (service != NULL) {
+                       PyList_SetItem(ret, i, PyString_FromString(lp_servicename(service)));
+               }
        }
        return ret;
 }