From 0d694e1261975bdc565b673e38001c67f9ca239a Mon Sep 17 00:00:00 2001
From: Simo Sorce <idra@samba.org>
Date: Mon, 26 Apr 2010 09:30:10 -0400
Subject: s3-spoolss: Use spoolss_PrinterInfo2 in
 construct_printer_driver_info_level.

Signed-off-by: Jim McDonough <jmcd@samba.org>
---
 source3/rpc_server/srv_spoolss_nt.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

(limited to 'source3/rpc_server')

diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index cc0a8ef9eb..27bd5aef95 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4811,11 +4811,15 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx,
 						  const char *architecture,
 						  uint32_t version)
 {
-	NT_PRINTER_INFO_LEVEL *printer = NULL;
+	struct spoolss_PrinterInfo2 *pinfo2 = NULL;
 	struct spoolss_DriverInfo8 *driver;
 	WERROR result;
 
-	result = get_a_printer(NULL, &printer, 2, lp_const_servicename(snum));
+	result = winreg_get_printer(mem_ctx,
+				    server_info,
+				    servername,
+				    lp_const_servicename(snum),
+				    &pinfo2);
 
 	DEBUG(8,("construct_printer_driver_info_level: status: %s\n",
 		win_errstr(result)));
@@ -4825,8 +4829,7 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx,
 	}
 
 	result = winreg_get_driver(mem_ctx, server_info, architecture,
-				   printer->info_2->drivername,
-				   version, &driver);
+				   pinfo2->drivername, version, &driver);
 
 	DEBUG(8,("construct_printer_driver_info_level: status: %s\n",
 		win_errstr(result)));
@@ -4837,19 +4840,19 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx,
 		 */
 
 		if (version < 3) {
-			free_a_printer(&printer, 2);
+			talloc_free(pinfo2);
 			return WERR_UNKNOWN_PRINTER_DRIVER;
 		}
 
 		/* Yes - try again with a WinNT driver. */
 		version = 2;
 		result = winreg_get_driver(mem_ctx, server_info, architecture,
-					   printer->info_2->drivername,
+					   pinfo2->drivername,
 					   version, &driver);
 		DEBUG(8,("construct_printer_driver_level: status: %s\n",
 			win_errstr(result)));
 		if (!W_ERROR_IS_OK(result)) {
-			free_a_printer(&printer, 2);
+			talloc_free(pinfo2);
 			return WERR_UNKNOWN_PRINTER_DRIVER;
 		}
 	}
@@ -4886,7 +4889,7 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx,
 		break;
 	}
 
-	free_a_printer(&printer, 2);
+	talloc_free(pinfo2);
 	talloc_free(driver);
 
 	return result;
-- 
cgit