summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_spoolss.c12
-rw-r--r--source3/python/py_spoolss_printerdata.c56
-rw-r--r--source3/python/py_spoolss_proto.h4
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 */