[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Fri Nov 27 13:18:22 MST 2009


The branch, master has been updated
       via  7d40071... s4:registry/util - Don't include the trailing '\0' in the internal data format but add it on the back-conversion to a string
       via  e79dd2e... s4:net utility - add a notice for the "help" operation and format it's output of the command list better
      from  51328a7... s3-kerberos: fix the build on Mac OS X 10.6.2.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7d400715e9af2056690c03a1a2f45c7f343fa313
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Fri Nov 27 21:14:44 2009 +0100

    s4:registry/util - Don't include the trailing '\0' in the internal data format but add it on the back-conversion to a string
    
    As far as I know the registry library saves all data (including) strings without
    the null termination. So do it also here in a similar way.

commit e79dd2ef7d8b2aba7a84df5f5e82d2869a0598fc
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Fri Nov 27 20:26:17 2009 +0100

    s4:net utility - add a notice for the "help" operation and format it's output of the command list better

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

Summary of changes:
 source4/lib/registry/util.c |   41 +++++++++++++++++++++++++++--------------
 source4/utils/net/net.c     |    7 ++++++-
 2 files changed, 33 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 88b9d18..7646601 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -56,6 +56,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
 				   const DATA_BLOB data)
 {
 	char *ret = NULL;
+	size_t ret_cnt;
 
 	if (data.length == 0)
 		return talloc_strdup(mem_ctx, "");
@@ -63,18 +64,27 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
 	switch (type) {
 		case REG_EXPAND_SZ:
 		case REG_SZ:
-			convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX,
-					      data.data, data.length,
-					      (void **)&ret, NULL, false);
-			return ret;
+			convert_string_talloc_convenience(mem_ctx,
+							  iconv_convenience,
+							  CH_UTF16, CH_UNIX,
+							  data.data,
+							  data.length,
+							  (void **)&ret,
+							  &ret_cnt, false);
+			ret = talloc_realloc(mem_ctx, ret, char, ret_cnt + 1);
+			ret[ret_cnt] = '\0';
+			break;
 		case REG_BINARY:
 			ret = data_blob_hex_string_upper(mem_ctx, &data);
-			return ret;
+			break;
 		case REG_DWORD:
-			if (*(int *)data.data == 0)
-				return talloc_strdup(mem_ctx, "0");
-			return talloc_asprintf(mem_ctx, "0x%x",
-					       *(int *)data.data);
+			if (*(int *)data.data == 0) {
+				ret = talloc_strdup(mem_ctx, "0");
+			} else {
+				ret = talloc_asprintf(mem_ctx, "0x%x",
+						      *(int *)data.data);
+			}
+			break;
 		case REG_MULTI_SZ:
 			/* FIXME */
 			break;
@@ -119,13 +129,16 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
 
 	/* Convert data appropriately */
 
-	switch (*type)
-	{
+	switch (*type) {
 		case REG_SZ:
 		case REG_EXPAND_SZ:
-      		convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16,
-						     data_str, strlen(data_str)+1,
-						     (void **)&data->data, &data->length, false);
+			convert_string_talloc_convenience(mem_ctx,
+							  iconv_convenience,
+							  CH_UNIX, CH_UTF16,
+							  data_str,
+							  strlen(data_str),
+							  (void **)&data->data,
+							  &data->length, false);
 
 			break;
 
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index a96c672..828e468 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -120,7 +120,11 @@ int net_help(struct net_context *ctx, const struct net_functable *ftable)
 
 	d_printf("Available commands:\n");
 	while (name && desc) {
-		d_printf("\t%s\t\t%s", name, desc);
+		if (strlen(name) > 7) {
+			d_printf("\t%s\t%s", name, desc);
+		} else {
+			d_printf("\t%s\t\t%s", name, desc);
+		}
 		name = ftable[++i].name;
 		desc = ftable[i].desc;
 	}
@@ -132,6 +136,7 @@ static int net_usage(struct net_context *ctx, int argc, const char **argv)
 {
 	d_printf("Usage:\n");
 	d_printf("net <command> [options]\n");
+	d_printf("Type 'net help' for all available commands\n");
 	return 0;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list