[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2452-g5b5b293

Michael Adam obnox at samba.org
Thu May 15 15:51:01 GMT 2008


The branch, v3-3-test has been updated
       via  5b5b29302b53c31256dfa2fdefead458cb14c560 (commit)
       via  9ee5ddb96360987675963d629f98051bf34e3031 (commit)
       via  5dedde7a5b01d47947a8ff49a57e729fe5bfc817 (commit)
       via  b7e8a3f1caf54145d750209f2e14b5b54c61769b (commit)
       via  889e19303e141e226898f837a637a2d591c75ad9 (commit)
       via  340a706422cbca45cc63fa94d36c88f6751f4f31 (commit)
      from  954d0998c2c00140addb6ba3845e80ed91e4effc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 5b5b29302b53c31256dfa2fdefead458cb14c560
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 16:49:25 2008 +0200

    net rpc registry: add a getvalueraw subcommand.
    
    Michael

commit 9ee5ddb96360987675963d629f98051bf34e3031
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 16:07:06 2008 +0200

    net rpc registry: abstract add boolean "raw" to rpc_registry_getvalue_internal()
    
    and wrap it into new rpc_registry_getvalue_full() for the getvalue subcommand.
    
    Michael

commit 5dedde7a5b01d47947a8ff49a57e729fe5bfc817
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 14:38:01 2008 +0200

    net rpc registry: fix usage message of getvalue.
    
    Michael

commit b7e8a3f1caf54145d750209f2e14b5b54c61769b
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 14:35:45 2008 +0200

    net registry: add a getvalueraw command to print the value in raw format.
    
    Michael

commit 889e19303e141e226898f837a637a2d591c75ad9
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 14:34:21 2008 +0200

    net registry: refactor core of net_registry_getvalue() out
    
    into net_registry_getvalue_internal(), which takes a bool parameter "raw"
    controlling the output format.
    
    Michael

commit 340a706422cbca45cc63fa94d36c88f6751f4f31
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 15 12:55:54 2008 +0200

    net_registry: add raw output of value to print_registry_value().
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/utils/net_registry.c      |   23 +++++++++++++++--
 source/utils/net_registry_util.c |   45 +++++++++++++++++++++++++--------
 source/utils/net_registry_util.h |    2 +-
 source/utils/net_rpc_registry.c  |   50 +++++++++++++++++++++++++++++++++++--
 4 files changed, 102 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_registry.c b/source/utils/net_registry.c
index 89eadb5..6b3f6ff 100644
--- a/source/utils/net_registry.c
+++ b/source/utils/net_registry.c
@@ -263,8 +263,8 @@ done:
 	return ret;
 }
 
-static int net_registry_getvalue(struct net_context *c, int argc,
-				 const char **argv)
+static int net_registry_getvalue_internal(struct net_context *c, int argc,
+					  const char **argv, bool raw)
 {
 	WERROR werr;
 	int ret = -1;
@@ -291,7 +291,7 @@ static int net_registry_getvalue(struct net_context *c, int argc,
 		goto done;
 	}
 
-	print_registry_value(value);
+	print_registry_value(value, raw);
 
 	ret = 0;
 
@@ -300,6 +300,18 @@ done:
 	return ret;
 }
 
+static int net_registry_getvalue(struct net_context *c, int argc,
+				 const char **argv)
+{
+	return net_registry_getvalue_internal(c, argc, argv, false);
+}
+
+static int net_registry_getvalueraw(struct net_context *c, int argc,
+				    const char **argv)
+{
+	return net_registry_getvalue_internal(c, argc, argv, true);
+}
+
 static int net_registry_setvalue(struct net_context *c, int argc,
 				 const char **argv)
 {
@@ -463,6 +475,11 @@ int net_registry(struct net_context *c, int argc, const char **argv)
 			"Print a registry value",
 		},
 		{
+			"getvalueraw",
+			net_registry_getvalueraw,
+			"Print a registry value (raw format)",
+		},
+		{
 			"setvalue",
 			net_registry_setvalue,
 			"Set a new registry value"
diff --git a/source/utils/net_registry_util.c b/source/utils/net_registry_util.c
index ca80e60..2783778 100644
--- a/source/utils/net_registry_util.c
+++ b/source/utils/net_registry_util.c
@@ -32,32 +32,55 @@ void print_registry_key(const char *keyname, NTTIME *modtime)
 	d_printf("\n");
 }
 
-void print_registry_value(const struct registry_value *valvalue)
+void print_registry_value(const struct registry_value *valvalue, bool raw)
 {
-	d_printf("Type       = %s\n",
-		 reg_type_lookup(valvalue->type));
+	if (!raw) {
+		d_printf("Type       = %s\n",
+			 reg_type_lookup(valvalue->type));
+	}
 	switch(valvalue->type) {
 	case REG_DWORD:
-		d_printf("Value      = %d\n", valvalue->v.dword);
+		if (!raw) {
+			d_printf("Value      = ");
+		}
+		d_printf("%d\n", valvalue->v.dword);
 		break;
 	case REG_SZ:
 	case REG_EXPAND_SZ:
-		d_printf("Value      = \"%s\"\n", valvalue->v.sz.str);
+		if (!raw) {
+			d_printf("Value      = \"");
+		}
+		d_printf("%s", valvalue->v.sz.str);
+		if (!raw) {
+			d_printf("\"");
+		}
+		d_printf("\n");
 		break;
 	case REG_MULTI_SZ: {
 		uint32 j;
 		for (j = 0; j < valvalue->v.multi_sz.num_strings; j++) {
-			d_printf("Value[%3.3d] = \"%s\"\n", j,
-				 valvalue->v.multi_sz.strings[j]);
+			if (!raw) {
+				d_printf("Value[%3.3d] = \"", j);
+			}
+			d_printf("%s", valvalue->v.multi_sz.strings[j]);
+			if (!raw) {
+				d_printf("\"");
+			}
+			d_printf("\n");
 		}
 		break;
 	}
 	case REG_BINARY:
-		d_printf("Value      = %d bytes\n",
-			 (int)valvalue->v.binary.length);
+		if (!raw) {
+			d_printf("Value      = ");
+		}
+		d_printf("%d bytes\n", (int)valvalue->v.binary.length);
 		break;
 	default:
-		d_printf("Value      = <unprintable>\n");
+		if (!raw) {
+			d_printf("Value      = ");
+		}
+		d_printf("<unprintable>\n");
 		break;
 	}
 }
@@ -66,7 +89,7 @@ void print_registry_value_with_name(const char *valname,
 				    const struct registry_value *valvalue)
 {
 	d_printf("Valuename  = %s\n", valname);
-	print_registry_value(valvalue);
+	print_registry_value(valvalue, false);
 	d_printf("\n");
 }
 
diff --git a/source/utils/net_registry_util.h b/source/utils/net_registry_util.h
index 09aaa83..61fd834 100644
--- a/source/utils/net_registry_util.h
+++ b/source/utils/net_registry_util.h
@@ -24,7 +24,7 @@
 
 void print_registry_key(const char *keyname, NTTIME *modtime);
 
-void print_registry_value(const struct registry_value *valvalue);
+void print_registry_value(const struct registry_value *valvalue, bool raw);
 
 void print_registry_value_with_name(const char *valname,
 				    const struct registry_value *valvalue);
diff --git a/source/utils/net_rpc_registry.c b/source/utils/net_rpc_registry.c
index 5da1993..a23caf5 100644
--- a/source/utils/net_rpc_registry.c
+++ b/source/utils/net_rpc_registry.c
@@ -498,6 +498,7 @@ static NTSTATUS rpc_registry_getvalue_internal(struct net_context *c,
 					       struct cli_state *cli,
 					       struct rpc_pipe_client *pipe_hnd,
 					       TALLOC_CTX *mem_ctx,
+					       bool raw,
 					       int argc,
 					       const char **argv)
 {
@@ -568,7 +569,7 @@ static NTSTATUS rpc_registry_getvalue_internal(struct net_context *c,
 		goto done;
 	}
 
-	print_registry_value(value);
+	print_registry_value(value, false);
 
 done:
 	rpccli_winreg_CloseKey(pipe_hnd, tmp_ctx, &key_hnd, NULL);
@@ -579,17 +580,58 @@ done:
 	return status;
 }
 
+static NTSTATUS rpc_registry_getvalue_full(struct net_context *c,
+					   const DOM_SID *domain_sid,
+					   const char *domain_name,
+					   struct cli_state *cli,
+					   struct rpc_pipe_client *pipe_hnd,
+					   TALLOC_CTX *mem_ctx,
+					   int argc,
+					   const char **argv)
+{
+	return rpc_registry_getvalue_internal(c, domain_sid, domain_name,
+					      cli, pipe_hnd, mem_ctx, false,
+					      argc, argv);
+}
+
 static int rpc_registry_getvalue(struct net_context *c, int argc,
 				 const char **argv)
 {
 	if (argc != 2) {
-		d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
+		d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
 			  "<valuename>\n");
 		return -1;
 	}
 
 	return run_rpc_command(c, NULL, PI_WINREG, 0,
-		rpc_registry_getvalue_internal, argc, argv);
+		rpc_registry_getvalue_full, argc, argv);
+}
+
+static NTSTATUS rpc_registry_getvalue_raw(struct net_context *c,
+					  const DOM_SID *domain_sid,
+					  const char *domain_name,
+					  struct cli_state *cli,
+					  struct rpc_pipe_client *pipe_hnd,
+					  TALLOC_CTX *mem_ctx,
+					  int argc,
+					  const char **argv)
+{
+	return rpc_registry_getvalue_internal(c, domain_sid, domain_name,
+					      cli, pipe_hnd, mem_ctx, true,
+					      argc, argv);
+}
+
+static int rpc_registry_getvalueraw(struct net_context *c, int argc,
+				    const char **argv)
+{
+	if (argc != 2) {
+		d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
+			  "<valuename>\n");
+		return -1;
+	}
+
+	return run_rpc_command(c, NULL, PI_WINREG, 0,
+		rpc_registry_getvalue_raw, argc, argv);
 }
 
 static NTSTATUS rpc_registry_createkey_internal(struct net_context *c,
@@ -1182,6 +1224,8 @@ int net_rpc_registry(struct net_context *c, int argc, const char **argv)
 		  "Delete a registry key" },
 		{ "getvalue", rpc_registry_getvalue,
 		  "Print a registry value" },
+		{ "getvalueraw", rpc_registry_getvalueraw,
+		  "Print a registry value" },
 		{ "setvalue",  rpc_registry_setvalue,
 		  "Set a new registry value" },
 		{ "deletevalue",  rpc_registry_deletevalue,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list