Added enumprinterkey function.
authorTim Potter <tpot@samba.org>
Wed, 6 Nov 2002 23:36:07 +0000 (23:36 +0000)
committerTim Potter <tpot@samba.org>
Wed, 6 Nov 2002 23:36:07 +0000 (23:36 +0000)
Stub for deleteprinterkey.

source/python/py_spoolss.c
source/python/py_spoolss_printerdata.c
source/python/py_spoolss_proto.h

index 4451cd87b2a80bbf1722061a05ce74a4ce1861ed..957b4e9d9f114d18fd056f6ae6b1c48a2b791e28 100644 (file)
@@ -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 }
 
 };
index bacc870d9dd6b86af20aaa26de010a012ff9d260..583d097e845a372d1cd13e5129a66d71970341da 100644 (file)
@@ -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
index b5c6a3239ed510533e15fbfee1d3db620eea94d7..77feb1acc30da563407ebba8026d5010acf0e8ac 100644 (file)
@@ -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  */