From 8a362924714c53b5a5c02b7969a91b4240db57d2 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 9 Sep 2002 04:43:38 +0000 Subject: Fix crash bugs in getprinter info level code (yay unit tests). Let the cli_spoolss function return invalid info level error rather than checking for it ourselves. (This used to be commit fc5e186821abc429ea8314d0785b76cbe1ec5f74) --- source3/python/py_spoolss_printers.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source3/python') diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c index 2a6d056bbf..a300eada86 100644 --- a/source3/python/py_spoolss_printers.c +++ b/source3/python/py_spoolss_printers.c @@ -135,11 +135,6 @@ PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw) 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 */ @@ -224,7 +219,7 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw) case 1: ctr.printers_1 = &pinfo.printers_1; - if (!py_to_PRINTER_INFO_1(&pinfo.printers_1, info)){ + if (!py_to_PRINTER_INFO_1(ctr.printers_1, info)){ PyErr_SetString(spoolss_error, "error converting printer to info 1"); return NULL; @@ -234,7 +229,7 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw) case 2: ctr.printers_2 = &pinfo.printers_2; - if (!py_to_PRINTER_INFO_2(&pinfo.printers_2, info, + if (!py_to_PRINTER_INFO_2(ctr.printers_2, info, hnd->mem_ctx)){ PyErr_SetString(spoolss_error, "error converting printer to info 2"); @@ -245,7 +240,7 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw) case 3: ctr.printers_3 = &pinfo.printers_3; - if (!py_to_PRINTER_INFO_3(&pinfo.printers_3, info, + if (!py_to_PRINTER_INFO_3(ctr.printers_3, info, hnd->mem_ctx)) { PyErr_SetString(spoolss_error, "error converting to printer info 3"); -- cgit