s3-spoolss: make it possible to have and announce a [prnproc$] share on the printserver.
authorGünther Deschner <gd@samba.org>
Sat, 2 Oct 2010 20:17:46 +0000 (22:17 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 7 Oct 2010 16:09:14 +0000 (16:09 +0000)
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Thu Oct  7 16:09:14 UTC 2010 on sn-devel-104

source3/rpc_server/srv_spoolss_nt.c

index 4de2cdbae63829c92d30552ee04503f91f10439d..c05ba66e427d354f11bf51e079fca1f68acc550e 100644 (file)
@@ -9606,6 +9606,9 @@ WERROR _spoolss_GetPrintProcessorDirectory(struct pipes_struct *p,
                                           struct spoolss_GetPrintProcessorDirectory *r)
 {
        WERROR result;
+       fstring prnproc_share;
+       bool prnproc_share_exists = false;
+       int snum;
 
        /* that's an [in out] buffer */
 
@@ -9622,10 +9625,17 @@ WERROR _spoolss_GetPrintProcessorDirectory(struct pipes_struct *p,
 
        /* We always should reply with a local print processor directory so that
         * users are not forced to have a [prnproc$] share on the Samba spoolss
-        * server - Guenther */
+        * server, if users decide to do so, lets announce it though - Guenther */
+
+       fstrcpy(prnproc_share, "prnproc$");
+
+       snum = find_service(prnproc_share);
+       if (snum != -1) {
+               prnproc_share_exists = true;
+       }
 
        result = getprintprocessordirectory_level_1(p->mem_ctx,
-                                                   NULL, /* r->in.server */
+                                                   prnproc_share_exists ? r->in.server : NULL,
                                                    r->in.environment,
                                                    &r->out.info->info1);
        if (!W_ERROR_IS_OK(result)) {