summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-10-02 22:14:37 +0200
committerGünther Deschner <gd@samba.org>2010-10-11 14:31:06 +0000
commitfe724c70d2b8b916cb7ca77b7370d77e8e5b80de (patch)
tree755536b4e120f5d6cdb5a94eb58d39854035ca4c /source3
parent43d226fa25746a99ff598be6f0d663c8c11b7d97 (diff)
downloadsamba-fe724c70d2b8b916cb7ca77b7370d77e8e5b80de.tar.gz
samba-fe724c70d2b8b916cb7ca77b7370d77e8e5b80de.tar.bz2
samba-fe724c70d2b8b916cb7ca77b7370d77e8e5b80de.zip
s3-spoolss: fix set_printer_hnd_name() to match torture test.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index c05ba66e42..e63c63e1c5 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -586,16 +586,22 @@ static bool set_printer_hnd_name(TALLOC_CTX *mem_ctx,
DEBUGADD(5, ("searching for [%s]\n", aprinter));
- if ((p = strchr(aprinter, ',')) != NULL) {
- if (*p == ' ')
+ p = strchr(aprinter, ',');
+ if (p != NULL) {
+ char *p2 = p;
+ p++;
+ if (*p == ' ') {
p++;
- if (strnequal(p+1, "DrvConvert", strlen("DrvConvert")) ||
- strnequal(p+1, " DrvConvert", strlen(" DrvConvert"))) {
- *p = '\0';
- } else if (strnequal(p+1, "LocalOnly", strlen("LocalOnly")) ||
- strnequal(p+1, " LocalOnly", strlen(" LocalOnly"))) {
- *p = '\0';
}
+ if (strncmp(p, "DrvConvert", strlen("DrvConvert")) == 0) {
+ *p2 = '\0';
+ } else if (strncmp(p, "LocalOnly", strlen("LocalOnly")) == 0) {
+ *p2 = '\0';
+ }
+ }
+
+ if (p) {
+ DEBUGADD(5, ("stripped handlename: [%s]\n", aprinter));
}
/* check for the Port Monitor Interface */
@@ -1691,7 +1697,7 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p,
DEBUG(0,("_spoolss_OpenPrinterEx: Cannot open a printer handle "
"for printer %s\n", r->in.printername));
ZERO_STRUCTP(r->out.handle);
- return WERR_INVALID_PARAM;
+ return WERR_INVALID_PRINTER_NAME;
}
Printer = find_printer_index_by_hnd(p, r->out.handle);