summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-01 12:38:54 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-01 14:04:20 +0200
commit2b21b02c6af64ecff931dd1c01caf078804d95c4 (patch)
treeb3865b161ace3cabaf2d5efb14fed307826ac13a /source3/registry
parent41281d3525e70f37aa7f61ef1f8ba90f5557de9a (diff)
downloadsamba-2b21b02c6af64ecff931dd1c01caf078804d95c4.tar.gz
samba-2b21b02c6af64ecff931dd1c01caf078804d95c4.tar.bz2
samba-2b21b02c6af64ecff931dd1c01caf078804d95c4.zip
regdb: use dbwrap->fetch() instead of fetch_locked() for readonly access"
This is the fixed version of commit 5c28c74aa06a82559f498373b3d6e9892d5c2cbe. metze (This used to be commit 924acd7f695d7514b1a4628468137cf632c8f1f0)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_backend_db.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 06f3d1acb3..60800e790d 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -705,8 +705,9 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
int i;
fstring subkeyname;
int ret = -1;
+ int dbret = -1;
TALLOC_CTX *frame = talloc_stackframe();
- struct db_record *rec;
+ TDB_DATA value;
DEBUG(11,("regdb_fetch_keys: Enter key => [%s]\n", key ? key : "NULL"));
@@ -722,16 +723,16 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
}
strupper_m(path);
- rec = regdb->fetch_locked(regdb, frame, string_term_tdb_data(path));
- if (rec == NULL) {
+ dbret = regdb->fetch(regdb, frame, string_term_tdb_data(path), &value);
+ if (dbret != 0) {
ret = 0;
goto fail;
}
ctr->seqnum = regdb_get_seqnum();
- buf = rec->value.dptr;
- buflen = rec->value.dsize;
+ buf = value.dptr;
+ buflen = value.dsize;
if ( !buf ) {
DEBUG(5,("regdb_fetch_keys: tdb lookup failed to locate key [%s]\n", key));
@@ -841,8 +842,9 @@ int regdb_fetch_values( const char* key, REGVAL_CTR *values )
{
char *keystr = NULL;
TALLOC_CTX *ctx = talloc_stackframe();
- struct db_record *rec;
int ret = 0;
+ int dbret = -1;
+ TDB_DATA value;
DEBUG(10,("regdb_fetch_values: Looking for value of key [%s] \n", key));
@@ -855,19 +857,19 @@ int regdb_fetch_values( const char* key, REGVAL_CTR *values )
goto done;
}
- rec = regdb->fetch_locked(regdb, ctx, string_term_tdb_data(keystr));
- if (rec == NULL) {
+ dbret = regdb->fetch(regdb, ctx, string_term_tdb_data(keystr), &value);
+ if (dbret != 0) {
goto done;
}
values->seqnum = regdb_get_seqnum();
- if (!rec->value.dptr) {
+ if (!value.dptr) {
/* all keys have zero values by default */
goto done;
}
- regdb_unpack_values(values, rec->value.dptr, rec->value.dsize);
+ regdb_unpack_values(values, value.dptr, value.dsize);
ret = regval_ctr_numvals(values);
done: