svn commit: samba r19811 - in branches/SAMBA_3_0/source: include lib rpcclient utils

vlendec at samba.org vlendec at samba.org
Tue Nov 21 02:21:46 GMT 2006


Author: vlendec
Date: 2006-11-21 02:21:45 +0000 (Tue, 21 Nov 2006)
New Revision: 19811

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19811

Log:
Decode REG_MULTI_SZ and REG_BINARY
Modified:
   branches/SAMBA_3_0/source/include/reg_objects.h
   branches/SAMBA_3_0/source/lib/util_reg.c
   branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
   branches/SAMBA_3_0/source/utils/net_rpc_printer.c
   branches/SAMBA_3_0/source/utils/net_rpc_registry.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/reg_objects.h
===================================================================
--- branches/SAMBA_3_0/source/include/reg_objects.h	2006-11-21 01:11:05 UTC (rev 19810)
+++ branches/SAMBA_3_0/source/include/reg_objects.h	2006-11-21 02:21:45 UTC (rev 19811)
@@ -33,9 +33,9 @@
 } REGISTRY_VALUE;
 
 /*
- * A registry string is not necessarily NULL terminated. When retrieving it
- * from the net, we guarantee this however. A server might want to push it
- * without the terminator though.
+ * A REG_SZ string is not necessarily NULL terminated. When retrieving it from
+ * the net, we guarantee this however. A server might want to push it without
+ * the terminator though.
  */
 
 struct registry_string {
@@ -51,7 +51,7 @@
 		struct registry_string sz;
 		struct {
 			uint32 num_strings;
-			struct registry_string *strings;
+			char **strings;
 		} multi_sz;
 		DATA_BLOB binary;
 	} v;

Modified: branches/SAMBA_3_0/source/lib/util_reg.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_reg.c	2006-11-21 01:11:05 UTC (rev 19810)
+++ branches/SAMBA_3_0/source/lib/util_reg.c	2006-11-21 02:21:45 UTC (rev 19811)
@@ -69,7 +69,7 @@
 }
 
 NTSTATUS reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len,
-			   int *num_values, char ***values)
+			   uint32 *num_values, char ***values)
 {
 	const smb_ucs2_t *p = (const smb_ucs2_t *)buf;
 	*num_values = 0;

Modified: branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2006-11-21 01:11:05 UTC (rev 19810)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2006-11-21 02:21:45 UTC (rev 19811)
@@ -709,7 +709,7 @@
 		break;
 	}
 	case REG_MULTI_SZ: {
-		int i, num_values;
+		uint32 i, num_values;
 		char **values;
 
 		if (!NT_STATUS_IS_OK(reg_pull_multi_sz(NULL, value.data_p,

Modified: branches/SAMBA_3_0/source/utils/net_rpc_printer.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_printer.c	2006-11-21 01:11:05 UTC (rev 19810)
+++ branches/SAMBA_3_0/source/utils/net_rpc_printer.c	2006-11-21 02:21:45 UTC (rev 19811)
@@ -129,7 +129,7 @@
 		break;
 
 	case REG_MULTI_SZ: {
-		int i, num_values;
+		uint32 i, num_values;
 		char **values;
 
 		if (!NT_STATUS_IS_OK(reg_pull_multi_sz(NULL, value.data_p,

Modified: branches/SAMBA_3_0/source/utils/net_rpc_registry.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_registry.c	2006-11-21 01:11:05 UTC (rev 19810)
+++ branches/SAMBA_3_0/source/utils/net_rpc_registry.c	2006-11-21 02:21:45 UTC (rev 19811)
@@ -197,7 +197,7 @@
 	struct registry_value *value;
 	NTSTATUS status;
 
-	if (!(value = TALLOC_P(mem_ctx, struct registry_value))) {
+	if (!(value = TALLOC_ZERO_P(mem_ctx, struct registry_value))) {
 		return NT_STATUS_NO_MEMORY;
 	}
 
@@ -247,6 +247,18 @@
 		}
 		break;
 	}
+	case REG_MULTI_SZ:
+		status = reg_pull_multi_sz(value, (void *)data, length,
+					   &value->v.multi_sz.num_strings,
+					   &value->v.multi_sz.strings);
+		if (!(NT_STATUS_IS_OK(status))) {
+			goto error;
+		}
+		break;
+	case REG_BINARY:
+		value->v.binary.data = talloc_move(value, &data);
+		value->v.binary.length = length;
+		break;
 	default:
 		status = NT_STATUS_INVALID_PARAMETER;
 		goto error;
@@ -466,6 +478,18 @@
 		case REG_EXPAND_SZ:
 			d_printf("Value      = \"%s\"\n", v->v.sz.str);
 			break;
+		case REG_MULTI_SZ: {
+			uint32 j;
+			for (j = 0; j < v->v.multi_sz.num_strings; j++) {
+				d_printf("Value[%3.3d] = \"%s\"\n", j,
+					 v->v.multi_sz.strings[j]);
+			}
+			break;
+		}
+		case REG_BINARY:
+			d_printf("Value      = %d bytes\n",
+				 v->v.binary.length);
+			break;
 		default:
 			d_printf("Value      = <unprintable>\n");
 			break;



More information about the samba-cvs mailing list