svn commit: samba r9200 - branches/SAMBA_3_0/source/rpcclient
trunk/source/rpcclient
vlendec at samba.org
vlendec at samba.org
Sun Aug 7 21:23:38 GMT 2005
Author: vlendec
Date: 2005-08-07 21:23:38 +0000 (Sun, 07 Aug 2005)
New Revision: 9200
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9200
Log:
Add support for REG_BINARY to rpcclient getdata and setprinterdata.
Volker
Modified:
branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
trunk/source/rpcclient/cmd_spoolss.c
Changeset:
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c 2005-08-07 21:10:32 UTC (rev 9199)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c 2005-08-07 21:23:38 UTC (rev 9200)
@@ -690,10 +690,24 @@
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 @@
/* 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 @@
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 @@
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;
Modified: trunk/source/rpcclient/cmd_spoolss.c
===================================================================
--- trunk/source/rpcclient/cmd_spoolss.c 2005-08-07 21:10:32 UTC (rev 9199)
+++ trunk/source/rpcclient/cmd_spoolss.c 2005-08-07 21:23:38 UTC (rev 9200)
@@ -690,10 +690,24 @@
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 @@
/* 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 @@
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 @@
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;
More information about the samba-cvs
mailing list