summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-04-14 20:46:55 -0400
committerGünther Deschner <gd@samba.org>2010-04-23 16:23:49 +0200
commit8f56cdfaee571a5b4bb735290dfd668ef8c4d730 (patch)
treee76f5741d98505ddd28373fb35c7ae893cbf355a
parent94a8482261526c7bb3ae15194bf3939978b324b6 (diff)
downloadsamba-8f56cdfaee571a5b4bb735290dfd668ef8c4d730.tar.gz
samba-8f56cdfaee571a5b4bb735290dfd668ef8c4d730.tar.bz2
samba-8f56cdfaee571a5b4bb735290dfd668ef8c4d730.zip
s3-spoolss: Move info_ctr conversion to a public helper.
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/printing/nt_printing.c29
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;
}