diff options
author | Michael Adam <obnox@samba.org> | 2008-04-29 17:17:02 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-04-30 12:42:32 +0200 |
commit | 6ec4c8631a16d6798bf48083a84df7ad90f79617 (patch) | |
tree | 13704927858e86469281b7835ebf9510679420ae | |
parent | 167d54cc67e8ba496c8d5a397f08a512525bb61b (diff) | |
download | samba-6ec4c8631a16d6798bf48083a84df7ad90f79617.tar.gz samba-6ec4c8631a16d6798bf48083a84df7ad90f79617.tar.bz2 samba-6ec4c8631a16d6798bf48083a84df7ad90f79617.zip |
registry: add function regdb_key_exists() to check for existence of a key.
The existence of the registry key entry (and not the values entry!) is
taken as the criterion for existence.
Michael
(This used to be commit 207a0ece45d947608df3f764e6bd9b4525d41011)
-rw-r--r-- | source3/registry/reg_backend_db.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 8c994a0c4e..33454c9064 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -27,6 +27,8 @@ static struct db_context *regdb = NULL; static int regdb_refcount; +static bool regdb_key_exists(const char *key); + /* List the deepest path into the registry. All part components will be created.*/ /* If you want to have a part of the path controlled by the tdb and part by @@ -725,6 +727,21 @@ static TDB_DATA regdb_fetch_key_internal(const char *key, TALLOC_CTX *mem_ctx) return dbwrap_fetch_bystring(regdb, mem_ctx, path); } + +static bool regdb_key_exists(const char *key) +{ + TALLOC_CTX *mem_ctx = talloc_stackframe(); + TDB_DATA value; + bool ret; + + value = regdb_fetch_key_internal(key, mem_ctx); + ret = (value.dptr != NULL); + + TALLOC_FREE(mem_ctx); + return ret; +} + + /*********************************************************************** Retrieve an array of strings containing subkeys. Memory should be released by the caller. |