summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-04-01 09:16:41 -0700
committerJeremy Allison <jra@samba.org>2009-04-01 09:16:41 -0700
commiteaddcfef1ba553744ae9293feaf7585ec9aaa0db (patch)
tree1bfc22bf1e98b279ccf45af0ed065b9afd21fd98 /source3/passdb
parent1e742660bf3fed39b7efa2502d88ee6415522385 (diff)
parent264b28ec0962c355ee90f9ac67fcf07cd84c5c7b (diff)
downloadsamba-eaddcfef1ba553744ae9293feaf7585ec9aaa0db.tar.gz
samba-eaddcfef1ba553744ae9293feaf7585ec9aaa0db.tar.bz2
samba-eaddcfef1ba553744ae9293feaf7585ec9aaa0db.zip
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_tdb.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 1060733df4..6c49eb1dc2 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -250,6 +250,11 @@ static bool tdbsam_convert_backup(const char *dbname, struct db_context **pp_db)
smb_panic("tdbsam_convert_backup: orig commit failed\n");
}
+ /* be sure to close the DBs _before_ renaming the file */
+
+ TALLOC_FREE(orig_db);
+ TALLOC_FREE(tmp_db);
+
/* This is safe from other users as we know we're
* under a mutex here. */
@@ -262,13 +267,22 @@ static bool tdbsam_convert_backup(const char *dbname, struct db_context **pp_db)
}
TALLOC_FREE(frame);
- TALLOC_FREE(orig_db);
+
+ /* re-open the converted TDB */
+
+ orig_db = db_open(NULL, dbname, 0,
+ TDB_DEFAULT, O_CREAT|O_RDWR, 0600);
+ if (orig_db == NULL) {
+ DEBUG(0, ("tdbsam_convert_backup: Failed to re-open "
+ "converted passdb TDB [%s]\n", dbname));
+ return false;
+ }
DEBUG(1, ("tdbsam_convert_backup: updated %s file.\n",
dbname ));
/* Replace the global db pointer. */
- *pp_db = tmp_db;
+ *pp_db = orig_db;
return true;
cancel: