Misc patches for review

Stefan Metzmacher metze at samba.org
Sun Jan 31 22:54:04 UTC 2016


Hi,

here're some random patches for master...

Please review and push:-)

Thanks!
metze
-------------- next part --------------
From 829137306bea212c72ff703bb6eea08a4d6b58f9 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sun, 31 Jan 2016 19:36:52 +0100
Subject: [PATCH 1/8] drsuapi.idl: add DRSUAPI_ATTID_objectGUID and
 DRSUAPI_ATTID_replPropertyMetaData

These might be usefull in future if we want to fast check
against dsdb_attribute->attributeID_id, instead of an expensive
ldb_attr_cmp(). They will never appear in replPropertyMetaData.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 librpc/idl/drsuapi.idl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/librpc/idl/drsuapi.idl b/librpc/idl/drsuapi.idl
index b78a865..4e1e11c 100644
--- a/librpc/idl/drsuapi.idl
+++ b/librpc/idl/drsuapi.idl
@@ -483,6 +483,8 @@ interface drsuapi
 		DRSUAPI_ATTID_auxiliaryClass			= 0x0002015f,
 		DRSUAPI_ATTID_lDAPDisplayName			= 0x000201cc,
 		DRSUAPI_ATTID_name				= 0x00090001,
+		DRSUAPI_ATTID_objectGUID			= 0x00090002,
+		DRSUAPI_ATTID_replPropertyMetaData		= 0x00090003,
 		DRSUAPI_ATTID_userAccountControl		= 0x00090008,
 		DRSUAPI_ATTID_badPwdCount			= 0x0009000c,
 		DRSUAPI_ATTID_codePage				= 0x00090010,
-- 
1.9.1


From 5840696b536a30805b44486c02dadb9a9c816ac0 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 28 Jan 2016 14:11:52 +0100
Subject: [PATCH 2/8] s4:dsdb/common: add some const to
 dsdb_dn_is_upgraded_link_val()

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source4/dsdb/common/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index c1b5d5a..b0c89b7 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3766,7 +3766,7 @@ bool dsdb_dn_is_deleted_val(const struct ldb_val *val)
   return true if a ldb_val containing a DN in storage form is
   in the upgraded w2k3 linked attribute format
  */
-bool dsdb_dn_is_upgraded_link_val(struct ldb_val *val)
+bool dsdb_dn_is_upgraded_link_val(const struct ldb_val *val)
 {
 	return memmem(val->data, val->length, "<RMD_VERSION=", 13) != NULL;
 }
-- 
1.9.1


From 12ae2fa01968f9857c61d0c86d7c8f1e69f011bd Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Tue, 12 Jan 2016 15:51:01 +0100
Subject: [PATCH 3/8] s4:dsdb/common: add dsdb_module_werror() helper function

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source4/dsdb/common/util.c | 11 +++++++++++
 source4/dsdb/common/util.h | 10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index b0c89b7..dd25987 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -4867,6 +4867,17 @@ bool is_attr_in_list(const char * const * attrs, const char *attr)
 	return false;
 }
 
+int dsdb_werror_at(struct ldb_context *ldb, int ldb_ecode, WERROR werr,
+		   const char *location, const char *func,
+		   const char *reason)
+{
+	if (reason == NULL) {
+		reason = win_errstr(werr);
+	}
+	ldb_asprintf_errstring(ldb, "%08X: %s at %s:%s",
+			       W_ERROR_V(werr), reason, location, func);
+	return ldb_ecode;
+}
 
 /*
   map an ldb error code to an approximate NTSTATUS code
diff --git a/source4/dsdb/common/util.h b/source4/dsdb/common/util.h
index dcf3fc4..1085073 100644
--- a/source4/dsdb/common/util.h
+++ b/source4/dsdb/common/util.h
@@ -69,4 +69,14 @@ struct GUID;
 char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
 NTSTATUS NS_GUID_from_string(const char *s, struct GUID *guid);
 
+struct ldb_context;
+
+int dsdb_werror_at(struct ldb_context *ldb, int ldb_ecode, WERROR werr,
+		   const char *location, const char *func,
+		   const char *reason);
+
+#define dsdb_module_werror(module, ldb_ecode, werr, reason) \
+	dsdb_werror_at(ldb_module_get_ctx(module), ldb_ecode, werr, \
+		       __location__, __func__, reason)
+
 #endif /* __DSDB_COMMON_UTIL_H__ */
-- 
1.9.1


From bc6ded0bc027cad58c87d60b6d62bd8ff865f776 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 14 Jan 2016 11:50:56 +0100
Subject: [PATCH 4/8] s4:dsdb/common: make it possible to find a reason for
 LDB_ERR_NO_SUCH_OBJECT

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source4/dsdb/common/util.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index dd25987..6807726 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1775,7 +1775,7 @@ int samdb_server_reference_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, stru
 
 	server_dn = samdb_server_dn(ldb, mem_ctx);
 	if (server_dn == NULL) {
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 
 	ret = samdb_reference_dn(ldb, mem_ctx, server_dn, "serverReference", dn);
@@ -2988,7 +2988,7 @@ int dsdb_find_guid_attr_by_dn(struct ldb_context *ldb,
 	}
 	if (res->count < 1) {
 		talloc_free(tmp_ctx);
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 	*guid = samdb_result_guid(res->msgs[0], attribute);
 	talloc_free(tmp_ctx);
@@ -3064,12 +3064,12 @@ int dsdb_find_sid_by_dn(struct ldb_context *ldb,
 	}
 	if (res->count < 1) {
 		talloc_free(tmp_ctx);
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 	s = samdb_result_dom_sid(tmp_ctx, res->msgs[0], "objectSid");
 	if (s == NULL) {
 		talloc_free(tmp_ctx);
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 	*sid = *s;
 	talloc_free(tmp_ctx);
@@ -3481,7 +3481,7 @@ int samdb_ntds_site_settings_options(struct ldb_context *ldb_ctx,
 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 ldb_error(ldb_ctx, LDB_ERR_NO_SUCH_OBJECT, __func__);
 }
 
 /*
@@ -3519,7 +3519,7 @@ int samdb_ntds_options(struct ldb_context *ldb, uint32_t *options)
 failed:
 	DEBUG(1,("Failed to find our own NTDS Settings options in the ldb!\n"));
 	talloc_free(tmp_ctx);
-	return LDB_ERR_NO_SUCH_OBJECT;
+	return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 }
 
 const char* samdb_ntds_object_category(TALLOC_CTX *tmp_ctx, struct ldb_context *ldb)
@@ -3897,7 +3897,7 @@ int dsdb_find_nc_root(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, struct ldb
        }
 
        talloc_free(tmp_ctx);
-       return LDB_ERR_NO_SUCH_OBJECT;
+       return ldb_error(samdb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 }
 
 
@@ -3930,7 +3930,7 @@ int dsdb_tombstone_lifetime(struct ldb_context *ldb, uint32_t *lifetime)
 	struct ldb_dn *dn;
 	dn = ldb_get_config_basedn(ldb);
 	if (!dn) {
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 	dn = ldb_dn_copy(ldb, dn);
 	if (!dn) {
@@ -4489,7 +4489,7 @@ int dsdb_search(struct ldb_context *ldb,
 		if (res->count == 0) {
 			talloc_free(tmp_ctx);
 			ldb_reset_err_string(ldb);
-			return LDB_ERR_NO_SUCH_OBJECT;
+			return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
 		}
 		if (res->count != 1) {
 			talloc_free(tmp_ctx);
-- 
1.9.1


From 2db7c3cde3e16788c10f2641ad85fc86f31b3691 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 14 Jan 2016 11:50:56 +0100
Subject: [PATCH 5/8] s4:dsdb/ldb_modules: make it possible to find a reason
 for LDB_ERR_NO_SUCH_OBJECT in util.c

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source4/dsdb/samdb/ldb_modules/util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 1455760..5f995de 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -177,8 +177,7 @@ int dsdb_module_search_tree(struct ldb_module *module,
 	if (dsdb_flags & DSDB_SEARCH_ONE_ONLY) {
 		if (res->count == 0) {
 			talloc_free(tmp_ctx);
-			ldb_reset_err_string(ldb_module_get_ctx(module));
-			return LDB_ERR_NO_SUCH_OBJECT;
+			return ldb_error(ldb_module_get_ctx(module), LDB_ERR_NO_SUCH_OBJECT, __func__);
 		}
 		if (res->count != 1) {
 			talloc_free(tmp_ctx);
@@ -279,7 +278,7 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
 	}
 	if (res->count == 0) {
 		talloc_free(tmp_ctx);
-		return LDB_ERR_NO_SUCH_OBJECT;
+		return ldb_error(ldb_module_get_ctx(module), LDB_ERR_NO_SUCH_OBJECT, __func__);
 	}
 	if (res->count != 1) {
 		ldb_asprintf_errstring(ldb_module_get_ctx(module), "More than one object found matching objectGUID %s\n",
-- 
1.9.1


From a2681fc8fbec1fc7c8f2be1a0b2c1331ed49bafc Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 22 Jan 2016 16:57:15 +0100
Subject: [PATCH 6/8] selftest: specify a maximum runtime for 'make testenv' of
 1 year

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 selftest/selftest.pl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index db5da05..0827376 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -415,7 +415,15 @@ my $testenv_default = "none";
 # must terminate in this time, and testenv will only stay alive this
 # long
 
-my $server_maxtime = 10800;
+my $server_maxtime;
+if ($opt_testenv) {
+    # 1 year should be enough :-)
+    $server_maxtime = 365 * 24 * 60 * 60;
+} else {
+    # make test should run under 3 hours
+    $server_maxtime = 3 * 60 * 60;
+}
+
 if (defined($ENV{SMBD_MAXTIME}) and $ENV{SMBD_MAXTIME} ne "") {
     $server_maxtime = $ENV{SMBD_MAXTIME};
 }
-- 
1.9.1


From 646280bf6dde8ca597a59b094a91d14f19b6d478 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 23 Jul 2015 12:17:02 +0200
Subject: [PATCH 7/8] s4:ldap_server: use LDAP_AUTH_METHOD_NOT_SUPPORTED define

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source4/ldap_server/ldap_bind.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c
index 69a6b61..fcbdadf 100644
--- a/source4/ldap_server/ldap_bind.c
+++ b/source4/ldap_server/ldap_bind.c
@@ -354,7 +354,7 @@ NTSTATUS ldapsrv_BindRequest(struct ldapsrv_call *call)
 	}
 
 	resp = &reply->msg->r.BindResponse;
-	resp->response.resultcode = 7;
+	resp->response.resultcode = LDAP_AUTH_METHOD_NOT_SUPPORTED;
 	resp->response.dn = NULL;
 	resp->response.errormessage = talloc_asprintf(reply, "Bad AuthenticationChoice [%d]", req->mechanism);
 	resp->response.referral = NULL;
-- 
1.9.1


From c7981ea1f756993d248e614b528173f11c163940 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Fri, 22 Jan 2016 10:00:25 +0100
Subject: [PATCH 8/8] s3:libads: we always have arcfour-hmac-md5 support

Signed-off-by: Stefan Metzmacher <metze at samba.org>
---
 source3/libads/ldap.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 1538500..2c52e32 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2229,10 +2229,6 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
 		goto done;
 	}
 
-#ifndef ENCTYPE_ARCFOUR_HMAC
-	acct_control |= UF_USE_DES_KEY_ONLY;
-#endif
-
 	if (!(controlstr = talloc_asprintf(ctx, "%u", acct_control))) {
 		goto done;
 	}
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160131/54b9fb2e/signature.sig>


More information about the samba-technical mailing list