summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-14 01:28:55 +0100
committerGünther Deschner <gd@samba.org>2009-03-17 11:49:15 +0100
commit704220c2a240498f1ac4be8854c5ea4fe8958a9f (patch)
tree80cb353ebd011d7b90bcdb491910f2baee71a761 /source3/rpcclient
parent08d170abc12b72e027b80f22b11213346fb6cf7e (diff)
downloadsamba-704220c2a240498f1ac4be8854c5ea4fe8958a9f.tar.gz
samba-704220c2a240498f1ac4be8854c5ea4fe8958a9f.tar.bz2
samba-704220c2a240498f1ac4be8854c5ea4fe8958a9f.zip
s3-rpcclient: use rpccli_spoolss_getprinterdata.
Guenther
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c63
1 files changed, 57 insertions, 6 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 33fff2e3b3..f4802f7e96 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -697,6 +697,54 @@ static void display_reg_value(REGISTRY_VALUE value)
/****************************************************************************
****************************************************************************/
+static void display_printer_data(const char *v,
+ enum winreg_Type type,
+ union spoolss_PrinterData *r)
+{
+ int i;
+
+ switch (type) {
+ case REG_DWORD:
+ printf("%s: REG_DWORD: 0x%08x\n", v, r->value);
+ break;
+ case REG_SZ:
+ printf("%s: REG_SZ: %s\n", v, r->string);
+ break;
+ case REG_BINARY: {
+ char *hex = hex_encode_talloc(NULL,
+ r->binary.data, r->binary.length);
+ size_t len;
+ printf("%s: REG_BINARY:", v);
+ len = strlen(hex);
+ for (i=0; i<len; i++) {
+ if (hex[i] == '\0') {
+ break;
+ }
+ if (i%40 == 0) {
+ putchar('\n');
+ }
+ putchar(hex[i]);
+ }
+ TALLOC_FREE(hex);
+ putchar('\n');
+ break;
+ }
+ case REG_MULTI_SZ:
+ printf("%s: REG_MULTI_SZ: ", v);
+ for (i=0; r->string_array[i] != NULL; i++) {
+ printf("%s ", r->string_array[i]);
+ }
+ printf("\n");
+ break;
+ default:
+ printf("%s: unknown type 0x%02x:\n", v, type);
+ break;
+ }
+}
+
+/****************************************************************************
+****************************************************************************/
+
static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
@@ -705,7 +753,8 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
WERROR result;
fstring printername;
const char *valuename;
- REGISTRY_VALUE value;
+ enum winreg_Type type;
+ union spoolss_PrinterData data;
if (argc != 3) {
printf("Usage: %s <printername> <valuename>\n", argv[0]);
@@ -733,16 +782,18 @@ static WERROR cmd_spoolss_getprinterdata(struct rpc_pipe_client *cli,
/* Get printer info */
- result = rpccli_spoolss_getprinterdata(cli, mem_ctx, &pol, valuename, &value);
-
+ result = rpccli_spoolss_getprinterdata(cli, mem_ctx,
+ &pol,
+ valuename,
+ 0,
+ &type,
+ &data);
if (!W_ERROR_IS_OK(result))
goto done;
/* Display printer data */
- fstrcpy(value.valuename, valuename);
- display_reg_value(value);
-
+ display_printer_data(valuename, type, &data);
done:
if (is_valid_policy_hnd(&pol))