[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed May 1 05:03:02 UTC 2019


The branch, master has been updated
       via  2a5bf72b00b s4:samdb: Make sure value is initialized with 0
       via  62ba14a41b6 lib:torture: Fix size type in torture macro
       via  c5e387d22a2 s4/replmd delete: optimise attribute preservation with binary search
       via  8488651bdd6 s4/replmd: delete checks flag before laborious search
       via  5ac626e7b05 smbd: Move deadtime default to parameter definition and man page
      from  2ee72cc6154 traffic: load dns query from file and write stats to file

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


- Log -----------------------------------------------------------------
commit 2a5bf72b00b61aa97afe9d1d87b8114177b91fef
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 30 16:23:17 2019 +0200

    s4:samdb: Make sure value is initialized with 0
    
    Found by csbuild.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed May  1 05:02:22 UTC 2019 on sn-devel-184

commit 62ba14a41b6fb590dce8df5d3d0c9796d4a85393
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 30 14:23:52 2019 +0200

    lib:torture: Fix size type in torture macro
    
    Found by csbuild.
    https://gitlab.com/samba-team/devel/samba/-/jobs/204481431
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c5e387d22a2117c5819fd94e1a1b077d37739842
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed May 1 10:41:41 2019 +1200

    s4/replmd delete: optimise attribute preservation with binary search
    
    When we get here it is very likely that the attribute will not be
    preserved, as the preserved ones should have had the flag set, but we
    still end up loking through the whole list to confirm. With a binary
    search, we end up looking at ~5 attributes to confirm.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8488651bdd6e36252bd2edde4683fd0c5c998fe2
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Wed May 1 10:35:46 2019 +1200

    s4/replmd: delete checks flag before laborious search
    
    Most (perhaps all) attributes that are in the "must not remove" list also
    have the PRESERVEONDELETE bit set, and checking bits is much cheaper
    than a linear search involving strcasecmp. If we check the bit first
    we save work.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5ac626e7b0565bf880d1b18a3b414bc67d8606df
Author: Christof Schmitt <cs at samba.org>
Date:   Mon Apr 29 11:01:44 2019 -0700

    smbd: Move deadtime default to parameter definition and man page
    
    The code has a default of one week (10080 minutes) if the parameter is
    set to 0. Make this the public default of the parameter, instead of
    hiding it in the code. This change also has the code match the
    documentation that setting this parameter to 0 disables the check.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 docs-xml/smbdotconf/tuning/deadtime.xml            |  2 +-
 lib/param/loadparm.c                               |  2 +
 lib/torture/torture.h                              |  8 ++--
 source3/include/local.h                            |  1 -
 source3/param/loadparm.c                           |  2 +-
 source3/smbd/conn_idle.c                           |  2 +-
 .../dsdb/samdb/ldb_modules/partition_metadata.c    |  2 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c    | 46 +++++++++++++++-------
 8 files changed, 42 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/tuning/deadtime.xml b/docs-xml/smbdotconf/tuning/deadtime.xml
index 7c60b90d097..77e0e5f9324 100644
--- a/docs-xml/smbdotconf/tuning/deadtime.xml
+++ b/docs-xml/smbdotconf/tuning/deadtime.xml
@@ -22,6 +22,6 @@
 		should be performed.</para>
 </description>
 
-<value type="default">0</value>
+<value type="default">10080</value>
 <value type="example">15</value>
 </samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index ebbccc22b71..e03c1556d7e 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2833,6 +2833,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
 	lpcfg_do_global_parameter(lp_ctx, "passdb backend", "tdbsam");
 
+	lpcfg_do_global_parameter(lp_ctx, "deadtime", "10080");
+
 	lpcfg_do_global_parameter(lp_ctx, "getwd cache", "True");
 
 	lpcfg_do_global_parameter(lp_ctx, "winbind nested groups", "True");
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index c0fbdb9081d..2921ae74b9b 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -406,7 +406,7 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 		char *__dump = NULL; \
 		uint8_t __byte_a = 0x00;\
 		uint8_t __byte_b = 0x00;\
-		int __i;\
+		size_t __i;\
 		for (__i=0; __i < __expected.length; __i++) {\
 			__byte_a = __expected.data[__i];\
 			if (__i == __got.length) {\
@@ -418,14 +418,14 @@ static inline void torture_dump_data_str_cb(const char *buf, void *private_data)
 				break;\
 			}\
 		}\
-		torture_warning(torture_ctx, "blobs differ at byte 0x%02X (%u)", __i, __i);\
+		torture_warning(torture_ctx, "blobs differ at byte 0x%02X (%zu)", (unsigned int)__i, __i);\
 		torture_warning(torture_ctx, "expected byte[0x%02X] = 0x%02X got byte[0x%02X] = 0x%02X",\
-				__i, __byte_a, __i, __byte_b);\
+				(unsigned int)__i, __byte_a, (unsigned int)__i, __byte_b);\
 		__dump = talloc_strdup(torture_ctx, ""); \
 		dump_data_cb(__got.data, __got.length, true, \
 			     torture_dump_data_str_cb, &__dump); \
 		torture_warning(torture_ctx, "got[0x%02X]: \n%s", \
-				(int)__got.length, __dump); \
+				(unsigned int)__got.length, __dump); \
 		TALLOC_FREE(__dump); \
 		__dump = talloc_strdup(torture_ctx, ""); \
 		dump_data_cb(__expected.data, __expected.length, true, \
diff --git a/source3/include/local.h b/source3/include/local.h
index c2be1ff3b7f..62700aace3c 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -96,7 +96,6 @@
 
 /* the following control timings of various actions. Don't change 
    them unless you know what you are doing. These are all in seconds */
-#define DEFAULT_SMBD_TIMEOUT (60*60*24*7)
 #define SMBD_RELOAD_CHECK (180)
 #define IDLE_CLOSED_TIMEOUT (60)
 #define DPTR_IDLE_TIMEOUT (120)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 703460e4c47..5af1621fb9b 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -641,7 +641,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 	Globals._disable_spoolss = false;
 	Globals.max_smbd_processes = 0;/* no limit specified */
 	Globals.username_level = 0;
-	Globals.deadtime = 0;
+	Globals.deadtime = 10080;
 	Globals.getwd_cache = true;
 	Globals.large_readwrite = true;
 	Globals.max_log_size = 5000;
diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c
index 238b7bd7690..920d808862a 100644
--- a/source3/smbd/conn_idle.c
+++ b/source3/smbd/conn_idle.c
@@ -53,7 +53,7 @@ bool conn_idle_all(struct smbd_server_connection *sconn, time_t t)
 	conn_lastused_update(sconn, t);
 
 	if (deadtime <= 0) {
-		deadtime = DEFAULT_SMBD_TIMEOUT;
+		return false;
 	}
 
 	for (conn=sconn->connections;conn;conn=conn->next) {
diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
index 250fecbd9e6..cf44c5d1218 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
@@ -153,7 +153,7 @@ int partition_metadata_inc_schema_sequence(struct ldb_module *module)
 {
 	struct partition_private_data *data;
 	int ret;
-	uint64_t value;
+	uint64_t value = 0;
 
 	data = talloc_get_type_abort(ldb_module_get_private(module),
 				    struct partition_private_data);
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 7440e9b50f1..d4ae1860fd1 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -50,6 +50,7 @@
 #include "lib/util/dlinklist.h"
 #include "dsdb/samdb/ldb_modules/util.h"
 #include "lib/util/tsort.h"
+#include "lib/util/binsearch.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS            DBGC_DRS_REPL
@@ -4160,50 +4161,61 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
 	TALLOC_CTX *tmp_ctx;
 	struct ldb_result *res, *parent_res;
 	static const char * const preserved_attrs[] = {
-		/* yes, this really is a hard coded list. See MS-ADTS
-		   section 3.1.1.5.5.1.1 */
+		/*
+		 * This list MUST be kept in case-insensitive sorted order,
+		 * as we  use it in a binary search with ldb_attr_cmp().
+		 *
+		 * We get this hard-coded list from
+		 * MS-ADTS section 3.1.1.5.5.1.1 "Tombstone Requirements".
+		 */
 		"attributeID",
 		"attributeSyntax",
+		"distinguishedName",
 		"dNReferenceUpdate",
 		"dNSHostName",
 		"flatName",
 		"governsID",
 		"groupType",
 		"instanceType",
-		"lDAPDisplayName",
-		"legacyExchangeDN",
 		"isDeleted",
 		"isRecycled",
 		"lastKnownParent",
+		"lDAPDisplayName",
+		"legacyExchangeDN",
+		"mS-DS-CreatorSID",
 		"msDS-LastKnownRDN",
 		"msDS-PortLDAP",
-		"mS-DS-CreatorSID",
 		"mSMQOwnerID",
+		"name",
 		"nCName",
+		"nTSecurityDescriptor",
 		"objectClass",
-		"distinguishedName",
 		"objectGUID",
 		"objectSid",
 		"oMSyntax",
 		"proxiedObjectName",
-		"name",
-		"nTSecurityDescriptor",
 		"replPropertyMetaData",
 		"sAMAccountName",
 		"securityIdentifier",
 		"sIDHistory",
 		"subClassOf",
 		"systemFlags",
-		"trustPartner",
+		"trustAttributes",
 		"trustDirection",
+		"trustPartner",
 		"trustType",
-		"trustAttributes",
 		"userAccountControl",
 		"uSNChanged",
 		"uSNCreated",
-		"whenCreated",
 		"whenChanged",
-		NULL
+		"whenCreated",
+		/*
+		 * DO NOT JUST APPEND TO THIS LIST.
+		 *
+		 * In case you missed the note at the top, this list is kept
+		 * in case-insensitive sorted order. In the unlikely event you
+		 * need to add an attrbute, please add it in the RIGHT PLACE.
+		 */
 	};
 	static const char * const all_attrs[] = {
 		DSDB_SECRET_ATTRIBUTES,
@@ -4612,10 +4624,16 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
 				dsdb_flags |= DSDB_REPLMD_VANISH_LINKS;
 
 			} else if (sa->linkID == 0) {
-				if (ldb_attr_in_list(preserved_attrs, el->name)) {
+				const char * const *attr = NULL;
+				if (sa->searchFlags & SEARCH_FLAG_PRESERVEONDELETE) {
 					continue;
 				}
-				if (sa->searchFlags & SEARCH_FLAG_PRESERVEONDELETE) {
+				BINARY_ARRAY_SEARCH_V(preserved_attrs,
+						      ARRAY_SIZE(preserved_attrs),
+						      el->name,
+						      ldb_attr_cmp,
+						      attr);
+				if (attr != NULL) {
 					continue;
 				}
 			} else {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list