summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-05-08 00:34:35 +0200
committerMichael Adam <obnox@samba.org>2008-05-08 18:29:09 +0200
commit8e21d223f7c5dc00e64646f98efb15131edd9027 (patch)
tree288134cffc09113f261d891c62e88ca01e9d5b64 /source3/registry
parent4095b008eee6e23e22913cc4754c2bf07c7521dd (diff)
downloadsamba-8e21d223f7c5dc00e64646f98efb15131edd9027.tar.gz
samba-8e21d223f7c5dc00e64646f98efb15131edd9027.tar.bz2
samba-8e21d223f7c5dc00e64646f98efb15131edd9027.zip
registry: add a function regdb_key_is_base_key() to check whether is composite.
This partly duplicates code from regdb_key_exists(). Maybe refactor later. Michael (This used to be commit c27d03bba842ecf99f23b22dc40fa7df33392fa0)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_backend_db.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 3089c43eba..9468c40cf7 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -28,6 +28,7 @@ static struct db_context *regdb = NULL;
static int regdb_refcount;
static bool regdb_key_exists(const char *key);
+static bool regdb_key_is_base_key(const char *key);
/* List the deepest path into the registry. All part components will be created.*/
@@ -771,6 +772,38 @@ static TDB_DATA regdb_fetch_key_internal(TALLOC_CTX *mem_ctx, const char *key)
/**
+ * check whether a given key name represents a base key,
+ * i.e one without a subkey separator ('/' or '\').
+ */
+static bool regdb_key_is_base_key(const char *key)
+{
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
+ bool ret = false;
+ char *path;
+
+ if (key == NULL) {
+ goto done;
+ }
+
+ path = normalize_reg_path(mem_ctx, key);
+ if (path == NULL) {
+ DEBUG(0, ("out of memory! (talloc failed)\n"));
+ goto done;
+ }
+
+ if (*path == '\0') {
+ goto done;
+ }
+
+ ret = (strrchr(path, '/') == NULL);
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return ret;
+}
+
+
+/**
* Check for the existence of a key.
*
* Existence of a key is authoritatively defined by its