From 3d4221a9cbe178fc96e0e72b6f3b331fc0700752 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 10 Feb 2009 01:53:32 +0100 Subject: s3-spoolss: remove old spoolss_OpenPrinterEx. Guenther --- source3/include/proto.h | 12 --- source3/include/rpc_spoolss.h | 14 ---- source3/rpc_client/cli_spoolss.c | 29 ------- source3/rpc_parse/parse_spoolss.c | 147 ------------------------------------ source3/rpc_server/srv_spoolss_nt.c | 86 --------------------- 5 files changed, 288 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 108e982d61..d5ef65e6ae 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5433,9 +5433,6 @@ WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli, const char *printername, uint32_t access_desired, struct policy_handle *handle); -WERROR rpccli_spoolss_open_printer_ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *printername, const char *datatype, uint32 access_required, - const char *station, const char *username, POLICY_HND *pol); WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, char *name, uint32 flags, uint32 level, uint32 *num_printers, PRINTER_INFO_CTR *ctr); @@ -5799,12 +5796,6 @@ bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *da prs_struct *ps, int depth); bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ); bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode); -bool make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - const fstring printername, - const fstring datatype, - uint32 access_required, - const fstring clientname, - const fstring user_name); bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, const char *srv_name, const char* clientname, const char* user_name, uint32 level, PRINTER_INFO_CTR *ctr); @@ -5816,8 +5807,6 @@ bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 PRINTER_INFO_7 *info); bool spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth); bool spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth); -bool spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth); -bool spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth); bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, const POLICY_HND *handle, const char *valuename, uint32 size); @@ -6163,7 +6152,6 @@ void reset_all_printerdata(struct messaging_context *msg, struct server_id server_id, DATA_BLOB *data); WERROR _spoolss_open_printer(pipes_struct *p, SPOOL_Q_OPEN_PRINTER *q_u, SPOOL_R_OPEN_PRINTER *r_u); -WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, SPOOL_R_OPEN_PRINTER_EX *r_u); bool convert_devicemode(const char *printername, const DEVICEMODE *devmode, NT_DEVICEMODE **pp_nt_devmode); WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value, diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 78e01d39ea..225836cf33 100644 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -406,20 +406,6 @@ typedef struct { /********************************************/ -typedef struct { - UNISTR2 *printername; - PRINTER_DEFAULT printer_default; - uint32 user_switch; - SPOOL_USER_CTR user_ctr; -} SPOOL_Q_OPEN_PRINTER_EX; - -typedef struct { - POLICY_HND handle; /* handle used along all transactions (20*uint8) */ - WERROR status; -} SPOOL_R_OPEN_PRINTER_EX; - -/********************************************/ - typedef struct spool_notify_option_type { uint16 type; diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c index a62c0035a1..b635bc7888 100644 --- a/source3/rpc_client/cli_spoolss.c +++ b/source3/rpc_client/cli_spoolss.c @@ -502,35 +502,6 @@ static bool decode_forms_1(TALLOC_CTX *mem_ctx, RPC_BUFFER *buffer, /********************************************************************** **********************************************************************/ -WERROR rpccli_spoolss_open_printer_ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *printername, const char *datatype, uint32 access_required, - const char *station, const char *username, POLICY_HND *pol) -{ - prs_struct qbuf, rbuf; - SPOOL_Q_OPEN_PRINTER_EX in; - SPOOL_R_OPEN_PRINTER_EX out; - - ZERO_STRUCT(in); - ZERO_STRUCT(out); - - make_spoolss_q_open_printer_ex( &in, printername, datatype, - access_required, station, username ); - - CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_OPENPRINTEREX, - in, out, - qbuf, rbuf, - spoolss_io_q_open_printer_ex, - spoolss_io_r_open_printer_ex, - WERR_GENERAL_FAILURE ); - - memcpy( pol, &out.handle, sizeof(POLICY_HND) ); - - return out.status; -} - -/********************************************************************** -**********************************************************************/ - WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, char *name, uint32 flags, uint32 level, uint32 *num_printers, PRINTER_INFO_CTR *ctr) diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 5f125b8b8e..3af7263c65 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -757,92 +757,6 @@ static bool spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_str return True; } -/******************************************************************* -********************************************************************/ - -static bool spoolss_io_printer_default(const char *desc, PRINTER_DEFAULT *pd, prs_struct *ps, int depth) -{ - if (pd==NULL) - return False; - - prs_debug(ps, depth, desc, "spoolss_io_printer_default"); - depth++; - - if (!prs_uint32("datatype_ptr", ps, depth, &pd->datatype_ptr)) - return False; - - if (!smb_io_unistr2("datatype", &pd->datatype, pd->datatype_ptr, ps,depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!spoolss_io_devmode_cont("", &pd->devmode_cont, ps, depth)) - return False; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("access_required", ps, depth, &pd->access_required)) - return False; - - return True; -} - -/******************************************************************* - * init a structure. - ********************************************************************/ - -bool make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, - const fstring printername, - const fstring datatype, - uint32 access_required, - const fstring clientname, - const fstring user_name) -{ - DEBUG(5,("make_spoolss_q_open_printer_ex\n")); - - q_u->printername = TALLOC_P( talloc_tos(), UNISTR2 ); - if (!q_u->printername) { - return False; - } - init_unistr2(q_u->printername, printername, UNI_STR_TERMINATE); - - q_u->printer_default.datatype_ptr = 0; - - q_u->printer_default.devmode_cont.size=0; - q_u->printer_default.devmode_cont.devmode_ptr=0; - q_u->printer_default.devmode_cont.devmode=NULL; - q_u->printer_default.access_required=access_required; - - q_u->user_switch = 1; - - q_u->user_ctr.level = 1; - q_u->user_ctr.user.user1 = TALLOC_P( talloc_tos(), SPOOL_USER_1 ); - if (!q_u->user_ctr.user.user1) { - return False; - } - q_u->user_ctr.user.user1->size = strlen(clientname) + strlen(user_name) + 10; - q_u->user_ctr.user.user1->build = 1381; - q_u->user_ctr.user.user1->major = 2; - q_u->user_ctr.user.user1->minor = 0; - q_u->user_ctr.user.user1->processor = 0; - - q_u->user_ctr.user.user1->client_name = TALLOC_P( talloc_tos(), UNISTR2 ); - if (!q_u->user_ctr.user.user1->client_name) { - return False; - } - q_u->user_ctr.user.user1->user_name = TALLOC_P( talloc_tos(), UNISTR2 ); - if (!q_u->user_ctr.user.user1->user_name) { - return False; - } - - init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE); - init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE); - - return True; -} - /******************************************************************* * init a structure. ********************************************************************/ @@ -1067,67 +981,6 @@ bool spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_ return True; } - -/******************************************************************* - * read a structure. - * called from spoolss_q_open_printer_ex (srv_spoolss.c) - ********************************************************************/ - -bool spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "spoolss_io_q_open_printer_ex"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->printername)) - return False; - if (!prs_io_unistr2("printername", ps, depth, q_u->printername)) - return False; - - if (!prs_align(ps)) - return False; - - if (!spoolss_io_printer_default("", &q_u->printer_default, ps, depth)) - return False; - - if (!prs_uint32("user_switch", ps, depth, &q_u->user_switch)) - return False; - if (!spool_io_user_level("", &q_u->user_ctr, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - * write a structure. - * called from static spoolss_r_open_printer_ex (srv_spoolss.c) - * called from spoolss_open_printer_ex (cli_spoolss.c) - ********************************************************************/ - -bool spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth) -{ - if (r_u == NULL) return False; - - prs_debug(ps, depth, desc, "spoolss_io_r_open_printer_ex"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth)) - return False; - - if (!prs_werror("status", ps, depth, &(r_u->status))) - return False; - - return True; -} - /******************************************************************* * make a structure. ********************************************************************/ diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 8f43793a53..6f6d9ce0c0 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -1399,92 +1399,6 @@ void reset_all_printerdata(struct messaging_context *msg, return; } -/******************************************************************** - Copy routines used by convert_to_openprinterex() - *******************************************************************/ - -static DEVICEMODE* dup_devicemode(TALLOC_CTX *ctx, DEVICEMODE *devmode) -{ - DEVICEMODE *d; - int len; - - if (!devmode) - return NULL; - - DEBUG (8,("dup_devmode\n")); - - /* bulk copy first */ - - d = (DEVICEMODE *)TALLOC_MEMDUP(ctx, devmode, sizeof(DEVICEMODE)); - if (!d) - return NULL; - - /* dup the pointer members separately */ - - len = unistrlen(devmode->devicename.buffer); - if (len != -1) { - d->devicename.buffer = TALLOC_ARRAY(ctx, uint16, len); - if (!d->devicename.buffer) { - return NULL; - } - if (unistrcpy(d->devicename.buffer, devmode->devicename.buffer) != len) - return NULL; - } - - - len = unistrlen(devmode->formname.buffer); - if (len != -1) { - d->formname.buffer = TALLOC_ARRAY(ctx, uint16, len); - if (!d->formname.buffer) { - return NULL; - } - if (unistrcpy(d->formname.buffer, devmode->formname.buffer) != len) - return NULL; - } - - if (devmode->driverextra) { - d->dev_private = (uint8 *)TALLOC_MEMDUP(ctx, devmode->dev_private, - devmode->driverextra); - if (!d->dev_private) { - return NULL; - } - } else { - d->dev_private = NULL; - } - return d; -} - -static void copy_devmode_ctr(TALLOC_CTX *ctx, DEVMODE_CTR *new_ctr, DEVMODE_CTR *ctr) -{ - if (!new_ctr || !ctr) - return; - - DEBUG(8,("copy_devmode_ctr\n")); - - new_ctr->size = ctr->size; - new_ctr->devmode_ptr = ctr->devmode_ptr; - - if(ctr->devmode_ptr) - new_ctr->devmode = dup_devicemode(ctx, ctr->devmode); -} - -static void copy_printer_default(TALLOC_CTX *ctx, PRINTER_DEFAULT *new_def, PRINTER_DEFAULT *def) -{ - if (!new_def || !def) - return; - - DEBUG(8,("copy_printer_defaults\n")); - - new_def->datatype_ptr = def->datatype_ptr; - - if (def->datatype_ptr) - copy_unistr2(&new_def->datatype, &def->datatype); - - copy_devmode_ctr(ctx, &new_def->devmode_cont, &def->devmode_cont); - - new_def->access_required = def->access_required; -} - /******************************************************************** * Convert a SPOOL_Q_OPEN_PRINTER structure to a * SPOOL_Q_OPEN_PRINTER_EX structure -- cgit