summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-10 09:10:53 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-10 09:26:09 +0100
commitbb507d1d49917fcdeebb8fc3c40b6fabf4055b7d (patch)
tree3e4d8a18b4828cc2225c3520ccc1618d880887e8 /source4/lib/registry
parent41be39013b02a6813e87af9d6579a80b3ad5227f (diff)
downloadsamba-bb507d1d49917fcdeebb8fc3c40b6fabf4055b7d.tar.gz
samba-bb507d1d49917fcdeebb8fc3c40b6fabf4055b7d.tar.bz2
samba-bb507d1d49917fcdeebb8fc3c40b6fabf4055b7d.zip
s4:lib/registry/ldb.c - fix up registry backend to be more robust
This should let the new WINREG tests written by gd at least pass against us.
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/ldb.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 12722c912b..a27c94e4a9 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -183,11 +183,7 @@ static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx,
local_ctx = talloc_new(mem_ctx);
- if (add) {
- ret = ldb_dn_new(mem_ctx, ldb, add);
- } else {
- ret = ldb_dn_new(mem_ctx, ldb, NULL);
- }
+ ret = ldb_dn_new(mem_ctx, ldb, add);
if (!ldb_dn_validate(ret)) {
talloc_free(ret);
talloc_free(local_ctx);
@@ -202,7 +198,7 @@ static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx,
if (begin) keyname = begin + 1;
else keyname = mypath;
- if(strlen(keyname)) {
+ if (keyname[0] != '\0') {
if (!ldb_dn_add_base_fmt(ret, "key=%s",
reg_ldb_escape(local_ctx,
keyname)))
@@ -373,7 +369,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
int ret;
char *query;
- if (strlen(name) == 0) {
+ if ((name == NULL) || (name[0] == '\0')) {
/* default value */
return ldb_get_default_value(mem_ctx, k, NULL, data_type, data);
} else {
@@ -531,7 +527,7 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child)
struct ldb_message *msg;
struct ldb_dn *childdn;
- if (strlen(child) == 0) {
+ if ((child == NULL) || (child[0] == '\0')) {
/* default value */
mem_ctx = talloc_init("ldb_del_value");
@@ -707,7 +703,7 @@ static WERROR ldb_set_value(struct hive_key *parent,
msg = reg_ldb_pack_value(kd->ldb, mem_ctx, name, type, data);
msg->dn = ldb_dn_copy(msg, kd->dn);
- if (name[0] != '\0') {
+ if ((name != NULL) && (name[0] != '\0')) {
/* For a default value, we add/overwrite the attributes to/of the hive.
For a normal value, we create a new child. */
if (!ldb_dn_add_child_fmt(msg->dn, "value=%s",