Return exception text if getprinter level not [0..3]
authorTim Potter <tpot@samba.org>
Sat, 20 Apr 2002 07:17:36 +0000 (07:17 +0000)
committerTim Potter <tpot@samba.org>
Sat, 20 Apr 2002 07:17:36 +0000 (07:17 +0000)
source/python/py_spoolss_printers.c

index 48321500e7db5ad3b9b536c36bd755ffb1bfbf54..623e693124c0e5de6fdbd34573d3042ad8ff3370 100644 (file)
@@ -119,12 +119,19 @@ PyObject *spoolss_getprinter(PyObject *self, PyObject *args, PyObject *kw)
        int level = 1;
        uint32 needed;
        static char *kwlist[] = {"level", NULL};
-
+       
        /* Parse parameters */
 
        if (!PyArg_ParseTupleAndKeywords(args, kw, "|i", kwlist, &level))
                return NULL;
        
+       if (level < 0 || level > 3) {
+               PyErr_SetString(spoolss_error, "Invalid info level");
+               return NULL;
+       }
+
+       ZERO_STRUCT(ctr);
+
        /* Call rpc function */
        
        werror = cli_spoolss_getprinter(