summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-08-07 21:23:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:27 -0500
commit3fb336126626fa45aa842b66ac4f2b662adbfe77 (patch)
tree67d4be8e687461f9049709ec09083d9a9ca241b8 /source3/rpcclient
parentdb8c38340b35574fc553b5ef7019f942699356f4 (diff)
downloadsamba-3fb336126626fa45aa842b66ac4f2b662adbfe77.tar.gz
samba-3fb336126626fa45aa842b66ac4f2b662adbfe77.tar.bz2
samba-3fb336126626fa45aa842b66ac4f2b662adbfe77.zip
r9200: Add support for REG_BINARY to rpcclient getdata and setprinterdata.
Volker (This used to be commit 9e94ba54b0581e4b7636e70f309af6394de6edbf)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 68ede0fbcd..6c15c91ea1 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -690,10 +690,24 @@ static void display_reg_value(REGISTRY_VALUE value)
STR_TERMINATE);
printf("%s: REG_SZ: %s\n", value.valuename, text);
break;
- case REG_BINARY:
- printf("%s: REG_BINARY: unknown length value not displayed\n",
- value.valuename);
+ case REG_BINARY: {
+ char *hex = hex_encode(NULL, value.data_p, value.size);
+ size_t i, len;
+ printf("%s: REG_BINARY:", value.valuename);
+ 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: {
uint16 *curstr = (uint16 *) value.data_p;
uint8 *start = value.data_p;
@@ -1955,7 +1969,7 @@ static WERROR cmd_spoolss_setprinterdata(struct cli_state *cli,
/* parse the command arguements */
if (argc < 5) {
- printf ("Usage: %s <printer> <string|dword|multistring>"
+ printf ("Usage: %s <printer> <string|binary|dword|multistring>"
" <value> <data>\n",
argv[0]);
return WERR_INVALID_PARAM;
@@ -1972,11 +1986,9 @@ static WERROR cmd_spoolss_setprinterdata(struct cli_state *cli,
value.type = REG_SZ;
}
-#if 0
if (strequal(argv[2], "binary")) {
value.type = REG_BINARY;
}
-#endif
if (strequal(argv[2], "dword")) {
value.type = REG_DWORD;
@@ -2028,6 +2040,12 @@ static WERROR cmd_spoolss_setprinterdata(struct cli_state *cli,
value.data_p = TALLOC_MEMDUP(mem_ctx, &data, sizeof(data));
break;
}
+ case REG_BINARY: {
+ DATA_BLOB data = strhex_to_data_blob(mem_ctx, argv[4]);
+ value.data_p = data.data;
+ value.size = data.length;
+ break;
+ }
case REG_MULTI_SZ: {
int i;
size_t len = 0;