[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Nov 29 07:01:13 MST 2009


The branch, master has been updated
       via  51bedf9... lib/registry/util.c - Reorder the registry datatypes of the conversion functions
       via  df1d42f... Revert "s4:registry/util - Don't include the trailing '\0' in the internal data format but add it on the back-conversion to a string"
      from  69a6820... s3: Restore "fake directory create times" as a share parameter

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


- Log -----------------------------------------------------------------
commit 51bedf939568717424edd7732e1e315faa333849
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Nov 29 14:55:20 2009 +0100

    lib/registry/util.c - Reorder the registry datatypes of the conversion functions
    
    This is absolutely cosmetic and makes the code easier to comprehend.

commit df1d42fc1b5fd27a8969819212f51a74b310d909
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Nov 29 14:42:31 2009 +0100

    Revert "s4:registry/util - Don't include the trailing '\0' in the internal data format but add it on the back-conversion to a string"
    
    This reverts commit 7d400715e9af2056690c03a1a2f45c7f343fa313.
    
    "convert_string_talloc_convenience" does always add the NULL termination. Didn't
    know that. Thanks Jelmer for pointing out!

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

Summary of changes:
 source4/lib/registry/util.c |   29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c
index 7646601..f9ea2a1 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -56,7 +56,6 @@ _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, "");
@@ -70,9 +69,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
 							  data.data,
 							  data.length,
 							  (void **)&ret,
-							  &ret_cnt, false);
-			ret = talloc_realloc(mem_ctx, ret, char, ret_cnt + 1);
-			ret[ret_cnt] = '\0';
+							  NULL, false);
 			break;
 		case REG_BINARY:
 			ret = data_blob_hex_string_upper(mem_ctx, &data);
@@ -85,10 +82,14 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
 						      *(int *)data.data);
 			}
 			break;
+		case REG_NONE:
+			/* "NULL" is the right return value */
+			break;
 		case REG_MULTI_SZ:
-			/* FIXME */
+			/* FIXME: We don't support this yet */
 			break;
 		default:
+			/* Other datatypes aren't supported -> return "NULL" */
 			break;
 	}
 
@@ -136,28 +137,26 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
 							  iconv_convenience,
 							  CH_UNIX, CH_UTF16,
 							  data_str,
-							  strlen(data_str),
+							  strlen(data_str)+1,
 							  (void **)&data->data,
 							  &data->length, false);
-
 			break;
-
+		case REG_BINARY:
+			*data = strhex_to_data_blob(mem_ctx, data_str);
+			break;
 		case REG_DWORD: {
 			uint32_t tmp = strtol(data_str, NULL, 0);
 			*data = data_blob_talloc(mem_ctx, &tmp, 4);
 			}
 			break;
-
 		case REG_NONE:
 			ZERO_STRUCTP(data);
 			break;
-
-		case REG_BINARY:
-			*data = strhex_to_data_blob(mem_ctx, data_str);
-			break;
-
+		case REG_MULTI_SZ:
+			/* FIXME: We don't support this yet */
+			return false;
 		default:
-			/* FIXME */
+			/* Other datatypes aren't supported -> return no success */
 			return false;
 	}
 	return true;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list