From 0f18ca772da544a93799ca130a8f23529aad98f6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sat, 6 Nov 1999 19:52:04 +0000 Subject: added rpcclient spoolenum command. enumerates printers. spoolss_r_io_enumprinters doesn't decode strings correctly as printer_info_1/2 code has only been written to write structures, not read them. (This used to be commit 135eaa977385cdd5f572a51f654f14d893347d7b) --- source3/include/proto.h | 27 ++++++++++++++++++++++----- source3/include/rpc_spoolss.h | 3 ++- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'source3/include') diff --git a/source3/include/proto.h b/source3/include/proto.h index c382d2d6ed..1bd5d131b5 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -482,14 +482,20 @@ BOOL reg_split_key(const char *full_keyname, uint32 *reg_type, char *key_name); BOOL become_user_permanently(uid_t uid, gid_t gid); void free_void_array(uint32 num_entries, void **entries, void(free_item)(void*)); -BOOL add_item_to_array(uint32 *len, void ***array, const void *item, - void*(item_dup)(const void*)); +void* add_item_to_array(uint32 *len, void ***array, const void *item, + void*(item_dup)(const void*), BOOL alloc_anyway); void free_char_array(uint32 num_entries, char **entries); -BOOL add_chars_to_array(uint32 *len, char ***array, const char *name); +char* add_chars_to_array(uint32 *len, char ***array, const char *name); void free_unistr_array(uint32 num_entries, UNISTR2 **entries); -BOOL add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *name); +UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *name); void free_sid_array(uint32 num_entries, DOM_SID **entries); -BOOL add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); +DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid); +void free_print2_array(uint32 num_entries, PRINTER_INFO_2 **entries); +PRINTER_INFO_2 *add_print2_to_array(uint32 *len, PRINTER_INFO_2 ***array, + const PRINTER_INFO_2 *prt); +void free_print1_array(uint32 num_entries, PRINTER_INFO_1 **entries); +PRINTER_INFO_1 *add_print1_to_array(uint32 *len, PRINTER_INFO_1 ***array, + const PRINTER_INFO_1 *prt); /*The following definitions come from lib/util_file.c */ @@ -2037,6 +2043,11 @@ BOOL samr_query_dispinfo(struct cli_state *cli, uint16 fnum, /*The following definitions come from rpc_client/cli_spoolss.c */ +BOOL spoolss_enum_printers(struct cli_state *cli, uint16 fnum, + uint32 flags, char *servername, + uint32 level, + uint32 *count, + void ***printers); BOOL spoolss_open_printer_ex(struct cli_state *cli, uint16 fnum, char *printername, uint32 cbbuf, uint32 devmod, uint32 des_access, @@ -2968,6 +2979,11 @@ BOOL spoolss_io_q_getprinterdriver2(char *desc, prs_struct *ps, int depth); BOOL spoolss_io_r_getprinterdriver2(char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth); +BOOL make_spoolss_q_enumprinters(SPOOL_Q_ENUMPRINTERS *q_u, + uint32 flags, + const char* servername, + uint32 level, + uint32 size); BOOL spoolss_io_q_enumprinters(char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth); BOOL spoolss_io_r_enumprinters(char *desc, @@ -3415,6 +3431,7 @@ void cmd_sam_enum_groups(struct client_info *info); /*The following definitions come from rpcclient/cmd_spoolss.c */ +void cmd_spoolss_enum_printers(struct client_info *info); void cmd_spoolss_open_printer_ex(struct client_info *info); /*The following definitions come from rpcclient/cmd_srvsvc.c */ diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 0afc8d2b5d..626835933b 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -811,7 +811,7 @@ typedef struct spool_q_enumprinters UNISTR2 servername; uint32 level; BUFFER buffer; -/* uint32 buf_size;*/ + uint32 buf_size; } SPOOL_Q_ENUMPRINTERS; typedef struct spool_r_enumprinters @@ -825,6 +825,7 @@ typedef struct spool_r_enumprinters union { PRINTER_INFO_1 **printers_1; PRINTER_INFO_2 **printers_2; + void *info; } printer; } SPOOL_R_ENUMPRINTERS; -- cgit