summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-21 15:33:52 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-21 15:33:52 +0100
commitad83995de5df5a738c2fdad48866e226533b9b0a (patch)
tree339c3ea3a51e4cf597fd4c09d0c7156dd1ee0e5f /source4/lib
parent2bbdb2cd34233b0836f1aa7365e02c85494af4fa (diff)
downloadsamba-ad83995de5df5a738c2fdad48866e226533b9b0a.tar.gz
samba-ad83995de5df5a738c2fdad48866e226533b9b0a.tar.bz2
samba-ad83995de5df5a738c2fdad48866e226533b9b0a.zip
s4:registry - "LDB backend" - reg_key_get_info - adapt max. subkey and value length
Those lengths are measured in UTF8 string lengths and not in UTF16 ones (the returned strings are generally in this format). Discovered this by checking the s3 registry code. Therefore we have to multiply the both numbers by two. Discovered with the "regedt32" (old NT registry editor).
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/registry/ldb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 5f1a06c501..46b340da88 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -991,12 +991,13 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
unsigned int i;
struct ldb_message_element *el;
- *max_subkeynamelen = 0;
-
for (i = 0; i < kd->subkey_count; i++) {
el = ldb_msg_find_element(kd->subkeys[i], "key");
*max_subkeynamelen = MAX(*max_subkeynamelen, el->values[0].length);
}
+
+ /* for UTF16 encoding */
+ *max_subkeynamelen *= 2;
}
if (max_valnamelen != NULL || max_valbufsize != NULL) {
@@ -1004,12 +1005,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
struct ldb_message_element *el;
W_ERROR_NOT_OK_RETURN(cache_values(kd));
- if (max_valbufsize != NULL)
- *max_valbufsize = 0;
-
- if (max_valnamelen != NULL)
- *max_valnamelen = 0;
-
for (i = 0; i < kd->value_count; i++) {
if (max_valnamelen != NULL) {
el = ldb_msg_find_element(kd->values[i], "value");
@@ -1026,6 +1021,11 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
talloc_free(data.data);
}
}
+
+ if (max_valnamelen != NULL) {
+ /* for UTF16 encoding */
+ *max_valnamelen *= 2;
+ }
}
return WERR_OK;