From 5f7c40f6d02df70dd3a92d5658f79b668e0ed5df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 27 May 2000 09:53:11 +0000 Subject: getting and setting security descriptors on printers now works this needed some fixes in tdb_unpack(). Tim, you'll need to update (This used to be commit 9422719ab4c35e4ce3199b62dd632433bf391283) --- source3/rpc_server/srv_spoolss.c | 10 ++-------- source3/rpc_server/srv_spoolss_nt.c | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 0f85ba8c80..0e6c456ec3 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -498,14 +498,8 @@ static BOOL api_spoolss_setprinter(prs_struct *data, prs_struct *rdata) } r_u.status = _spoolss_setprinter(&q_u.handle, q_u.level, &q_u.info, - q_u.devmode_ctr, q_u.command); - - /* now, we can free the memory */ - if (q_u.info.level==2 && q_u.info.info_ptr!=0) - safe_free(q_u.info.info_2); - - if (q_u.devmode_ctr.devmode_ptr!=0) - safe_free(q_u.devmode_ctr.devmode); + q_u.devmode_ctr, &q_u.secdesc_ctr, + q_u.command); if(!spoolss_io_r_setprinter("",&r_u,rdata,0)) { DEBUG(0,("spoolss_io_r_setprinter: unable to marshall SPOOL_R_SETPRINTER.\n")); diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 29294f1783..01535b2933 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -2620,9 +2620,6 @@ static void construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, get_a_printer_driver(&driver, 3, printer.info_2->drivername, architecture); fill_printer_driver_info_3(info, driver, servername, architecture); - - free_a_printer_driver(driver, 3); - free_a_printer(printer, 2); } /**************************************************************************** @@ -2929,6 +2926,23 @@ static uint32 control_printer(const POLICY_HND *handle, uint32 command) return ERROR_INVALID_FUNCTION; } +/******************************************************************** + * called by spoolss_api_setprinter + * when updating a printer description + ********************************************************************/ +static uint32 update_printer_sec(const POLICY_HND *handle, uint32 level, + const SPOOL_PRINTER_INFO_LEVEL *info, + const SEC_DESC_BUF *secdesc_ctr) +{ + Printer_entry *Printer = find_printer_index_by_hnd(handle); + + if (!OPEN_HANDLE(Printer)) + return ERROR_INVALID_HANDLE; + + return nt_printing_setsec(Printer->dev.printername, secdesc_ctr); +} + + /******************************************************************** * called by spoolss_api_setprinter * when updating a printer description @@ -3002,6 +3016,7 @@ static uint32 update_printer(const POLICY_HND *handle, uint32 level, uint32 _spoolss_setprinter(const POLICY_HND *handle, uint32 level, const SPOOL_PRINTER_INFO_LEVEL *info, const DEVMODE_CTR devmode_ctr, + const SEC_DESC_BUF *secdesc_ctr, uint32 command) { Printer_entry *Printer = find_printer_index_by_hnd(handle); @@ -3017,6 +3032,9 @@ uint32 _spoolss_setprinter(const POLICY_HND *handle, uint32 level, case 2: return update_printer(handle, level, info, devmode_ctr.devmode); break; + case 3: + return update_printer_sec(handle, level, info, secdesc_ctr); + break; default: return ERROR_INVALID_LEVEL; break; -- cgit