[PATCH] Two smaller unrelated patches
Volker Lendecke
Volker.Lendecke at SerNet.DE
Thu Nov 15 16:29:46 UTC 2018
Hi!
Review appreciated!
Thanks, Volker
--
Besuchen Sie die verinice.XP 2019 in Berlin!
Anwenderkonferenz für Informationssicherheit
26.-28. Februar 2019 - im Hotel Radisson Blu
Info & Anmeldung hier: http://veriniceXP.org
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 8446040c9bd43c56e6f9a37facea9d4b4f31c2c2 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 14 Nov 2018 21:02:01 +0100
Subject: [PATCH 1/2] lib: Fix CID 1441264 Error handling issues
(CHECKED_RETURN)
This is not worth keeping a CID around :-)
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/lib/gencache.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index d7c3ad32921..d6ef28c140f 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -130,10 +130,16 @@ static int gencache_prune_expired_fn(struct tdb_context *tdb,
}
if (!ok || expired) {
- /*
- * Ignore failure, this is "just" background cleanup
- */
- strv_add(state->mem_ctx, &state->keys, (char *)key.dptr);
+ int ret;
+
+ ret = strv_add(state->mem_ctx, &state->keys, (char *)key.dptr);
+ if (ret != 0) {
+ /*
+ * Exit the loop. It's unlikely that it will
+ * succeed next time.
+ */
+ return -1;
+ }
}
return 0;
--
2.11.0
From 270d587e25606ec4ea8c009972c8bd3714087d9e Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 15 Nov 2018 10:40:50 +0100
Subject: [PATCH 2/2] dsdb: Slightly simplify samdb_check_password
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Avoid an "else" where we have the early return
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Björn Baumbach <bbaumbach at samba.org>
---
source4/dsdb/common/util.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index e7b860df1bc..7ce5168c6c7 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2153,17 +2153,16 @@ enum samr_ValidationStatus samdb_check_password(TALLOC_CTX *mem_ctx,
DEBUG(0, ("check_password_complexity: check password script took too long!\n"));
TALLOC_FREE(password_script);
return SAMR_VALIDATION_STATUS_PASSWORD_FILTER_ERROR;
- } else {
- DEBUG(5,("check_password_complexity: check password script (%s) "
- "returned [%d]\n", password_script, check_ret));
-
- if (check_ret != 0) {
- DEBUG(1,("check_password_complexity: "
- "check password script said new password is not good "
- "enough!\n"));
- TALLOC_FREE(password_script);
- return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH;
- }
+ }
+ DEBUG(5,("check_password_complexity: check password script (%s) "
+ "returned [%d]\n", password_script, check_ret));
+
+ if (check_ret != 0) {
+ DEBUG(1,("check_password_complexity: "
+ "check password script said new password is not good "
+ "enough!\n"));
+ TALLOC_FREE(password_script);
+ return SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH;
}
TALLOC_FREE(password_script);
--
2.11.0
More information about the samba-technical
mailing list