From ef7f582772a6c621205fd16a8a7f2b826b7397d7 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Mon, 1 Nov 2021 17:21:16 +1300
Subject: [PATCH 138/266] CVE-2020-25722 Check for all errors from
 acl_check_extended_right() in acl_check_spn()

We should not fail open on error.

BUG:  https://bugzilla.samba.org/show_bug.cgi?id=14876
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>

Conflict:NA
Reference:https://gitlab.com/samba-team/samba/-/commit/ef7f582772a6c621205fd16a8a7f2b826b7397d7

---
 source4/dsdb/samdb/ldb_modules/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c
index d0b3da4d9e8..712724909e3 100644
--- a/source4/dsdb/samdb/ldb_modules/acl.c
+++ b/source4/dsdb/samdb/ldb_modules/acl.c
@@ -712,7 +712,7 @@ static int acl_check_spn(TALLOC_CTX *mem_ctx,
 				       SEC_ADS_SELF_WRITE,
 				       sid);
 
-	if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
+	if (ret != LDB_SUCCESS) {
 		dsdb_acl_debug(sd, acl_user_token(module),
 			       req->op.mod.message->dn,
 			       true,
-- 
2.23.0

