summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-08-25 00:08:36 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:56 +0200
commitbbe78110194712b5ff06f1420ce628cb78c7e269 (patch)
tree34249cb160ea752eea0505ea8f5f84d895768c35 /source3/lib
parentbdee9458f66210a06eb29836a66e14d5d8a7fd33 (diff)
downloadsamba-bbe78110194712b5ff06f1420ce628cb78c7e269.tar.gz
samba-bbe78110194712b5ff06f1420ce628cb78c7e269.tar.bz2
samba-bbe78110194712b5ff06f1420ce628cb78c7e269.zip
s3:sessionid: convert to using dbwrap wrapper functions only
Avoid direct use of the db_record and db_context structs.
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/sessionid_tdb.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c
index 3ed6523cb9..6fd3bbc487 100644
--- a/source3/lib/sessionid_tdb.c
+++ b/source3/lib/sessionid_tdb.c
@@ -56,7 +56,7 @@ struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key)
if (db == NULL) {
return NULL;
}
- return db->fetch_locked(db, mem_ctx, string_term_tdb_data(key));
+ return dbwrap_fetch_locked(db, mem_ctx, string_term_tdb_data(key));
}
struct sessionid_traverse_state {
@@ -67,19 +67,23 @@ struct sessionid_traverse_state {
static int sessionid_traverse_fn(struct db_record *rec, void *private_data)
{
+ TDB_DATA key;
+ TDB_DATA value;
struct sessionid_traverse_state *state =
(struct sessionid_traverse_state *)private_data;
struct sessionid session;
- if ((rec->key.dptr[rec->key.dsize-1] != '\0')
- || (rec->value.dsize != sizeof(struct sessionid))) {
+ key = dbwrap_record_get_key(rec);
+ value = dbwrap_record_get_value(rec);
+ if ((key.dptr[key.dsize-1] != '\0')
+ || (value.dsize != sizeof(struct sessionid))) {
DEBUG(1, ("Found invalid record in sessionid.tdb\n"));
return 0;
}
- memcpy(&session, rec->value.dptr, sizeof(session));
+ memcpy(&session, value.dptr, sizeof(session));
- return state->fn(rec, (char *)rec->key.dptr, &session,
+ return state->fn(rec, (char *)key.dptr, &session,
state->private_data);
}
@@ -111,19 +115,24 @@ struct sessionid_traverse_read_state {
static int sessionid_traverse_read_fn(struct db_record *rec,
void *private_data)
{
+ TDB_DATA key;
+ TDB_DATA value;
struct sessionid_traverse_read_state *state =
(struct sessionid_traverse_read_state *)private_data;
struct sessionid session;
- if ((rec->key.dptr[rec->key.dsize-1] != '\0')
- || (rec->value.dsize != sizeof(struct sessionid))) {
+ key = dbwrap_record_get_key(rec);
+ value = dbwrap_record_get_value(rec);
+
+ if ((key.dptr[key.dsize-1] != '\0')
+ || (value.dsize != sizeof(struct sessionid))) {
DEBUG(1, ("Found invalid record in sessionid.tdb\n"));
return 0;
}
- memcpy(&session, rec->value.dptr, sizeof(session));
+ memcpy(&session, value.dptr, sizeof(session));
- return state->fn((char *)rec->key.dptr, &session,
+ return state->fn((char *)key.dptr, &session,
state->private_data);
}