summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-17 23:45:16 +0100
committerGünther Deschner <gd@samba.org>2009-03-18 01:30:26 +0100
commit8c3ef2d9004f3c540bae21b92e0b568008bc1130 (patch)
tree6f3851672eb9b421bbdbae684b867557a1060e7f /source3/rpcclient
parentab85fc78bd932aca14103352f784a4b5f2909f3a (diff)
downloadsamba-8c3ef2d9004f3c540bae21b92e0b568008bc1130.tar.gz
samba-8c3ef2d9004f3c540bae21b92e0b568008bc1130.tar.bz2
samba-8c3ef2d9004f3c540bae21b92e0b568008bc1130.zip
s3-rpcclient: use rpccli_spoolss_enumprinterdataex wrapper.
Guenther
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 6dac397071..053f0b2b1f 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -2545,17 +2545,15 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
WERROR result;
uint32 i;
const char *printername;
- const char *keyname = NULL;
POLICY_HND hnd;
- REGVAL_CTR *ctr = NULL;
+ uint32_t count;
+ struct spoolss_PrinterEnumValues *info;
if (argc != 3) {
printf("Usage: %s printername <keyname>\n", argv[0]);
return WERR_OK;
}
- keyname = argv[2];
-
/* Open printer handle */
RPCCLIENT_PRINTERNAME(printername, cli, argv[1]);
@@ -2564,28 +2562,32 @@ static WERROR cmd_spoolss_enum_data_ex( struct rpc_pipe_client *cli,
printername,
SEC_FLAG_MAXIMUM_ALLOWED,
&hnd);
- if (!W_ERROR_IS_OK(result))
+ if (!W_ERROR_IS_OK(result)) {
goto done;
+ }
/* Enumerate subkeys */
- if ( !(ctr = TALLOC_ZERO_P( mem_ctx, REGVAL_CTR )) )
- return WERR_NOMEM;
-
- result = rpccli_spoolss_enumprinterdataex(cli, mem_ctx, &hnd, keyname, ctr);
-
- if (!W_ERROR_IS_OK(result))
+ result = rpccli_spoolss_enumprinterdataex(cli, mem_ctx,
+ &hnd,
+ argv[2],
+ 0,
+ &count,
+ &info);
+ if (!W_ERROR_IS_OK(result)) {
goto done;
-
- for (i=0; i < ctr->num_values; i++) {
- display_reg_value(*(ctr->values[i]));
}
- TALLOC_FREE( ctr );
+ for (i=0; i < count; i++) {
+ display_printer_data(info[i].value_name,
+ info[i].type,
+ info[i].data);
+ }
-done:
- if (is_valid_policy_hnd(&hnd))
+ done:
+ if (is_valid_policy_hnd(&hnd)) {
rpccli_spoolss_ClosePrinter(cli, mem_ctx, &hnd, NULL);
+ }
return result;
}