diff options
author | Günther Deschner <gd@samba.org> | 2016-12-01 21:32:18 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-01-08 23:51:30 +0000 |
commit | ce00972afc205af4f93cde5c3e30a07ec222670c (patch) | |
tree | e84b9533662bf6994f2f7806ca4ed928af3c74c5 /source3/rpcclient | |
parent | a340aecdd025352bd0cefc1be1aac7526dfe1748 (diff) | |
download | samba-ce00972afc205af4f93cde5c3e30a07ec222670c.tar.gz |
s3-rpcclient: add enumpermachineconnections command
Guenther
Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index dbcfd17dba2..ce604227bf5 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -3994,6 +3994,57 @@ static WERROR cmd_spoolss_get_core_printer_drivers(struct rpc_pipe_client *cli, return WERR_OK; } +static WERROR cmd_spoolss_enum_permachineconnections(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) +{ + NTSTATUS status; + WERROR result; + struct dcerpc_binding_handle *b = cli->binding_handle; + const char *servername = cli->srv_name_slash; + DATA_BLOB in = data_blob_null; + DATA_BLOB out = data_blob_null; + uint32_t needed, count; + + if (argc > 2) { + printf("usage: %s [servername]\n", argv[0]); + return WERR_OK; + } + + if (argc > 1) { + servername = argv[1]; + } + + status = dcerpc_spoolss_EnumPerMachineConnections(b, mem_ctx, + servername, + &in, + in.length, + &out, + &needed, + &count, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + + if (W_ERROR_EQUAL(result, WERR_INSUFFICIENT_BUFFER)) { + in = data_blob_talloc_zero(mem_ctx, needed); + status = dcerpc_spoolss_EnumPerMachineConnections(b, mem_ctx, + servername, + &in, + in.length, + &out, + &needed, + &count, + &result); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } + } + + return result; +} + /* List of commands exported by this module */ struct cmd_set spoolss_commands[] = { @@ -4392,7 +4443,16 @@ struct cmd_set spoolss_commands[] = { .description = "Get CorePrinterDriver", .usage = "", }, - + { + .name = "enumpermachineconnections", + .returntype = RPC_RTYPE_WERROR, + .ntfn = NULL, + .wfn = cmd_spoolss_enum_permachineconnections, + .table = &ndr_table_spoolss, + .rpc_pipe = NULL, + .description = "Enumerate Per Machine Connections", + .usage = "", + }, { .name = NULL, }, |