summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-10-11 14:07:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:47 -0500
commitfe8aaa5d07eaeb54954a9a36207dbc02a6f39504 (patch)
tree7aef7e7a0673ab229ce7ae8e484211ff6f7a4638 /source4/lib/registry
parentaed95ba66f29b9536e99027fab5327548b984b70 (diff)
downloadsamba-fe8aaa5d07eaeb54954a9a36207dbc02a6f39504.tar.gz
samba-fe8aaa5d07eaeb54954a9a36207dbc02a6f39504.tar.bz2
samba-fe8aaa5d07eaeb54954a9a36207dbc02a6f39504.zip
r2914: ... and support enumerating values (data is not handled yet, only the names)
(This used to be commit b3bc055ac73ff239c2b267717ee91669ecdd4c9b)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c
index 7e228412d5..d76b7715da 100644
--- a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c
+++ b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c
@@ -63,11 +63,6 @@ static int ldb_close_registry(void *data)
return 0;
}
-static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, struct registry_key *p, const char *name, uint32_t access_mask, SEC_DESC *sec, struct registry_key **new)
-{
- return WERR_NOT_SUPPORTED;
-}
-
static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_key **subkey)
{
struct ldb_context *c = k->hive->backend_data;
@@ -93,13 +88,13 @@ static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k,
ldb_search_free(c, msg);
return WERR_OK;
}
-#if 0
-static WERROR ldb_fetch_values(struct registry_key *k, int *count, REG_VAL ***values)
+static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_value **value)
{
struct ldb_context *c = k->hive->backend_data;
- int ret, i, j;
+ int ret;
struct ldb_message **msg;
+ struct ldb_message_element *el;
ret = ldb_search(c, (char *)k->backend_data, LDB_SCOPE_ONELEVEL, "(value=*)", NULL,&msg);
@@ -108,30 +103,18 @@ static WERROR ldb_fetch_values(struct registry_key *k, int *count, REG_VAL ***va
return WERR_FOOBAR;
}
- *values = talloc_array_p(k->mem_ctx, REG_VAL *, ret);
- j = 0;
- for(i = 0; i < ret; i++) {
- struct ldb_message_element *el;
- char *name;
- el = ldb_msg_find_element(msg[i], "key");
-
- name = el->values[0].data;
-
- /* Dirty hack to circumvent ldb_tdb bug */
- if(k->backend_data && !strcmp(msg[i]->dn, (char *)k->backend_data)) continue;
-
- (*values)[j] = reg_val_new(k, NULL);
- (*values)[j]->backend_data = talloc_strdup((*values)[j]->mem_ctx, msg[i]->dn);
- j++;
- }
- *count = j;
+ if(idx >= ret) return WERR_NO_MORE_ITEMS;
+
+ el = ldb_msg_find_element(msg[idx], "value");
+
+ *value = talloc_p(mem_ctx, struct registry_value);
+ (*value)->name = talloc_strdup(mem_ctx, el->values[0].data);
+ (*value)->backend_data = talloc_strdup(mem_ctx, msg[idx]->dn);
ldb_search_free(c, msg);
return WERR_OK;
}
-#endif
-
static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, struct registry_hive *h, const char *name, struct registry_key **key)
{
struct ldb_context *c = h->backend_data;
@@ -176,10 +159,8 @@ static struct registry_operations reg_backend_ldb = {
.name = "ldb",
.open_hive = ldb_open_hive,
.open_key = ldb_open_key,
-/*
- .fetch_values = ldb_fetch_values,*/
+ .get_value_by_index = ldb_get_value_by_id,
.get_subkey_by_index = ldb_get_subkey_by_id,
- .add_key = ldb_add_key,
};
NTSTATUS registry_ldb_init(void)