summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-27 06:36:06 +0000
committerTim Potter <tpot@samba.org>2002-05-27 06:36:06 +0000
commitc2f0e1638e3e8a0cd58054a562fc931b16651c8d (patch)
tree7593f5dc6354cab64d3b9f0a2d961b247d526e54 /source3
parent2fe386d9b90c357020bbe4e5e3849d4874bc185c (diff)
downloadsamba-c2f0e1638e3e8a0cd58054a562fc931b16651c8d.tar.gz
samba-c2f0e1638e3e8a0cd58054a562fc931b16651c8d.tar.bz2
samba-c2f0e1638e3e8a0cd58054a562fc931b16651c8d.zip
Use new version of open_pipe_creds() function.
Server argument to enumprinterdrivers() must be in UNC format. (This used to be commit 3b011eb65a45a2b919e0b759f426581100ac17fd)
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_spoolss_drivers.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/source3/python/py_spoolss_drivers.c b/source3/python/py_spoolss_drivers.c
index 1626684a1b..9b7a8d3294 100644
--- a/source3/python/py_spoolss_drivers.c
+++ b/source3/python/py_spoolss_drivers.c
@@ -42,10 +42,16 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
&creds, &arch))
return NULL;
+ if (server[0] != '\\' || server[1] != '\\') {
+ PyErr_SetString(spoolss_error, "bad server name");
+ return NULL;
+ }
+
+ server += 2;
+
/* Call rpc function */
- if (!(cli = open_pipe_creds(
- server, creds, cli_spoolss_initialise, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
@@ -246,10 +252,16 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
&arch, &PyDict_Type, &creds))
return NULL;
+ if (server[0] != '\\' || server[1] != '\\') {
+ PyErr_SetString(spoolss_error, "bad server name");
+ return NULL;
+ }
+
+ server += 2;
+
/* Call rpc function */
- if (!(cli = open_pipe_creds(
- server, creds, cli_spoolss_initialise, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
@@ -304,8 +316,8 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
uint32 level;
PyObject *info, *result = NULL, *creds = NULL;
WERROR werror;
- TALLOC_CTX *mem_ctx;
- struct cli_state *cli;
+ TALLOC_CTX *mem_ctx = NULL;
+ struct cli_state *cli = NULL;
PRINTER_DRIVER_CTR ctr;
union {
DRIVER_INFO_3 driver_3;
@@ -325,8 +337,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
return NULL;
}
- if (!(cli = open_pipe_creds(
- server, creds, cli_spoolss_initialise, &errstr))) {
+ if (!(cli = open_pipe_creds(server, creds, PIPE_SPOOLSS, &errstr))) {
PyErr_SetString(spoolss_error, errstr);
free(errstr);
goto done;
@@ -334,7 +345,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
if (!get_level_value(info, &level)) {
PyErr_SetString(spoolss_error, "invalid info level");
- return NULL;
+ goto done;
}
if (level != 3) {
@@ -371,8 +382,11 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
result = Py_None;
done:
- cli_shutdown(cli);
- talloc_destroy(mem_ctx);
+ if (cli)
+ cli_shutdown(cli);
+
+ if (mem_ctx)
+ talloc_destroy(mem_ctx);
return result;