s3-spoolss: Strip off ", DrvConvert" and ",LocalOnly" in OpenPrinterEx as seen from...
authorGünther Deschner <gd@samba.org>
Fri, 1 Oct 2010 20:52:33 +0000 (22:52 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 1 Oct 2010 22:42:52 +0000 (00:42 +0200)
These suffixes and their meaning are not documented (yet).

Guenther

source3/rpc_server/srv_spoolss_nt.c

index 07733bd97e9f18a6b505c2509e3466155be2afd7..d79c9314c6086b632dfd76328bbeecee6677b2f9 100644 (file)
@@ -547,6 +547,7 @@ static bool set_printer_hnd_name(TALLOC_CTX *mem_ctx,
        bool found = false;
        struct spoolss_PrinterInfo2 *info2 = NULL;
        WERROR result;
+       char *p;
 
        /*
         * Hopefully nobody names his printers like this. Maybe \ or ,
@@ -585,6 +586,18 @@ 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++;
+               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';
+               }
+       }
+
        /* check for the Port Monitor Interface */
        if ( strequal( aprinter, SPL_XCV_MONITOR_TCPMON ) ) {
                Printer->printer_type = SPLHND_PORTMON_TCP;