diff options
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r-- | source3/lib/dbwrap/dbwrap.c | 21 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_ctdb.c | 1 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_private.h | 2 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_rbt.c | 24 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_tdb.c | 65 |
5 files changed, 0 insertions, 113 deletions
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c index 4df2474ea1..336f60cf75 100644 --- a/source3/lib/dbwrap/dbwrap.c +++ b/source3/lib/dbwrap/dbwrap.c @@ -25,27 +25,6 @@ #include "util_tdb.h" /* - * Fall back using fetch_locked if no genuine fetch operation is provided - */ - -static NTSTATUS dbwrap_fallback_fetch(struct db_context *db, - TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data) -{ - struct db_record *rec; - - rec = dbwrap_fetch_locked(db, mem_ctx, key); - if (rec == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } - - data->dsize = rec->value.dsize; - data->dptr = talloc_move(mem_ctx, &rec->value.dptr); - TALLOC_FREE(rec); - return NT_STATUS_OK; -} - -/* * Fall back using fetch if no genuine exists operation is provided */ diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 6246829400..0acaf67a31 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1508,7 +1508,6 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, result->private_data = (void *)db_ctdb; result->fetch_locked = db_ctdb_fetch_locked; - result->fetch = db_ctdb_fetch; result->parse_record = db_ctdb_parse_record; result->traverse = db_ctdb_traverse; result->traverse_read = db_ctdb_traverse_read; diff --git a/source3/lib/dbwrap/dbwrap_private.h b/source3/lib/dbwrap/dbwrap_private.h index a814cf61ba..4806618543 100644 --- a/source3/lib/dbwrap/dbwrap_private.h +++ b/source3/lib/dbwrap/dbwrap_private.h @@ -34,8 +34,6 @@ struct db_context { struct db_record *(*fetch_locked)(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key); - NTSTATUS (*fetch)(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data); int (*traverse)(struct db_context *db, int (*f)(struct db_record *rec, void *private_data), diff --git a/source3/lib/dbwrap/dbwrap_rbt.c b/source3/lib/dbwrap/dbwrap_rbt.c index 09bc210f9e..2460418d1d 100644 --- a/source3/lib/dbwrap/dbwrap_rbt.c +++ b/source3/lib/dbwrap/dbwrap_rbt.c @@ -345,29 +345,6 @@ static NTSTATUS db_rbt_parse_record(struct db_context *db, TDB_DATA key, return NT_STATUS_OK; } -static NTSTATUS db_rbt_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data) -{ - uint8_t *result; - struct db_rbt_search_result res; - - bool found = db_rbt_search_internal(db, key, &res); - - if (!found) { - *data = tdb_null; - return NT_STATUS_NOT_FOUND; - } - - result = (uint8_t*)talloc_memdup(mem_ctx, res.val.dptr, res.val.dsize); - if (result == NULL) { - return NT_STATUS_NO_MEMORY; - } - - data->dptr = result; - data->dsize = res.val.dsize; - return NT_STATUS_OK; -} - static int db_rbt_traverse_internal(struct rb_node *n, int (*f)(struct db_record *db, void *private_data), @@ -449,7 +426,6 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx) } result->fetch_locked = db_rbt_fetch_locked; - result->fetch = db_rbt_fetch; result->traverse = db_rbt_traverse; result->traverse_read = db_rbt_traverse; result->get_seqnum = db_rbt_get_seqnum; diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index efdb5dbee4..d38c377e88 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -140,70 +140,6 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db, return state.result; } -struct tdb_fetch_state { - TALLOC_CTX *mem_ctx; - NTSTATUS result; - TDB_DATA data; -}; - -static int db_tdb_fetch_parse(TDB_DATA key, TDB_DATA data, - void *private_data) -{ - struct tdb_fetch_state *state = - (struct tdb_fetch_state *)private_data; - - if (data.dptr == NULL) { - /* should not happen */ - state->result = NT_STATUS_INTERNAL_DB_ERROR; - return -1; - } - - state->data.dptr = (uint8 *)talloc_memdup(state->mem_ctx, data.dptr, - data.dsize); - if (state->data.dptr == NULL) { - state->result = NT_STATUS_NO_MEMORY; - return -1; - } - - state->data.dsize = data.dsize; - return 0; -} - -static NTSTATUS db_tdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *pdata) -{ - struct db_tdb_ctx *ctx = talloc_get_type_abort( - db->private_data, struct db_tdb_ctx); - - struct tdb_fetch_state state; - int ret; - - state.mem_ctx = mem_ctx; - state.result = NT_STATUS_OK; - state.data = tdb_null; - - ret = tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetch_parse, &state); - - if (ret != 0) { - NTSTATUS status; - - if (!NT_STATUS_IS_OK(state.result)) { - /* the parser has set an error code. return it */ - return state.result; - } - - status = map_nt_error_from_tdb(tdb_error(ctx->wtdb->tdb)); - return status; - } - - if (!NT_STATUS_IS_OK(state.result)) { - return state.result; - } - - *pdata = state.data; - return NT_STATUS_OK; -} - static int db_tdb_exists(struct db_context *db, TDB_DATA key) { struct db_tdb_ctx *ctx = talloc_get_type_abort( @@ -431,7 +367,6 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, } result->fetch_locked = db_tdb_fetch_locked; - result->fetch = db_tdb_fetch; result->traverse = db_tdb_traverse; result->traverse_read = db_tdb_traverse_read; result->parse_record = db_tdb_parse; |