diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-18 02:45:00 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-01-18 03:41:59 +0100 |
commit | 85d60d2d091a2eb6bd4c73c87c94b10ee93167ee (patch) | |
tree | b0c1498f80bffbc7a7e0271f15a9847405ce2654 /source4/lib/registry/ldb.c | |
parent | 4d8a60f617f941ff6481bcfbac73d7ed69e43daa (diff) | |
download | samba-85d60d2d091a2eb6bd4c73c87c94b10ee93167ee.tar.gz samba-85d60d2d091a2eb6bd4c73c87c94b10ee93167ee.tar.bz2 samba-85d60d2d091a2eb6bd4c73c87c94b10ee93167ee.zip |
registry: Improve error codes and update tests.
Rather than map the error returned by the registry to the correct error,
return the correct error in the first place.
Also deal with the fact that the right error code is now returned in a
couple of places.
(This used to be commit 1e31fcb8a097810a97e2d4bb1f243f1b34cc2415)
Diffstat (limited to 'source4/lib/registry/ldb.c')
-rw-r--r-- | source4/lib/registry/ldb.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 884aed1579..17fac4abb2 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -111,7 +111,6 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, return msg; } - static char *reg_ldb_escape(TALLOC_CTX *mem_ctx, const char *value) { struct ldb_val val; @@ -303,7 +302,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k, } if (res->count == 0) - return WERR_NOT_FOUND; + return WERR_BADFILE; reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data); @@ -410,8 +409,12 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, talloc_strdup(mem_ctx, classname)); ret = ldb_add(parentkd->ldb, msg); + if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) { + return WERR_ALREADY_EXISTS; + } + if (ret != LDB_SUCCESS) { - DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parentkd->ldb))); + DEBUG(1, ("ldb_add: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } |