From 191a4460780cb0e8b686dd70591d403e59123697 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 17 May 2002 02:28:26 +0000 Subject: Call get_level_value() utility function. (This used to be commit 2566dad274e0bced9e55cbc3c126c00e70373fbe) --- source3/python/py_spoolss_drivers.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'source3/python') diff --git a/source3/python/py_spoolss_drivers.c b/source3/python/py_spoolss_drivers.c index ec85f9dd6f..e95d548ef1 100644 --- a/source3/python/py_spoolss_drivers.c +++ b/source3/python/py_spoolss_drivers.c @@ -298,7 +298,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args, static char *kwlist[] = { "server", "info", "creds", NULL }; char *server, *errstr; uint32 level; - PyObject *info, *result = NULL, *creds = NULL, *level_obj; + PyObject *info, *result = NULL, *creds = NULL; WERROR werror; TALLOC_CTX *mem_ctx; struct cli_state *cli; @@ -328,29 +328,16 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args, goto done; } - if ((level_obj = PyDict_GetItemString(info, "level"))) { - - if (!PyInt_Check(level_obj)) { - PyErr_SetString(spoolss_error, - "level not an integer"); - goto done; - } - - level = PyInt_AsLong(level_obj); - - /* Only level 2, 3 supported by NT */ - - if (level != 3) { - PyErr_SetString(spoolss_error, - "unsupported info level"); - goto done; - } + if (!get_level_value(info, &level)) { + PyErr_SetString(spoolss_error, "invalid info level"); + return NULL; + } - } else { - PyErr_SetString(spoolss_error, "no info level present"); + if (level != 3) { + PyErr_SetString(spoolss_error, "unsupported info level"); goto done; } - + ZERO_STRUCT(ctr); switch(level) { -- cgit