summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-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);