summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_spoolss.c10
-rw-r--r--source3/rpcclient/cmd_spoolss.c15
2 files changed, 17 insertions, 8 deletions
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index 18e17758d6..0a869e45a2 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -393,7 +393,7 @@ WERROR cli_spoolss_close_printer(struct cli_state *cli, TALLOC_CTX *mem_ctx,
WERROR cli_spoolss_enum_printers(struct cli_state *cli, TALLOC_CTX *mem_ctx,
uint32 offered, uint32 *needed,
- uint32 flags, uint32 level,
+ char *name, uint32 flags, uint32 level,
uint32 *num_printers, PRINTER_INFO_CTR *ctr)
{
prs_struct qbuf, rbuf;
@@ -406,7 +406,13 @@ WERROR cli_spoolss_enum_printers(struct cli_state *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(q);
ZERO_STRUCT(r);
- slprintf (server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
+ /* Use server name if no object name specified */
+
+ if (name)
+ slprintf(server, sizeof(fstring) - 1, "\\\\%s", name);
+ else
+ slprintf(server, sizeof(fstring) - 1, "\\\\%s", cli->desthost);
+
strupper (server);
/* Initialise input parameters */
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 22e2db41f3..8ea5ec6837 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -313,16 +313,19 @@ static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
uint32 info_level = 1;
PRINTER_INFO_CTR ctr;
uint32 i = 0, num_printers, needed;
+ char *name = NULL;
- if (argc > 2)
+ if (argc > 3)
{
- printf("Usage: %s [level]\n", argv[0]);
+ printf("Usage: %s [level] [name]\n", argv[0]);
return NT_STATUS_OK;
}
- if (argc == 2) {
+ if (argc == 2)
info_level = atoi(argv[1]);
- }
+
+ if (argc == 3)
+ name = argv[2];
/* Enumerate printers -- Should we enumerate types other
than PRINTER_ENUM_LOCAL? Maybe accept as a parameter? --jerry */
@@ -330,12 +333,12 @@ static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
ZERO_STRUCT(ctr);
result = cli_spoolss_enum_printers(
- cli, mem_ctx, 0, &needed, PRINTER_ENUM_LOCAL,
+ cli, mem_ctx, 0, &needed, name, PRINTER_ENUM_LOCAL,
info_level, &num_printers, &ctr);
if (W_ERROR_V(result) == ERRinsufficientbuffer)
result = cli_spoolss_enum_printers(
- cli, mem_ctx, needed, NULL, PRINTER_ENUM_LOCAL,
+ cli, mem_ctx, needed, NULL, name, PRINTER_ENUM_LOCAL,
info_level, &num_printers, &ctr);
if (W_ERROR_IS_OK(result)) {