mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
dbwrap: remove get_flags().
The flags returned were TDB-specific: this was only used for detecting the endianness of obsolete databases (the conversion code was put in in 2003, with reference to Samba 2.3). It's easier to remove it than to translate the NTDB flags to TDB flags, and it's a really weird thing to ask for anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fc9b298761
commit
1acf548eb7
@ -372,11 +372,6 @@ int dbwrap_get_seqnum(struct db_context *db)
|
||||
return db->get_seqnum(db);
|
||||
}
|
||||
|
||||
int dbwrap_get_flags(struct db_context *db)
|
||||
{
|
||||
return db->get_flags(db);
|
||||
}
|
||||
|
||||
int dbwrap_transaction_start(struct db_context *db)
|
||||
{
|
||||
return db->transaction_start(db);
|
||||
|
@ -70,7 +70,6 @@ NTSTATUS dbwrap_parse_record(struct db_context *db, TDB_DATA key,
|
||||
void *private_data);
|
||||
int dbwrap_wipe(struct db_context *db);
|
||||
int dbwrap_get_seqnum(struct db_context *db);
|
||||
int dbwrap_get_flags(struct db_context *db);
|
||||
int dbwrap_transaction_start(struct db_context *db);
|
||||
int dbwrap_transaction_commit(struct db_context *db);
|
||||
int dbwrap_transaction_cancel(struct db_context *db);
|
||||
|
@ -131,13 +131,6 @@ static int dbwrap_cache_get_seqnum(struct db_context *db)
|
||||
return dbwrap_get_seqnum(ctx->backing);
|
||||
}
|
||||
|
||||
static int dbwrap_cache_get_flags(struct db_context *db)
|
||||
{
|
||||
struct db_cache_ctx *ctx = talloc_get_type_abort(
|
||||
db->private_data, struct db_cache_ctx);
|
||||
return dbwrap_get_flags(ctx->backing);
|
||||
}
|
||||
|
||||
static int dbwrap_cache_transaction_start(struct db_context *db)
|
||||
{
|
||||
struct db_cache_ctx *ctx = talloc_get_type_abort(
|
||||
@ -210,7 +203,6 @@ struct db_context *db_open_cache(TALLOC_CTX *mem_ctx,
|
||||
db->traverse = dbwrap_cache_traverse;
|
||||
db->traverse_read = dbwrap_cache_traverse_read;
|
||||
db->get_seqnum = dbwrap_cache_get_seqnum;
|
||||
db->get_flags = dbwrap_cache_get_flags;
|
||||
db->transaction_start = dbwrap_cache_transaction_start;
|
||||
db->transaction_commit = dbwrap_cache_transaction_commit;
|
||||
db->transaction_cancel = dbwrap_cache_transaction_cancel;
|
||||
|
@ -47,7 +47,6 @@ struct db_context {
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
int (*get_seqnum)(struct db_context *db);
|
||||
int (*get_flags)(struct db_context *db);
|
||||
int (*transaction_start)(struct db_context *db);
|
||||
int (*transaction_commit)(struct db_context *db);
|
||||
int (*transaction_cancel)(struct db_context *db);
|
||||
|
@ -344,14 +344,6 @@ static int db_tdb_get_seqnum(struct db_context *db)
|
||||
return tdb_get_seqnum(db_ctx->wtdb->tdb);
|
||||
}
|
||||
|
||||
static int db_tdb_get_flags(struct db_context *db)
|
||||
|
||||
{
|
||||
struct db_tdb_ctx *db_ctx =
|
||||
talloc_get_type_abort(db->private_data, struct db_tdb_ctx);
|
||||
return tdb_get_flags(db_ctx->wtdb->tdb);
|
||||
}
|
||||
|
||||
static int db_tdb_transaction_start(struct db_context *db)
|
||||
{
|
||||
struct db_tdb_ctx *db_ctx =
|
||||
@ -428,7 +420,6 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
|
||||
result->traverse_read = db_tdb_traverse_read;
|
||||
result->parse_record = db_tdb_parse;
|
||||
result->get_seqnum = db_tdb_get_seqnum;
|
||||
result->get_flags = db_tdb_get_flags;
|
||||
result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
|
||||
result->transaction_start = db_tdb_transaction_start;
|
||||
result->transaction_commit = db_tdb_transaction_commit;
|
||||
|
@ -1486,13 +1486,6 @@ static int db_ctdb_get_seqnum(struct db_context *db)
|
||||
return tdb_get_seqnum(ctx->wtdb->tdb);
|
||||
}
|
||||
|
||||
static int db_ctdb_get_flags(struct db_context *db)
|
||||
{
|
||||
struct db_ctdb_ctx *ctx = talloc_get_type_abort(db->private_data,
|
||||
struct db_ctdb_ctx);
|
||||
return tdb_get_flags(ctx->wtdb->tdb);
|
||||
}
|
||||
|
||||
static void db_ctdb_id(struct db_context *db, const uint8_t **id,
|
||||
size_t *idlen)
|
||||
{
|
||||
@ -1608,7 +1601,6 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
|
||||
result->traverse = db_ctdb_traverse;
|
||||
result->traverse_read = db_ctdb_traverse_read;
|
||||
result->get_seqnum = db_ctdb_get_seqnum;
|
||||
result->get_flags = db_ctdb_get_flags;
|
||||
result->transaction_start = db_ctdb_transaction_start;
|
||||
result->transaction_commit = db_ctdb_transaction_commit;
|
||||
result->transaction_cancel = db_ctdb_transaction_cancel;
|
||||
|
@ -146,31 +146,16 @@ static int convert_fn(struct db_record *rec, void *private_data)
|
||||
static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
|
||||
{
|
||||
int32 vers;
|
||||
bool bigendianheader;
|
||||
struct convert_fn_state s;
|
||||
NTSTATUS status;
|
||||
|
||||
/* If we are bigendian, tdb is bigendian if NOT converted. */
|
||||
union {
|
||||
uint16 large;
|
||||
unsigned char small[2];
|
||||
} u;
|
||||
u.large = 0x0102;
|
||||
if (u.small[0] == 0x01)
|
||||
bigendianheader = !(dbwrap_get_flags(db) & TDB_CONVERT);
|
||||
else {
|
||||
assert(u.small[0] == 0x02);
|
||||
bigendianheader = (dbwrap_get_flags(db) & TDB_CONVERT);
|
||||
}
|
||||
DEBUG(0, ("Upgrading winbindd_idmap.tdb from an old version\n"));
|
||||
|
||||
status = dbwrap_fetch_int32_bystring(db, "IDMAP_VERSION", &vers);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
vers = -1;
|
||||
}
|
||||
|
||||
if (((vers == -1) && bigendianheader) || (IREV(vers) == IDMAP_VERSION)) {
|
||||
/* Arrggghh ! Bytereversed or old big-endian - make order independent ! */
|
||||
if (IREV(vers) == IDMAP_VERSION) {
|
||||
/* Arrggghh ! Bytereversed - make order independent ! */
|
||||
/*
|
||||
* high and low records were created on a
|
||||
* big endian machine and will need byte-reversing.
|
||||
|
Loading…
Reference in New Issue
Block a user