From f71842884589dea67c6d9b9455ec662994e37bca Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 17 Apr 2007 16:06:20 +0000 Subject: r22313: as discussed with simo: remove the only usage of backup_tdb() in samba3. As backup_tdb() will go completely soon. metze (This used to be commit 363d1d676c568e10bbcbe2b95e422067a4740161) --- source3/nsswitch/idmap_tdb.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'source3') diff --git a/source3/nsswitch/idmap_tdb.c b/source3/nsswitch/idmap_tdb.c index 6aff754946..73db1def0c 100644 --- a/source3/nsswitch/idmap_tdb.c +++ b/source3/nsswitch/idmap_tdb.c @@ -115,13 +115,15 @@ static int convert_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, void *state Convert the idmap database from an older version. *****************************************************************************/ -static BOOL idmap_tdb_convert(const char *idmap_name) +static BOOL idmap_tdb_upgrade(const char *idmap_name) { int32 vers; BOOL bigendianheader; BOOL failed = False; TDB_CONTEXT *idmap_tdb; + DEBUG(0, ("Upgrading winbindd_idmap.tdb from an old version\n")); + if (!(idmap_tdb = tdb_open_log(idmap_name, 0, TDB_DEFAULT, O_RDWR, 0600))) { @@ -189,32 +191,6 @@ static BOOL idmap_tdb_convert(const char *idmap_name) return True; } -/***************************************************************************** - Convert the idmap database from an older version if necessary -*****************************************************************************/ - -BOOL idmap_tdb_upgrade(TALLOC_CTX *ctx, const char *tdbfile) -{ - char *backup_name; - - DEBUG(0, ("Upgrading winbindd_idmap.tdb from an old version\n")); - - backup_name = talloc_asprintf(ctx, "%s.bak", tdbfile); - if ( ! backup_name) { - DEBUG(0, ("Out of memory!\n")); - return False; - } - - if (backup_tdb(tdbfile, backup_name, 0) != 0) { - DEBUG(0, ("Could not backup idmap database\n")); - talloc_free(backup_name); - return False; - } - - talloc_free(backup_name); - return idmap_tdb_convert(tdbfile); -} - /* WARNING: We can't open a tdb twice inthe same process, for that reason * I'm going to use a hack with open ref counts to open the winbindd_idmap.tdb * only once. We will later decide whether to split the db in multiple files @@ -282,7 +258,7 @@ static NTSTATUS idmap_tdb_open_db(TALLOC_CTX *memctx, TDB_CONTEXT **tdbctx) /* backup_tdb expects the tdb not to be open */ tdb_close(idmap_tdb_common_ctx); - if ( ! idmap_tdb_upgrade(ctx, tdbfile)) { + if ( ! idmap_tdb_upgrade(tdbfile)) { DEBUG(0, ("Unable to open idmap database, it's in an old formati, and upgrade failed!\n")); ret = NT_STATUS_INTERNAL_DB_ERROR; -- cgit