diff options
author | Tim Potter <tpot@samba.org> | 2002-05-17 02:28:26 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-17 02:28:26 +0000 |
commit | 191a4460780cb0e8b686dd70591d403e59123697 (patch) | |
tree | a3845a925a886c4e965c2a46df1d042affaca7b4 /source3/python | |
parent | 1ab45841cc7ecfcfeba7a41ecfc34791171f41fa (diff) | |
download | samba-191a4460780cb0e8b686dd70591d403e59123697.tar.gz samba-191a4460780cb0e8b686dd70591d403e59123697.tar.bz2 samba-191a4460780cb0e8b686dd70591d403e59123697.zip |
Call get_level_value() utility function.
(This used to be commit 2566dad274e0bced9e55cbc3c126c00e70373fbe)
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss_drivers.c | 29 |
1 files changed, 8 insertions, 21 deletions
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) { |