diff options
author | Tim Potter <tpot@samba.org> | 2002-05-14 05:01:04 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-14 05:01:04 +0000 |
commit | 7a15ce7c0c6a6b3a62dd6607fefc32742fa50308 (patch) | |
tree | 05d13fa6ad7e9e62aca181eb85a6a277d14da164 /source/python/py_spoolss_printerdata.c | |
parent | 18aeadc591b69bbbd874b7285ecaed50ff587e68 (diff) | |
download | samba-7a15ce7c0c6a6b3a62dd6607fefc32742fa50308.tar.gz samba-7a15ce7c0c6a6b3a62dd6607fefc32742fa50308.tar.xz samba-7a15ce7c0c6a6b3a62dd6607fefc32742fa50308.zip |
Added enumprinterdata.
Diffstat (limited to 'source/python/py_spoolss_printerdata.c')
-rw-r--r-- | source/python/py_spoolss_printerdata.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/source/python/py_spoolss_printerdata.c b/source/python/py_spoolss_printerdata.c index 622c487b8ca..352252f2bdb 100644 --- a/source/python/py_spoolss_printerdata.c +++ b/source/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; } |