diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-17 16:06:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:25 -0500 |
commit | f71842884589dea67c6d9b9455ec662994e37bca (patch) | |
tree | 6d1901b3a2450348cd428cbdb423b6737dee4837 | |
parent | cacb371dbd982bcfb7f7f289f9aa6c15c6962db9 (diff) | |
download | samba-f71842884589dea67c6d9b9455ec662994e37bca.tar.gz samba-f71842884589dea67c6d9b9455ec662994e37bca.tar.bz2 samba-f71842884589dea67c6d9b9455ec662994e37bca.zip |
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)
-rw-r--r-- | source3/nsswitch/idmap_tdb.c | 32 |
1 files changed, 4 insertions, 28 deletions
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; |