s3-printing: pre-create color and PCC directories under print$.
authorGünther Deschner <gd@samba.org>
Fri, 2 Sep 2016 08:00:01 +0000 (10:00 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 25 Jul 2017 23:34:12 +0000 (01:34 +0200)
Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/printing/nt_printing.c

index 47590f67fc713cdebdab802d8530c303b8a924d4..c039764734b181161e4d6ab02aa90ed133e4b00d 100644 (file)
@@ -80,6 +80,11 @@ static bool print_driver_directories_init(void)
        char *driver_path;
        bool ok;
        TALLOC_CTX *mem_ctx = talloc_stackframe();
+       const char *dir_list[] = {
+               "W32X86/PCC",
+               "x64/PCC",
+               "color"
+       };
 
        service = lp_servicenumber("print$");
        if (service < 0) {
@@ -125,6 +130,28 @@ static bool print_driver_directories_init(void)
                }
        }
 
+       for (i = 0; i < ARRAY_SIZE(dir_list); i++) {
+               const char *path;
+
+               path = talloc_asprintf(mem_ctx,
+                                      "%s/%s",
+                                      driver_path,
+                                      dir_list[i]);
+               if (path == NULL) {
+                       talloc_free(mem_ctx);
+                       return false;
+               }
+
+               ok = directory_create_or_exist(path, 0755);
+               if (!ok) {
+                       DEBUG(1, ("Failed to create printer driver "
+                                 "architecture directory %s\n",
+                                 path));
+                       talloc_free(mem_ctx);
+                       return false;
+               }
+       }
+
        talloc_free(mem_ctx);
        return true;
 }