diff options
author | Tim Potter <tpot@samba.org> | 2002-05-28 02:09:54 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-28 02:09:54 +0000 |
commit | 166aee6cc2abb5f6e91ebf3d4ec37454034b8dcd (patch) | |
tree | c58f169215c0d076c9441501ea18f0ea79f1705c /source/python/py_spoolss_drivers.c | |
parent | b6e860546a622e6da238faf56d7c1567c6cf63a5 (diff) | |
download | samba-166aee6cc2abb5f6e91ebf3d4ec37454034b8dcd.tar.gz samba-166aee6cc2abb5f6e91ebf3d4ec37454034b8dcd.tar.xz samba-166aee6cc2abb5f6e91ebf3d4ec37454034b8dcd.zip |
Allow None to be used as a valid credential for functions that take a
credential as a parameter.
Diffstat (limited to 'source/python/py_spoolss_drivers.c')
-rw-r--r-- | source/python/py_spoolss_drivers.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/source/python/py_spoolss_drivers.c b/source/python/py_spoolss_drivers.c index 9b7a8d32944..19fe5800aa7 100644 --- a/source/python/py_spoolss_drivers.c +++ b/source/python/py_spoolss_drivers.c @@ -38,8 +38,8 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args, /* Parse parameters */ if (!PyArg_ParseTupleAndKeywords( - args, kw, "s|iO!s", kwlist, &server, &level, &PyDict_Type, - &creds, &arch)) + args, kw, "s|iOs", kwlist, &server, &level, &creds, + &arch)) return NULL; if (server[0] != '\\' || server[1] != '\\') { @@ -49,6 +49,12 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args, server += 2; + if (creds && creds != Py_None && !PyDict_Check(creds)) { + PyErr_SetString(PyExc_TypeError, + "credentials must be dictionary or None"); + return NULL; + } + /* Call rpc function */ if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) { @@ -248,8 +254,8 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args, /* Parse parameters */ if (!PyArg_ParseTupleAndKeywords( - args, kw, "s|isO!", kwlist, &server, &level, - &arch, &PyDict_Type, &creds)) + args, kw, "s|isO", kwlist, &server, &level, + &arch, &creds)) return NULL; if (server[0] != '\\' || server[1] != '\\') { @@ -259,6 +265,12 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args, server += 2; + if (creds && creds != Py_None && !PyDict_Check(creds)) { + PyErr_SetString(PyExc_TypeError, + "credentials must be dictionary or None"); + return NULL; + } + /* Call rpc function */ if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) { @@ -324,13 +336,19 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args, } dinfo; if (!PyArg_ParseTupleAndKeywords( - args, kw, "sO!|O!", kwlist, &server, &PyDict_Type, - &info, &PyDict_Type, &creds)) + args, kw, "sO!|O", kwlist, &server, &PyDict_Type, + &info, &creds)) return NULL; if (server[0] == '\\' && server[1] == '\\') server += 2; + if (creds && creds != Py_None && !PyDict_Check(creds)) { + PyErr_SetString(PyExc_TypeError, + "credentials must be dictionary or None"); + return NULL; + } + if (!(mem_ctx = talloc_init())) { PyErr_SetString( spoolss_error, "unable to init talloc context\n"); |