From 8f56cdfaee571a5b4bb735290dfd668ef8c4d730 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 14 Apr 2010 20:46:55 -0400 Subject: [PATCH] s3-spoolss: Move info_ctr conversion to a public helper. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/include/proto.h | 2 ++ source3/printing/nt_printing.c | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 4afe952705..073a0dc989 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4888,6 +4888,8 @@ WERROR get_a_printer_search( Printer_entry *print_hnd, uint32 level, const char *sharename); uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level); +bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r, + struct spoolss_DriverInfo8 *_info8); uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx, struct spoolss_AddDriverInfoCtr *r, char **driver_name, diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 56f5d18691..ba667c3251 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -4660,17 +4660,13 @@ uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level) /**************************************************************************** ****************************************************************************/ -uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx, - struct spoolss_AddDriverInfoCtr *r, - char **driver_name, - uint32_t *version) +bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r, + struct spoolss_DriverInfo8 *_info8) { struct spoolss_DriverInfo8 info8; ZERO_STRUCT(info8); - DEBUG(10,("adding a printer at level [%d]\n", r->level)); - switch (r->level) { case 3: info8.version = r->info.info3->version; @@ -4742,6 +4738,27 @@ uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx, info8.min_inbox_driver_ver_version = r->info.info8->min_inbox_driver_ver_version; break; default: + return false; + } + + *_info8 = info8; + + return true; +} + + +uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx, + struct spoolss_AddDriverInfoCtr *r, + char **driver_name, + uint32_t *version) +{ + struct spoolss_DriverInfo8 info8; + + ZERO_STRUCT(info8); + + DEBUG(10,("adding a printer at level [%d]\n", r->level)); + + if (!driver_info_ctr_to_info8(r, &info8)) { return -1; } -- 2.34.1