From 6dd1f99ec09aff71f04d103554e848e0ddcf0cb7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 13 May 2009 15:35:55 +0200 Subject: s3-spoolss: add server-support for queries for the "all" architecture in printdriver enum calls. Guenther --- source3/rpc_server/srv_spoolss_nt.c | 74 +++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-) (limited to 'source3') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 8280011cc20..f71099434b5 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6708,16 +6708,28 @@ WERROR _spoolss_SetJob(pipes_struct *p, return errcode; } +static const struct print_architecture_table_node archi_table[]= { + + {"Windows 4.0", SPL_ARCH_WIN40, 0 }, + {"Windows NT x86", SPL_ARCH_W32X86, 2 }, + {"Windows NT R4000", SPL_ARCH_W32MIPS, 2 }, + {"Windows NT Alpha_AXP", SPL_ARCH_W32ALPHA, 2 }, + {"Windows NT PowerPC", SPL_ARCH_W32PPC, 2 }, + {"Windows IA64", SPL_ARCH_IA64, 3 }, + {"Windows x64", SPL_ARCH_X64, 3 }, + {NULL, "", -1 } +}; + /**************************************************************************** - Enumerates all printer drivers by level. + Enumerates all printer drivers by level and architecture. ****************************************************************************/ -static WERROR enumprinterdrivers_level(TALLOC_CTX *mem_ctx, - const char *servername, - const char *architecture, - uint32_t level, - union spoolss_DriverInfo **info_p, - uint32_t *count_p) +static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx, + const char *servername, + const char *architecture, + uint32_t level, + union spoolss_DriverInfo **info_p, + uint32_t *count_p) { int i; int ndrivers; @@ -6819,6 +6831,54 @@ static WERROR enumprinterdrivers_level(TALLOC_CTX *mem_ctx, return WERR_OK; } +/**************************************************************************** + Enumerates all printer drivers by level. +****************************************************************************/ + +static WERROR enumprinterdrivers_level(TALLOC_CTX *mem_ctx, + const char *servername, + const char *architecture, + uint32_t level, + union spoolss_DriverInfo **info_p, + uint32_t *count_p) +{ + uint32_t a,i; + WERROR result = WERR_OK; + + if (strequal(architecture, "all")) { + + for (a=0; archi_table[a].long_archi != NULL; a++) { + + union spoolss_DriverInfo *info = NULL; + uint32_t count = 0; + + result = enumprinterdrivers_level_by_architecture(mem_ctx, + servername, + archi_table[a].long_archi, + level, + &info, + &count); + if (!W_ERROR_IS_OK(result)) { + continue; + } + + for (i=0; i < count; i++) { + ADD_TO_ARRAY(mem_ctx, union spoolss_DriverInfo, + info[i], info_p, count_p); + } + } + + return result; + } + + return enumprinterdrivers_level_by_architecture(mem_ctx, + servername, + architecture, + level, + info_p, + count_p); +} + /**************************************************************************** Enumerates all printer drivers at level 1. ****************************************************************************/ -- cgit