diff options
author | Tim Potter <tpot@samba.org> | 2002-11-06 23:36:07 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-11-06 23:36:07 +0000 |
commit | f0718b6b3526abc025069ea0d40a802b3d383449 (patch) | |
tree | 7524be04c4fdcfd0198ad9d26294fc33f6b7b3f1 /source3/python | |
parent | f4766f4900c87a82d49f39dadac56e74debef920 (diff) | |
download | samba-f0718b6b3526abc025069ea0d40a802b3d383449.tar.gz samba-f0718b6b3526abc025069ea0d40a802b3d383449.tar.bz2 samba-f0718b6b3526abc025069ea0d40a802b3d383449.zip |
Added enumprinterkey function.
Stub for deleteprinterkey.
(This used to be commit 64e04380f7ad9b471a681638dfde93e0c65f9fa3)
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss.c | 12 | ||||
-rw-r--r-- | source3/python/py_spoolss_printerdata.c | 56 | ||||
-rw-r--r-- | source3/python/py_spoolss_proto.h | 4 |
3 files changed, 72 insertions, 0 deletions
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c index 4451cd87b2..957b4e9d9f 100644 --- a/source3/python/py_spoolss.c +++ b/source3/python/py_spoolss.c @@ -297,6 +297,18 @@ Set the form given by the dictionary argument."}, METH_VARARGS | METH_KEYWORDS, "Delete printer data." }, + { "enumprinterkey", (PyCFunction)spoolss_hnd_enumprinterkey, + METH_VARARGS | METH_KEYWORDS, + "Enumerate printer key." }, + +#if 0 + /* Not implemented */ + + { "deleteprinterkey", (PyCFunction)spoolss_hnd_deleteprinterkey, + METH_VARARGS | METH_KEYWORDS, + "Delete printer key." }, +#endif + { NULL } }; diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c index bacc870d9d..583d097e84 100644 --- a/source3/python/py_spoolss_printerdata.c +++ b/source3/python/py_spoolss_printerdata.c @@ -391,3 +391,59 @@ PyObject *spoolss_hnd_deleteprinterdataex(PyObject *self, PyObject *args, PyObje Py_INCREF(Py_None); return Py_None; } + +PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args, + PyObject *kw) +{ + spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self; + static char *kwlist[] = { "key", NULL }; + char *keyname; + WERROR werror; + uint32 needed, keylist_len; + uint16 *keylist; + PyObject *result; + + /* Parse parameters */ + + if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &keyname)) + return NULL; + + /* Call rpc function */ + + werror = cli_spoolss_enumprinterkey( + hnd->cli, hnd->mem_ctx, 0, &needed, &hnd->pol, + keyname, &keylist, &keylist_len); + + if (W_ERROR_V(werror) == ERRmoredata) + werror = cli_spoolss_enumprinterkey( + hnd->cli, hnd->mem_ctx, needed, NULL, &hnd->pol, + keyname, &keylist, &keylist_len); + + if (!W_ERROR_IS_OK(werror)) { + PyErr_SetObject(spoolss_werror, py_werror_tuple(werror)); + return NULL; + } + + result = from_unistr_list(keylist); + + return result; +} + +#if 0 + +PyObject *spoolss_hnd_deleteprinterkey(PyObject *self, PyObject *args, + PyObject *kw) +{ + spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self; + static char *kwlist[] = { "key", NULL }; + char *keyname; + WERROR werror; + + if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &keyname)) + return NULL; + + Py_INCREF(Py_None); + return Py_None; +} + +#endif diff --git a/source3/python/py_spoolss_proto.h b/source3/python/py_spoolss_proto.h index b5c6a3239e..77feb1acc3 100644 --- a/source3/python/py_spoolss_proto.h +++ b/source3/python/py_spoolss_proto.h @@ -95,6 +95,10 @@ PyObject *spoolss_hnd_getprinterdataex(PyObject *self, PyObject *args, PyObject PyObject *spoolss_hnd_setprinterdataex(PyObject *self, PyObject *args, PyObject *kw); PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject *kw); PyObject *spoolss_hnd_deleteprinterdataex(PyObject *self, PyObject *args, PyObject *kw); +PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args, + PyObject *kw); +PyObject *spoolss_hnd_deleteprinterkey(PyObject *self, PyObject *args, + PyObject *kw); /* The following definitions come from python/py_spoolss_printers.c */ |