diff options
author | Tim Potter <tpot@samba.org> | 2002-09-03 00:40:06 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-09-03 00:40:06 +0000 |
commit | 611f9c899dceb912a27a20e74a5bb22809999286 (patch) | |
tree | 4b225d4183bdf8b9e9ec45a9c4fe797d49339c4b | |
parent | 882ff84daad4052d87cbf3d83de6cb281b09251a (diff) | |
download | samba-611f9c899dceb912a27a20e74a5bb22809999286.tar.gz samba-611f9c899dceb912a27a20e74a5bb22809999286.tar.bz2 samba-611f9c899dceb912a27a20e74a5bb22809999286.zip |
Return dictionary of printerdata in enumprinterdataex.
(This used to be commit 348b6778d8b9e42f27da51652c7198cc42048059)
-rw-r--r-- | source3/python/py_spoolss_printerdata.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c index ff8b935679..7f2c0bfe88 100644 --- a/source3/python/py_spoolss_printerdata.c +++ b/source3/python/py_spoolss_printerdata.c @@ -312,10 +312,11 @@ PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject { spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self; static char *kwlist[] = { NULL }; - uint32 needed; - char *key, *value, *data; + uint32 needed, returned, i; + char *key; WERROR werror; PyObject *result; + PRINTER_ENUM_VALUES *values; if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &key)) return NULL; @@ -323,11 +324,13 @@ PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject /* Get max buffer sizes for value and data */ werror = cli_spoolss_enumprinterdataex( - hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, key); + hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, key, + &returned, &values); if (W_ERROR_V(werror) == ERRmoredata) werror = cli_spoolss_enumprinterdataex( - hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, key); + hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, key, + &returned, &values); if (!W_ERROR_IS_OK(werror)) { PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); @@ -338,8 +341,18 @@ PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject result = PyDict_New(); - + for (i = 0; i < returned; i++) { + PyObject *item; + fstring value = ""; + rpcstr_pull(value, values[i].valuename.buffer, sizeof(value), -1, STR_TERMINATE); + item = PyDict_New(); + py_from_printerdata(&item, key, value, values[i].type, values[i].data, + values[i].data_len); + + PyDict_SetItemString(result, value, item); + } + return result; } |