summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-08-17 11:49:59 +0200
committerMichael Adam <obnox@samba.org>2011-10-11 14:17:57 +0200
commitc7c1a3e2768c83579069ba0c5667490307d541e0 (patch)
treec24eaeb75f271ab37e4faaa4bdb66e7a79e928ea /source3
parent3f214284c71a07b8153b9c94d97cd869872007c2 (diff)
downloadsamba-c7c1a3e2768c83579069ba0c5667490307d541e0.tar.gz
samba-c7c1a3e2768c83579069ba0c5667490307d541e0.tar.bz2
samba-c7c1a3e2768c83579069ba0c5667490307d541e0.zip
s3:printing: convert printer_list to use dbwrap wrapper functions
Avoid direct use of the db_record and db_context structs.
Diffstat (limited to 'source3')
-rw-r--r--source3/printing/printer_list.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/source3/printing/printer_list.c b/source3/printing/printer_list.c
index 61475fe539..4b76ca50f4 100644
--- a/source3/printing/printer_list.c
+++ b/source3/printing/printer_list.c
@@ -280,19 +280,16 @@ static NTSTATUS printer_list_traverse(printer_list_trv_fn_t *fn,
void *private_data)
{
struct db_context *db;
- int ret;
+ NTSTATUS status;
db = get_printer_list_db();
if (db == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- ret = db->traverse(db, fn, private_data);
- if (ret < 0) {
- return NT_STATUS_UNSUCCESSFUL;
- }
+ status = dbwrap_traverse(db, fn, private_data, NULL);
- return NT_STATUS_OK;
+ return status;
}
struct printer_list_clean_state {
@@ -310,14 +307,20 @@ static int printer_list_clean_fn(struct db_record *rec, void *private_data)
char *comment;
char *location;
int ret;
+ TDB_DATA key;
+ TDB_DATA value;
+
+ key = dbwrap_record_get_key(rec);
/* skip anything that does not contain PL_DATA_FORMAT data */
- if (strncmp((char *)rec->key.dptr,
+ if (strncmp((char *)key.dptr,
PL_KEY_PREFIX, sizeof(PL_KEY_PREFIX)-1)) {
return 0;
}
- ret = tdb_unpack(rec->value.dptr, rec->value.dsize,
+ value = dbwrap_record_get_value(rec);
+
+ ret = tdb_unpack(value.dptr, value.dsize,
PL_DATA_FORMAT, &time_h, &time_l, &name, &comment,
&location);
if (ret == -1) {
@@ -333,7 +336,7 @@ static int printer_list_clean_fn(struct db_record *rec, void *private_data)
refresh = (time_t)(((uint64_t)time_h << 32) + time_l);
if (refresh < state->last_refresh) {
- state->status = rec->delete_rec(rec);
+ state->status = dbwrap_record_delete(rec);
if (!NT_STATUS_IS_OK(state->status)) {
return -1;
}
@@ -378,13 +381,19 @@ static int printer_list_exec_fn(struct db_record *rec, void *private_data)
char *comment;
char *location;
int ret;
+ TDB_DATA key;
+ TDB_DATA value;
+
+ key = dbwrap_record_get_key(rec);
/* always skip PL_TIMESTAMP_KEY key */
- if (strequal((const char *)rec->key.dptr, PL_TIMESTAMP_KEY)) {
+ if (strequal((const char *)key.dptr, PL_TIMESTAMP_KEY)) {
return 0;
}
- ret = tdb_unpack(rec->value.dptr, rec->value.dsize,
+ value = dbwrap_record_get_value(rec);
+
+ ret = tdb_unpack(value.dptr, value.dsize,
PL_DATA_FORMAT, &time_h, &time_l, &name, &comment,
&location);
if (ret == -1) {