s3-spoolss: globally set print server environment/architecture.
authorGünther Deschner <gd@samba.org>
Mon, 21 Nov 2016 11:46:02 +0000 (12:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Jan 2017 14:35:13 +0000 (15:35 +0100)
Guenther

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

index 669ba2485a0024f9ef8f215cfdcec859937930be..80d30cffbbf129fdf7cea2535e11a036e50679b9 100644 (file)
@@ -80,6 +80,7 @@
 #define GLOBAL_SPOOLSS_OS_MAJOR_DEFAULT 5
 #define GLOBAL_SPOOLSS_OS_MINOR_DEFAULT 2
 #define GLOBAL_SPOOLSS_OS_BUILD_DEFAULT 3790
+#define GLOBAL_SPOOLSS_ARCHITECTURE SPOOLSS_ARCHITECTURE_x64
 
 static struct printer_handle *printers_list;
 
@@ -2354,7 +2355,7 @@ static WERROR getprinterdata_printer_server(TALLOC_CTX *mem_ctx,
        if (!strcasecmp_m(value, "Architecture")) {
                *type = REG_SZ;
                data->string = talloc_strdup(mem_ctx,
-                       lp_parm_const_string(GLOBAL_SECTION_SNUM, "spoolss", "architecture", SPOOLSS_ARCHITECTURE_x64));
+                       lp_parm_const_string(GLOBAL_SECTION_SNUM, "spoolss", "architecture", GLOBAL_SPOOLSS_ARCHITECTURE));
                W_ERROR_HAVE_NO_MEMORY(data->string);
 
                return WERR_OK;
@@ -3837,6 +3838,8 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
        print_status_struct status;
        WERROR result;
        int os_major, os_minor, os_build;
+       const char *architecture;
+       uint32_t processor_architecture, processor_type;
 
        result = create_printername(mem_ctx, servername, info2->printername, &r->printername);
        if (!W_ERROR_IS_OK(result)) {
@@ -3899,6 +3902,19 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
        SCVAL(&r->version, 1, os_minor);
        SSVAL(&r->version, 2, os_build);
 
+       architecture = lp_parm_const_string(GLOBAL_SECTION_SNUM,
+                                           "spoolss",
+                                           "architecture",
+                                           GLOBAL_SPOOLSS_ARCHITECTURE);
+
+       if (strequal(architecture, SPOOLSS_ARCHITECTURE_x64)) {
+               processor_architecture  = PROCESSOR_ARCHITECTURE_AMD64;
+               processor_type          = PROCESSOR_AMD_X8664;
+       } else {
+               processor_architecture  = PROCESSOR_ARCHITECTURE_INTEL;
+               processor_type          = PROCESSOR_INTEL_PENTIUM;
+       }
+
        r->free_build                   = SPOOLSS_RELEASE_BUILD;
        r->spooling                     = 0;
        r->max_spooling                 = 0;
@@ -3907,7 +3923,7 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
        r->num_error_not_ready          = 0x0;          /* number of print failure */
        r->job_error                    = 0x0;
        r->number_of_processors         = 0x1;
-       r->processor_type               = PROCESSOR_AMD_X8664;
+       r->processor_type               = processor_type;
        r->high_part_total_bytes        = 0x0;
 
        /* ChangeID in milliseconds*/
@@ -3918,7 +3934,7 @@ static WERROR construct_printer_info0(TALLOC_CTX *mem_ctx,
        r->status                       = nt_printq_status(status.status);
        r->enumerate_network_printers   = 0x0;
        r->c_setprinter                 = 0x0;
-       r->processor_architecture       = PROCESSOR_ARCHITECTURE_AMD64;
+       r->processor_architecture       = processor_architecture;
        r->processor_level              = 0x6;          /* 6  ???*/
        r->ref_ic                       = 0;
        r->reserved2                    = 0;
@@ -8662,7 +8678,7 @@ static WERROR compose_spoolss_server_path(TALLOC_CTX *mem_ctx,
        } else {
                long_archi = lp_parm_const_string(GLOBAL_SECTION_SNUM,
                                                  "spoolss", "architecture",
-                                                 SPOOLSS_ARCHITECTURE_x64);
+                                                 GLOBAL_SPOOLSS_ARCHITECTURE);
        }
 
        /* servername may be empty */
@@ -9502,7 +9518,7 @@ static WERROR enumprintmonitors_level_2(TALLOC_CTX *mem_ctx,
        architecture = lp_parm_const_string(GLOBAL_SECTION_SNUM,
                                            "spoolss",
                                            "architecture",
-                                           SPOOLSS_ARCHITECTURE_x64);
+                                           GLOBAL_SPOOLSS_ARCHITECTURE);
 
        result = fill_monitor_2(info, &info[0].info2,
                                SPL_LOCAL_PORT,