From 826f3fb86b954b29b4f152d8785860a227798975 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 20 Mar 2002 03:37:27 +0000 Subject: [PATCH] resetprinter merge from SAMBA_2_2 (This used to be commit 88d8897e21749f177952b264031aa386bbbeaaeb) --- source3/include/rpc_spoolss.h | 3 ++- source3/rpc_parse/parse_spoolss.c | 24 ++++++++++++------------ source3/rpc_server/srv_spoolss_nt.c | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 22606b2f30a..d2b5efac07b 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -1810,7 +1810,8 @@ SPOOL_R_SETPRINTERDATA; typedef struct spool_q_resetprinter { POLICY_HND handle; - uint32 unknown1; + uint32 datatype_ptr; + UNISTR2 datatype; DEVMODE_CTR devmode_ctr; } SPOOL_Q_RESETPRINTER; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 17af8394d82..97e2020a3e1 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4,7 +4,7 @@ * Copyright (C) Andrew Tridgell 1992-2000, * Copyright (C) Luke Kenneth Casson Leighton 1996-2000, * Copyright (C) Jean François Micouleau 1998-2000, - * Copyright (C) Gerald Carter 2000, + * Copyright (C) Gerald Carter 2000-2002 * Copyright (C) Tim Potter 2001. * * This program is free software; you can redistribute it and/or modify @@ -4913,12 +4913,9 @@ BOOL spool_io_printer_driver_info_level(char *desc, SPOOL_PRINTER_DRIVER_INFO_LE init a SPOOL_Q_ADDPRINTERDRIVER struct ******************************************************************/ -BOOL make_spoolss_q_addprinterdriver( - TALLOC_CTX *mem_ctx, - SPOOL_Q_ADDPRINTERDRIVER *q_u, - const char* srv_name, - uint32 level, - PRINTER_DRIVER_CTR *info) +BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, + SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, + uint32 level, PRINTER_DRIVER_CTR *info) { DEBUG(5,("make_spoolss_q_addprinterdriver\n")); @@ -4949,11 +4946,9 @@ BOOL make_spoolss_q_addprinterdriver( return True; } -BOOL make_spoolss_driver_info_3( - TALLOC_CTX *mem_ctx, +BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, - DRIVER_INFO_3 *info3 -) + DRIVER_INFO_3 *info3) { uint32 len = 0; uint16 *ptr = info3->dependentfiles; @@ -5741,8 +5736,13 @@ BOOL spoolss_io_q_resetprinter(char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct if (!smb_io_pol_hnd("printer handle", &q_u->handle, ps, depth)) return False; - if (!prs_uint32("unknown1", ps, depth, &q_u->unknown1)) + if (!prs_uint32("datatype_ptr", ps, depth, &q_u->datatype_ptr)) return False; + + if (q_u->datatype_ptr) { + if (!smb_io_unistr2("datatype", &q_u->datatype, q_u->datatype_ptr?True:False, ps, depth)) + return False; + } if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) return False; diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index c4a2334c16f..b23cbaa9aec 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6680,6 +6680,28 @@ WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP WERROR _spoolss_resetprinter(pipes_struct *p, SPOOL_Q_RESETPRINTER *q_u, SPOOL_R_RESETPRINTER *r_u) { + POLICY_HND *handle = &q_u->handle; + Printer_entry *Printer=find_printer_index_by_hnd(p, handle); + int snum; + + DEBUG(5,("_spoolss_resetprinter\n")); + + /* + * All we do is to check to see if the handle and queue is valid. + * This call really doesn't mean anything to us because we only + * support RAW printing. --jerry + */ + + if (!Printer) { + DEBUG(2,("_spoolss_resetprinter: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + return WERR_BADFID; + } + + if (!get_printer_snum(p,handle, &snum)) + return WERR_BADFID; + + + /* blindly return success */ return WERR_OK; }