diff options
author | Günther Deschner <gd@samba.org> | 2010-10-02 22:14:37 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-10-11 14:31:06 +0000 |
commit | fe724c70d2b8b916cb7ca77b7370d77e8e5b80de (patch) | |
tree | 755536b4e120f5d6cdb5a94eb58d39854035ca4c /source3/rpc_server | |
parent | 43d226fa25746a99ff598be6f0d663c8c11b7d97 (diff) | |
download | samba-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/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 24 |
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); |