summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-08-25 00:30:15 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:57 +0200
commit3f214284c71a07b8153b9c94d97cd869872007c2 (patch)
tree2dacc855c3c6399d424839853dd6f420f30b3c17 /source3
parent8b4845bd75805e4bcb9082c798f8d4a48ad24e20 (diff)
downloadsamba-3f214284c71a07b8153b9c94d97cd869872007c2.tar.gz
samba-3f214284c71a07b8153b9c94d97cd869872007c2.tar.bz2
samba-3f214284c71a07b8153b9c94d97cd869872007c2.zip
s3:secrets: convert to use dbwrap wrapper functions only
Avoid direct use of the db_record and db_context structs.
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/machine_account_secrets.c2
-rw-r--r--source3/passdb/secrets.c19
2 files changed, 14 insertions, 7 deletions
diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index 16b563c2bb..565c7c4c20 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -287,7 +287,7 @@ void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain)
db_ctx = secrets_db_ctx();
- return db_ctx->fetch_locked(
+ return dbwrap_fetch_locked(
db_ctx, mem_ctx, string_term_tdb_data(trust_keystr(domain)));
}
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index d229640793..273765e2b3 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -129,13 +129,15 @@ void *secrets_fetch(const char *key, size_t *size)
{
TDB_DATA dbuf;
void *result;
+ NTSTATUS status;
if (!secrets_init()) {
return NULL;
}
- if (db_ctx->fetch(db_ctx, talloc_tos(), string_tdb_data(key),
- &dbuf) != 0) {
+ status = dbwrap_fetch(db_ctx, talloc_tos(), string_tdb_data(key),
+ &dbuf);
+ if (!NT_STATUS_IS_OK(status)) {
return NULL;
}
@@ -405,17 +407,22 @@ static int list_trusted_domain(struct db_record *rec, void *private_data)
enum ndr_err_code ndr_err;
DATA_BLOB blob;
struct trustdom_info *dom_info;
+ TDB_DATA key;
+ TDB_DATA value;
struct list_trusted_domains_state *state =
(struct list_trusted_domains_state *)private_data;
- if ((rec->key.dsize < prefix_len)
- || (strncmp((char *)rec->key.dptr, SECRETS_DOMTRUST_ACCT_PASS,
+ key = dbwrap_record_get_key(rec);
+ value = dbwrap_record_get_value(rec);
+
+ if ((key.dsize < prefix_len)
+ || (strncmp((char *)key.dptr, SECRETS_DOMTRUST_ACCT_PASS,
prefix_len) != 0)) {
return 0;
}
- blob = data_blob_const(rec->value.dptr, rec->value.dsize);
+ blob = data_blob_const(value.dptr, value.dsize);
ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &pass,
(ndr_pull_flags_fn_t)ndr_pull_TRUSTED_DOM_PASS);
@@ -475,7 +482,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
return NT_STATUS_NO_MEMORY;
}
- db_ctx->traverse_read(db_ctx, list_trusted_domain, (void *)&state);
+ dbwrap_traverse_read(db_ctx, list_trusted_domain, (void *)&state, NULL);
*num_domains = state.num_domains;
*domains = state.domains;