summaryrefslogtreecommitdiff
path: root/source4/lib/registry/reg_backend_ldb.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/registry/reg_backend_ldb.c')
-rw-r--r--source4/lib/registry/reg_backend_ldb.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c
index 784d8ac6fa..114614597f 100644
--- a/source4/lib/registry/reg_backend_ldb.c
+++ b/source4/lib/registry/reg_backend_ldb.c
@@ -126,12 +126,24 @@ static char *reg_path_to_ldb(TALLOC_CTX *mem_ctx, struct registry_key *from, con
while(mypath) {
char *keyname;
begin = strrchr(mypath, '\\');
+ struct ldb_val val;
+ char *key;
- if(begin) keyname = begin + 1;
+ if (begin) keyname = begin + 1;
else keyname = mypath;
- if(strlen(keyname))
- ret = talloc_asprintf_append(ret, "key=%s,", keyname);
+ val.data = keyname;
+ val.length = strlen(keyname);
+
+ key = ldb_dn_escape_value(mem_ctx, val);
+ if (key == NULL) {
+ return NULL;
+ }
+
+ if (strlen(key))
+ ret = talloc_asprintf_append(ret, "key=%s,", key);
+
+ talloc_free(key);
if(begin) {
*begin = '\0';