diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-03-26 21:24:17 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-03-27 18:14:56 +0100 |
commit | 2a95f3f874aa9943ebec57a89cff1a3f3b101637 (patch) | |
tree | e833eb9a64c79e7084af245bf75aa6b6e3cb94a7 | |
parent | d9de61341c1be341d18c23b17c74a854998f0a44 (diff) | |
download | samba-2a95f3f874aa9943ebec57a89cff1a3f3b101637.tar.gz samba-2a95f3f874aa9943ebec57a89cff1a3f3b101637.tar.bz2 samba-2a95f3f874aa9943ebec57a89cff1a3f3b101637.zip |
regdb: use dbwrap->fetch() instead of fetch_locked() for readonly access
metze
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(This used to be commit 4e2be189e97f653b75bd88135a631ce0f42db267)
-rw-r--r-- | source3/registry/reg_backend_db.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 52b4a83e87..8dfb59a43f 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -705,7 +705,7 @@ int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr) fstring subkeyname; int ret = -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")); @@ -721,16 +721,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) { + ret = regdb->fetch(regdb, frame, string_term_tdb_data(path), &value); + if (ret != 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)); @@ -840,8 +840,8 @@ 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; + TDB_DATA value; DEBUG(10,("regdb_fetch_values: Looking for value of key [%s] \n", key)); @@ -854,19 +854,20 @@ 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) { + ret = regdb->fetch(regdb, ctx, string_term_tdb_data(keystr), &value); + if (ret != 0) { + ret = 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: |