summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-14 05:01:04 +0000
committerTim Potter <tpot@samba.org>2002-05-14 05:01:04 +0000
commit762d52feba43fa0ae296d7eed6195fbe3ccc0e71 (patch)
treed7b6c759445ee11535fe3b17488c25399336324d /source3/python
parent520b40e4235f26cf2bc670128ff277141084e53c (diff)
downloadsamba-762d52feba43fa0ae296d7eed6195fbe3ccc0e71.tar.gz
samba-762d52feba43fa0ae296d7eed6195fbe3ccc0e71.tar.bz2
samba-762d52feba43fa0ae296d7eed6195fbe3ccc0e71.zip
Added enumprinterdata.
(This used to be commit 7a15ce7c0c6a6b3a62dd6607fefc32742fa50308)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_spoolss_printerdata.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c
index 622c487b8c..352252f2bd 100644
--- a/source3/python/py_spoolss_printerdata.c
+++ b/source3/python/py_spoolss_printerdata.c
@@ -156,5 +156,45 @@ PyObject *spoolss_setprinterdata(PyObject *self, PyObject *args, PyObject *kw)
PyObject *spoolss_enumprinterdata(PyObject *self, PyObject *args, PyObject *kw)
{
- return NULL;
+ spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
+ static char *kwlist[] = { NULL };
+ uint32 data_needed, value_needed, ndx = 0, data_size, data_type;
+ char *value, *data;
+ WERROR werror;
+ PyObject *result;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "", kwlist))
+ return NULL;
+
+ /* Get max buffer sizes for value and data */
+
+ werror = cli_spoolss_enumprinterdata(
+ hnd->cli, hnd->mem_ctx, &hnd->pol, ndx, 0, 0,
+ &value_needed, &data_needed, NULL, NULL, NULL, NULL);
+
+ if (!W_ERROR_IS_OK(werror)) {
+ PyErr_SetObject(spoolss_werror, py_werror_tuple(werror));
+ return NULL;
+ }
+
+ /* Iterate over all printerdata */
+
+ result = PyDict_New();
+
+ while (W_ERROR_IS_OK(werror)) {
+ PyObject *obj;
+
+ werror = cli_spoolss_enumprinterdata(
+ hnd->cli, hnd->mem_ctx, &hnd->pol, ndx,
+ value_needed, data_needed, NULL, NULL,
+ &value, &data_type, &data, &data_size);
+
+ if (py_from_printerdata(&obj, value, data_type, data,
+ data_size))
+ PyDict_SetItemString(result, value, obj);
+
+ ndx++;
+ }
+
+ return result;
}