diff options
author | Tim Potter <tpot@samba.org> | 2002-05-28 02:33:11 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-28 02:33:11 +0000 |
commit | 6aad72916aff00eb11f747e7fd5a01ac98b56929 (patch) | |
tree | 382cadd50e33ef9a65db6bbcb533cfe40670a662 /source3/python | |
parent | e99a265bad36f2525a5b04734ff996e66b624711 (diff) | |
download | samba-6aad72916aff00eb11f747e7fd5a01ac98b56929.tar.gz samba-6aad72916aff00eb11f747e7fd5a01ac98b56929.tar.bz2 samba-6aad72916aff00eb11f747e7fd5a01ac98b56929.zip |
Raise a ValueError if server names aren't given in UNC format.
(This used to be commit f5a1a3190dc0d4ecdf55b870633a83ee125b816e)
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss_drivers.c | 6 | ||||
-rw-r--r-- | source3/python/py_spoolss_ports.c | 8 | ||||
-rw-r--r-- | source3/python/py_spoolss_printers.c | 10 |
3 files changed, 16 insertions, 8 deletions
diff --git a/source3/python/py_spoolss_drivers.c b/source3/python/py_spoolss_drivers.c index 19fe5800aa..b5357a78ad 100644 --- a/source3/python/py_spoolss_drivers.c +++ b/source3/python/py_spoolss_drivers.c @@ -43,7 +43,7 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args, return NULL; if (server[0] != '\\' || server[1] != '\\') { - PyErr_SetString(spoolss_error, "bad server name"); + PyErr_SetString(PyExc_ValueError, "UNC name required"); return NULL; } @@ -259,7 +259,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args, return NULL; if (server[0] != '\\' || server[1] != '\\') { - PyErr_SetString(spoolss_error, "bad server name"); + PyErr_SetString(PyExc_ValueError, "UNC name required"); return NULL; } @@ -340,7 +340,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args, &info, &creds)) return NULL; - if (server[0] == '\\' && server[1] == '\\') + if (server[0] == '\\' || server[1] == '\\') server += 2; if (creds && creds != Py_None && !PyDict_Check(creds)) { diff --git a/source3/python/py_spoolss_ports.c b/source3/python/py_spoolss_ports.c index 8d59274a00..b5f2102e5e 100644 --- a/source3/python/py_spoolss_ports.c +++ b/source3/python/py_spoolss_ports.c @@ -40,8 +40,12 @@ PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw) args, kw, "s|iO", kwlist, &server, &level, &creds)) return NULL; - if (server[0] == '\\' && server[1] == '\\') - server += 2; + if (server[0] != '\\' || server[1] != '\\') { + PyErr_SetString(PyExc_ValueError, "UNC name required"); + return NULL; + } + + server += 2; if (creds && creds != Py_None && !PyDict_Check(creds)) { PyErr_SetString(PyExc_TypeError, diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c index 934bfcc818..4294df5a6d 100644 --- a/source3/python/py_spoolss_printers.c +++ b/source3/python/py_spoolss_printers.c @@ -39,7 +39,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw) return NULL; if (unc_name[0] != '\\' || unc_name[1] != '\\') { - PyErr_SetString(spoolss_error, "bad printer name"); + PyErr_SetString(PyExc_ValueError, "UNC name required"); return NULL; } @@ -296,8 +296,12 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw) &flags, &creds)) return NULL; - if (server[0] == '\\' && server[1] == '\\') - server += 2; + if (server[0] != '\\' || server[1] != '\\') { + PyErr_SetString(PyExc_ValueError, "UNC name required"); + return NULL; + } + + server += 2; if (creds && creds != Py_None && !PyDict_Check(creds)) { PyErr_SetString(PyExc_TypeError, |