summaryrefslogtreecommitdiff
path: root/source4/lib/registry/common
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-05-23 12:01:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:53 -0500
commitf371d2454298b0e64978c04056da5635d7e72921 (patch)
tree5bbe9b4bd4235992ced31c093aa358b89854f649 /source4/lib/registry/common
parentf7a7192eff21fb48e4bd41ce65d0c0c175d4a1fb (diff)
downloadsamba-f371d2454298b0e64978c04056da5635d7e72921.tar.gz
samba-f371d2454298b0e64978c04056da5635d7e72921.tar.bz2
samba-f371d2454298b0e64978c04056da5635d7e72921.zip
r828: Some fixes in the core and regshell concerning hives and
unicode (This used to be commit 25c27b176c9905f3968e955f33a6db41b0102a38)
Diffstat (limited to 'source4/lib/registry/common')
-rw-r--r--source4/lib/registry/common/reg_interface.c14
-rw-r--r--source4/lib/registry/common/reg_objects.c2
-rw-r--r--source4/lib/registry/common/registry.h2
3 files changed, 9 insertions, 9 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c
index 3e5a545f9a..e748c836cf 100644
--- a/source4/lib/registry/common/reg_interface.c
+++ b/source4/lib/registry/common/reg_interface.c
@@ -176,15 +176,15 @@ WERROR reg_open_key(REG_KEY *parent, const char *name, REG_KEY **result)
return WERR_OK;
}
- mem_ctx = talloc_init("mem_ctx");
-
- fullname = talloc_asprintf(mem_ctx, "%s%s%s", parent->path, parent->path[strlen(parent->path)-1] == '\\'?"":"\\", name);
-
if(!parent->handle->functions->open_key) {
DEBUG(0, ("Registry backend doesn't have get_subkey_by_name nor open_key!\n"));
return WERR_NOT_SUPPORTED;
}
+ mem_ctx = talloc_init("mem_ctx");
+
+ fullname = talloc_asprintf(mem_ctx, "%s%s%s", reg_key_get_path(parent), strlen(reg_key_get_path(parent))?"\\":"", name);
+
error = parent->handle->functions->open_key(parent->handle, parent->hive, fullname, result);
if(!W_ERROR_IS_OK(error)) {
@@ -193,7 +193,7 @@ WERROR reg_open_key(REG_KEY *parent, const char *name, REG_KEY **result)
}
(*result)->handle = parent->handle;
- (*result)->path = fullname;
+ (*result)->path = talloc_asprintf((*result)->mem_ctx, "%s\\%s", reg_key_get_path_abs(parent), (*result)->name);
(*result)->hive = parent->hive;
talloc_steal(mem_ctx, (*result)->mem_ctx, fullname);
@@ -303,7 +303,7 @@ WERROR reg_key_get_subkey_by_index(REG_KEY *key, int idx, REG_KEY **subkey)
return WERR_NOT_SUPPORTED;
}
- (*subkey)->path = talloc_asprintf((*subkey)->mem_ctx, "%s%s%s", key->path, key->path[strlen(key->path)-1] == '\\'?"":"\\", (*subkey)->name);
+ (*subkey)->path = talloc_asprintf((*subkey)->mem_ctx, "%s\\%s", reg_key_get_path_abs(key), (*subkey)->name);
(*subkey)->handle = key->handle;
(*subkey)->hive = key->hive;
@@ -334,7 +334,7 @@ WERROR reg_key_get_subkey_by_name(REG_KEY *key, const char *name, REG_KEY **subk
if(!W_ERROR_IS_OK(error)) return error;
- (*subkey)->path = talloc_asprintf((*subkey)->mem_ctx, "%s%s%s", key->path, key->path[strlen(key->path)-1] == '\\'?"":"\\", (*subkey)->name);
+ (*subkey)->path = talloc_asprintf((*subkey)->mem_ctx, "%s\\%s", reg_key_get_path_abs(key), (*subkey)->name);
(*subkey)->handle = key->handle;
(*subkey)->hive = key->hive;
diff --git a/source4/lib/registry/common/reg_objects.c b/source4/lib/registry/common/reg_objects.c
index 7a92f413ff..0109a1f8fe 100644
--- a/source4/lib/registry/common/reg_objects.c
+++ b/source4/lib/registry/common/reg_objects.c
@@ -141,7 +141,7 @@ char *reg_val_get_path(REG_VAL *v)
const char *reg_key_get_path(REG_KEY *k)
{
SMB_REG_ASSERT(k);
- return strchr(k->path, '\\')?strchr(k->path, '\\')+1:k->path;
+ return strchr(k->path, '\\')?strchr(k->path, '\\')+1:"";
}
const char *reg_key_get_path_abs(REG_KEY *k)
diff --git a/source4/lib/registry/common/registry.h b/source4/lib/registry/common/registry.h
index d4e8cccade..5325a89086 100644
--- a/source4/lib/registry/common/registry.h
+++ b/source4/lib/registry/common/registry.h
@@ -31,7 +31,7 @@
struct reg_key_s {
char *name; /* Name of the key */
char *path; /* Full path to the key */
- smb_ucs2_t *class_name; /* Name of key class */
+ char *class_name; /* Name of key class */
NTTIME last_mod; /* Time last modified */
SEC_DESC *security;
REG_HANDLE *handle;