[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5175-g58d3ec1

Jeremy Allison jra at samba.org
Fri Mar 27 19:11:57 GMT 2009


The branch, v3-3-test has been updated
       via  58d3ec1cb81d6086d65cd12acd16cd591cf0c71f (commit)
      from  81d7d62c339c836ddd7053b5b3624ba36a2c0174 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 58d3ec1cb81d6086d65cd12acd16cd591cf0c71f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 27 12:11:24 2009 -0700

    Fix bug #6195 - Migrating from 3.0.x to 3.3.x can fail to update passdb.tdb correctly. For the clustering case.
    Clustered setups should have only ever used
    the unsigned version of TDB_DATA in the
    first place so they can't be in this mess :-).
    Just do the normal upgrade in the clustered case.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/include/dbwrap.h |    2 ++
 source/lib/dbwrap.c     |   27 +++++++++++++++++++++++++++
 source/passdb/pdb_tdb.c |    3 ++-
 3 files changed, 31 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/dbwrap.h b/source/include/dbwrap.h
index 3381d2d..2208d6e 100644
--- a/source/include/dbwrap.h
+++ b/source/include/dbwrap.h
@@ -53,6 +53,8 @@ struct db_context {
 	bool persistent;
 };
 
+bool db_is_local(const char *name);
+
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
 			   const char *name,
 			   int hash_size, int tdb_flags,
diff --git a/source/lib/dbwrap.c b/source/lib/dbwrap.c
index 055f554..126b5c1 100644
--- a/source/lib/dbwrap.c
+++ b/source/lib/dbwrap.c
@@ -65,6 +65,33 @@ static int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
 	return res;
 }
 
+bool db_is_local(const char *name)
+{
+#ifdef CLUSTER_SUPPORT
+	const char *sockname = lp_ctdbd_socket();
+
+	if(!sockname || !*sockname) {
+		sockname = CTDB_PATH;
+	}
+
+	if (lp_clustering() && socket_exist(sockname)) {
+		const char *partname;
+		/* ctdb only wants the file part of the name */
+		partname = strrchr(name, '/');
+		if (partname) {
+			partname++;
+		} else {
+			partname = name;
+		}
+		/* allow ctdb for individual databases to be disabled */
+		if (lp_parm_bool(-1, "ctdb", partname, True)) {
+			return false;
+		}
+	}
+#endif
+	return true;
+}
+
 /**
  * open a database
  */
diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index de49ed2..647b3fa 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/passdb/pdb_tdb.c
@@ -322,7 +322,8 @@ static bool tdbsam_convert(struct db_context **pp_db, const char *name, int32 fr
 	struct db_context *db = NULL;
 	int ret;
 
-	if (!tdbsam_convert_backup(name, pp_db)) {
+	/* We only need the update backup for local db's. */
+	if (db_is_local(name) && !tdbsam_convert_backup(name, pp_db)) {
 		DEBUG(0, ("tdbsam_convert: Could not backup %s\n", name));
 		return false;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list