summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-08-17 10:20:46 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:56 +0200
commit6656de134612935ed12643064f307cb995cd5cbc (patch)
treea5e602f07df2c9e13d7d65feb71b08106ce4c541
parentc8924ecc41db8da01d2918c9b82abc2cfce4351f (diff)
downloadsamba-6656de134612935ed12643064f307cb995cd5cbc.tar.gz
samba-6656de134612935ed12643064f307cb995cd5cbc.tar.bz2
samba-6656de134612935ed12643064f307cb995cd5cbc.zip
s3:sessionid: use dbwrap_travers() in sessionid_traverse()
This also changes sessionid_traverse to NTSTATUS return type.
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/lib/sessionid_tdb.c14
2 files changed, 12 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ffc90ffd2c..7aa1b01baf 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1675,10 +1675,10 @@ void server_messaging_context_free(void);
struct sessionid;
bool sessionid_init(void);
struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
-int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
- struct sessionid *session,
- void *private_data),
- void *private_data);
+NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
+ struct sessionid *session,
+ void *private_data),
+ void *private_data);
int sessionid_traverse_read(int (*fn)(const char *key,
struct sessionid *session,
void *private_data),
diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c
index ebc1b8af79..231ff55489 100644
--- a/source3/lib/sessionid_tdb.c
+++ b/source3/lib/sessionid_tdb.c
@@ -83,21 +83,23 @@ static int sessionid_traverse_fn(struct db_record *rec, void *private_data)
state->private_data);
}
-int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
- struct sessionid *session,
- void *private_data),
- void *private_data)
+NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
+ struct sessionid *session,
+ void *private_data),
+ void *private_data)
{
struct db_context *db;
struct sessionid_traverse_state state;
+ NTSTATUS status;
db = session_db_ctx();
if (db == NULL) {
- return -1;
+ return NT_STATUS_UNSUCCESSFUL;
}
state.fn = fn;
state.private_data = private_data;
- return db->traverse(db, sessionid_traverse_fn, &state);
+ status = dbwrap_traverse(db, sessionid_traverse_fn, &state, NULL);
+ return status;
}
struct sessionid_traverse_read_state {