[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Wed Jul 13 16:20:03 MDT 2011


The branch, master has been updated
       via  1838e16 Add intrasite code test switch
       via  c8413b3 Add kccsrv_add_repsFrom() possibility of NULL res argument
       via  4b19415 Remove static to allow availability to other KCC files
       via  f6c90df kcc_connection invocation_id added to struct
       via  4dea78d KCC NTDSConnection should utilize NTDSCONN_OPT_IS_GENERATED
       via  0d1c54e Standalone samdb_ntds_site_settings_options() helper
       via  b52246b NTDSConnection and NTDSA Site setting flags
      from  8612c6b dynconfig/wscript: use $libdir/security for PAMMODULESDIR as in config.m4

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1838e16f34544c824615481f618c89ed6e062013
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:39:05 2011 -0500

    Add intrasite code test switch
    
    kcc_service struct gets a intrasite_code
    boolean that is filled in via parametric parameter
    kccsrv:intrasite = [true/false] in smb.conf.   This
    will allow us to continue to utilize old simple
    KCC topology as continuing default while newer
    intra-site topology matures further.
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Thu Jul 14 00:19:12 CEST 2011 on sn-devel-104

commit c8413b3420d7401fe3b9588a7832d1e30e76a501
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:34:32 2011 -0500

    Add kccsrv_add_repsFrom() possibility of NULL res argument
    
    We need the ability to utilize this function in a different
    manner.  KCC intra-site topology has already vetted the
    replica as being appropriate to produce a repsFrom from.
    We do not want kccsrv_add_repsFrom() to produce further
    checking as was the case for simple topology.   Thus if
    we pass a NULL (res) parameter this extra check will
    be skipped.
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit 4b19415f5b5f5e6df5ca03ffa5fb0f8b212726ec
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:31:45 2011 -0500

    Remove static to allow availability to other KCC files
    
    kccsrv_replica_flags() and
    kccsrv_add_repsFrom() need to be available to functions
    outside kcc_periodic.c
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit f6c90dfebada626b92658cf54da4ce1d9a5277f4
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:26:07 2011 -0500

    kcc_connection invocation_id added to struct
    
    Utilized by KCC to carry the invocation id of the NTDSDSA
    that we are replicating the name context from.  Utilized
    when NTDSConnection is created (much like dsa_guid tracks
    the NTDSDSA objectGUID that we are replicating the name
    context from).
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit 4dea78d5084e0eed4b80dced087d71aa60b1fd3a
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:22:31 2011 -0500

    KCC NTDSConnection should utilize NTDSCONN_OPT_IS_GENERATED
    
    Previously this set an explicit (0x1) value whereas it
    can now utilize NTDSCONN_OPT_IS_GENERATED from flags.h
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit 0d1c54ecafc0f324b84ddd5cdf64db9f6108f517
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:19:54 2011 -0500

    Standalone samdb_ntds_site_settings_options() helper
    
    A helper function for retrieving the ntds site settings
    via standalone function call.  Used within KCC
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

commit b52246bf2f75e2a4869bce3e474e6c1c81a492b7
Author: Dave Craft <wimberosa at gmail.com>
Date:   Tue Jul 5 21:17:10 2011 -0500

    NTDSConnection and NTDSA Site setting flags
    
    Flags that were missing from flags.h or were incorrectly
    defined inline to the kcc_topology.c code (and thus unusable
    elsewhere).   These are the NTDSConnection and NTDSDSA Site
    settings flags.
    
    Signed-off-by: Andrew Tridgell <tridge at samba.org>

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

Summary of changes:
 libds/common/flags.h              |   20 +++++++++++++++
 source4/dsdb/common/util.c        |   48 +++++++++++++++++++++++++++++++++++++
 source4/dsdb/kcc/kcc_connection.c |   10 +++++++-
 source4/dsdb/kcc/kcc_connection.h |    1 +
 source4/dsdb/kcc/kcc_periodic.c   |   12 ++++----
 source4/dsdb/kcc/kcc_service.c    |    6 ++++
 source4/dsdb/kcc/kcc_service.h    |    3 ++
 source4/dsdb/kcc/kcc_topology.c   |    8 ------
 8 files changed, 93 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libds/common/flags.h b/libds/common/flags.h
index a3ed771..714251d 100644
--- a/libds/common/flags.h
+++ b/libds/common/flags.h
@@ -185,6 +185,18 @@
 #define DS_FLAG_ATTR_REQ_PARTIAL_SET_MEMBER 0x00000002
 #define DS_FLAG_ATTR_IS_CONSTRUCTED    0x00000004
 
+/* 7.1.1.2.2.1.1		nTDSSiteSettings Object options */
+#define DS_NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED			0x00000001
+#define DS_NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED			0x00000002
+#define DS_NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED			0x00000004
+#define DS_NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED		0x00000008
+#define DS_NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED 	0x00000010
+#define DS_NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED			0x00000020
+#define DS_NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR			0x00000040
+#define DS_NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED		0x00000100
+#define DS_NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED			0x00000200
+#define DS_NTDSSETTINGS_OPT_IS_REDUNDANT_SERVER_TOPOLOGY_ENABLED 	0x00000400
+
 /* 7.1.1.2.2.1.2.1.1           nTDSDSA Object options flags */
 #define DS_NTDSDSA_OPT_IS_GC                    0x00000001
 #define DS_NTDSDSA_OPT_DISABLE_INBOUND_REPL     0x00000002
@@ -240,3 +252,11 @@
 #define NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY        0x00000080
 #define NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY          0x00000100
 #define NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY       0x00000200
+
+#define NTDSCONN_OPT_IS_GENERATED			0x00000001
+#define NTDSCONN_OPT_TWOWAY_SYNC			0x00000002
+#define NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT		0x00000004
+#define NTDSCONN_OPT_USE_NOTIFY				0x00000008
+#define NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION	0x00000010
+#define NTDSCONN_OPT_USER_OWNED_SCHEDULE		0x00000020
+#define NTDSCONN_OPT_RODC_TOPOLOGY			0x00000040
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 3fa8f67..7283405 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2909,6 +2909,54 @@ failed:
 
 
 /*
+ * return NTDSSiteSettings options. See MS-ADTS 7.1.1.2.2.1.1
+ * flags are DS_NTDSSETTINGS_OPT_*
+ */
+int samdb_ntds_site_settings_options(struct ldb_context *ldb_ctx,
+					uint32_t *options)
+{
+	int rc;
+	TALLOC_CTX *tmp_ctx;
+	struct ldb_result *res;
+	struct ldb_dn *site_dn;
+	const char *attrs[] = { "options", NULL };
+
+	tmp_ctx = talloc_new(ldb_ctx);
+	if (tmp_ctx == NULL)
+		goto failed;
+
+        /* Retrieve the site dn for the ldb that we
+	 * have open.  This is our local site.
+         */
+        site_dn = samdb_server_site_dn(ldb_ctx, tmp_ctx);
+	if (site_dn == NULL)
+		goto failed;
+
+	/* Perform a one level (child) search from the local
+         * site distinguided name.   We're looking for the
+         * "options" attribute within the nTDSSiteSettings
+         * object
+	 */
+	rc = ldb_search(ldb_ctx, tmp_ctx, &res, site_dn,
+			LDB_SCOPE_ONELEVEL, attrs,
+                        "objectClass=nTDSSiteSettings");
+
+        if (rc != LDB_SUCCESS || res->count != 1)
+		goto failed;
+
+	*options = ldb_msg_find_attr_as_uint(res->msgs[0], "options", 0);
+
+	talloc_free(tmp_ctx);
+
+	return LDB_SUCCESS;
+
+failed:
+	DEBUG(1,("Failed to find our NTDS Site Settings options in ldb!\n"));
+	talloc_free(tmp_ctx);
+	return LDB_ERR_NO_SUCH_OBJECT;
+}
+
+/*
   return NTDS options flags. See MS-ADTS 7.1.1.2.2.1.2.1.1 
 
   flags are DS_NTDS_OPTION_*
diff --git a/source4/dsdb/kcc/kcc_connection.c b/source4/dsdb/kcc/kcc_connection.c
index 66cd415..1c4ebb1 100644
--- a/source4/dsdb/kcc/kcc_connection.c
+++ b/source4/dsdb/kcc/kcc_connection.c
@@ -80,7 +80,9 @@ static int kccsrv_add_connection(struct kccsrv_service *s,
 	ldb_msg_add_string(msg, "enabledConnection", "TRUE");
 	ldb_msg_add_linearized_dn(msg, "fromServer", server_dn);
 	/* ldb_msg_add_value(msg, "schedule", &schedule_val, NULL); */
-	samdb_msg_add_uint(s->samdb, msg, msg, "options", 1);
+
+	samdb_msg_add_uint(s->samdb, msg, msg,
+				"options", NTDSCONN_OPT_IS_GENERATED);
 
 	ret = ldb_add(s->samdb, msg);
 	if (ret == LDB_SUCCESS) {
@@ -132,6 +134,12 @@ void kccsrv_apply_connections(struct kccsrv_service *s,
 	unsigned int i, j, deleted = 0, added = 0;
 	int ret;
 
+	/* XXX
+	 *
+	 * This routine is not respecting connections that the
+	 * administrator can specifically create (NTDSCONN_OPT_IS_GENERATED
+	 * bit will not be set)
+	 */
 	for (i = 0; ntds_list && i < ntds_list->count; i++) {
 		struct kcc_connection *ntds = &ntds_list->servers[i];
 		for (j = 0; j < dsa_list->count; j++) {
diff --git a/source4/dsdb/kcc/kcc_connection.h b/source4/dsdb/kcc/kcc_connection.h
index 8dcd0b2..3bc635a 100644
--- a/source4/dsdb/kcc/kcc_connection.h
+++ b/source4/dsdb/kcc/kcc_connection.h
@@ -27,6 +27,7 @@
 struct kcc_connection {
 	struct GUID obj_guid;
 	struct GUID dsa_guid;
+	struct GUID invocation_id;
 	uint8_t schedule[84];
 };
 
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index 7f4f557..820aee3 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -164,7 +164,7 @@ static void kccsrv_notify_drepl_server_done(struct tevent_req *subreq)
 	TALLOC_FREE(state);
 }
 
-static uint32_t kccsrv_replica_flags(struct kccsrv_service *s)
+uint32_t kccsrv_replica_flags(struct kccsrv_service *s)
 {
 	if (s->am_rodc) {
 		return DRSUAPI_DRS_INIT_SYNC |
@@ -183,9 +183,9 @@ static uint32_t kccsrv_replica_flags(struct kccsrv_service *s)
 /*
  * add any missing repsFrom structures to our partitions
  */
-static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ctx,
-				    struct repsFromToBlob *reps, uint32_t count,
-				    struct ldb_result *res)
+NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ctx,
+			    struct repsFromToBlob *reps, uint32_t count,
+			    struct ldb_result *res)
 {
 	struct kccsrv_partition *p;
 	bool notify_dreplsrv = false;
@@ -226,7 +226,7 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct
 				/* we don't have the new one - add it
 				 * if it is a master
 				 */
-				if (!check_MasterNC(p, &reps[i], res)) {
+				if (res && !check_MasterNC(p, &reps[i], res)) {
 					/* its not a master, we don't
 					   want to pull from it */
 					continue;
@@ -246,7 +246,7 @@ static NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ct
 		/* remove any stale ones */
 		for (i=0; i<our_count; i++) {
 			if (!reps_in_list(&our_reps[i], reps, count) ||
-			    !check_MasterNC(p, &our_reps[i], res)) {
+			    (res && !check_MasterNC(p, &our_reps[i], res))) {
 				DEBUG(4,(__location__ ": Removed repsFrom for %s\n",
 					 our_reps[i].ctr.ctr1.other_info->dns_name));
 				memmove(&our_reps[i], &our_reps[i+1], (our_count-(i+1))*sizeof(our_reps[0]));
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index b2360d8..5f7b537 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -235,6 +235,12 @@ static void kccsrv_task_init(struct task_server *task)
 		return;
 	}
 
+	/* (kccsrv:intrasite=true) will run newer intrasite replication
+	 * topology code.
+	 */
+	service->intrasite_code = lpcfg_parm_bool(task->lp_ctx, NULL, "kccsrv",
+						"intrasite", false);
+
 	irpc_add_name(task->msg_ctx, "kccsrv");
 
 	IRPC_REGISTER(task->msg_ctx, drsuapi, DRSUAPI_DSEXECUTEKCC, kccsrv_execute_kcc, service);
diff --git a/source4/dsdb/kcc/kcc_service.h b/source4/dsdb/kcc/kcc_service.h
index f564885..1404a9a 100644
--- a/source4/dsdb/kcc/kcc_service.h
+++ b/source4/dsdb/kcc/kcc_service.h
@@ -82,6 +82,9 @@ struct kccsrv_service {
 	time_t last_deleted_check;
 
 	bool am_rodc;
+
+	/* run new intra-site topology code */
+	bool intrasite_code;
 };
 
 struct kcc_connection_list;
diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c
index 6cf3d41..9697ec1 100644
--- a/source4/dsdb/kcc/kcc_topology.c
+++ b/source4/dsdb/kcc/kcc_topology.c
@@ -29,14 +29,6 @@
 #define FLAG_CR_NTDS_NC 0x00000001
 #define FLAG_CR_NTDS_DOMAIN 0x00000002
 
-#define NTDSCONN_OPT_IS_GENERATED 0x00000001
-#define NTDSCONN_OPT_TWOWAY_SYNC 0x00000002
-#define NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT 0x00000004
-#define NTDSCONN_OPT_USE_NOTIFY 0x00000008
-#define NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION 0x00000010
-#define NTDSCONN_OPT_USER_OWNED_SCHEDULE 0x00000020
-#define NTDSCONN_OPT_RODC_TOPOLOGY 0x00000040
-
 #define NTDSDSA_OPT_IS_GC 0x00000001
 
 #define NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED 0x00000008


-- 
Samba Shared Repository


More information about the samba-cvs mailing list