summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-28 02:33:11 +0000
committerTim Potter <tpot@samba.org>2002-05-28 02:33:11 +0000
commitf5a1a3190dc0d4ecdf55b870633a83ee125b816e (patch)
treee87dfd02942c2ed4bf9f81abee358872edbe4174 /source
parent166aee6cc2abb5f6e91ebf3d4ec37454034b8dcd (diff)
downloadsamba-f5a1a3190dc0d4ecdf55b870633a83ee125b816e.tar.gz
samba-f5a1a3190dc0d4ecdf55b870633a83ee125b816e.tar.xz
samba-f5a1a3190dc0d4ecdf55b870633a83ee125b816e.zip
Raise a ValueError if server names aren't given in UNC format.
Diffstat (limited to 'source')
-rw-r--r--source/python/py_spoolss_drivers.c6
-rw-r--r--source/python/py_spoolss_ports.c8
-rw-r--r--source/python/py_spoolss_printers.c10
3 files changed, 16 insertions, 8 deletions
diff --git a/source/python/py_spoolss_drivers.c b/source/python/py_spoolss_drivers.c
index 19fe5800aa7..b5357a78ad3 100644
--- a/source/python/py_spoolss_drivers.c
+++ b/source/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/source/python/py_spoolss_ports.c b/source/python/py_spoolss_ports.c
index 8d59274a00a..b5f2102e5e8 100644
--- a/source/python/py_spoolss_ports.c
+++ b/source/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/source/python/py_spoolss_printers.c b/source/python/py_spoolss_printers.c
index 934bfcc8183..4294df5a6d4 100644
--- a/source/python/py_spoolss_printers.c
+++ b/source/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,