summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_spoolss_drivers.c6
-rw-r--r--source3/python/py_spoolss_ports.c8
-rw-r--r--source3/python/py_spoolss_printers.c10
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,