diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2022-06-21 15:22:47 +1200 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2022-07-24 11:41:53 +0200 |
commit | 0526d27e9eddd9c2a54434cf0dcdb136a6c659e4 (patch) | |
tree | 4b9fae988e89ab6539cd53a3039642dcebce1b9a | |
parent | 582ac171364f0c28f54eaf4f21b5bfa7569b5233 (diff) | |
download | samba-0526d27e9eddd9c2a54434cf0dcdb136a6c659e4.tar.gz |
CVE-2022-32746 s4/dsdb/acl: Fix LDB flags comparison
LDB_FLAG_MOD_* values are not actually flags, and the previous
comparison was equivalent to
(el->flags & LDB_FLAG_MOD_MASK) == 0
which is only true if none of the LDB_FLAG_MOD_* values are set, so we
would not successfully return if the element was a DELETE. Correct the
expression to what it was intended to be.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15009
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
-rw-r--r-- | selftest/knownfail.d/acl-spn-delete | 1 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/acl.c | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/selftest/knownfail.d/acl-spn-delete b/selftest/knownfail.d/acl-spn-delete deleted file mode 100644 index 32018413c49..00000000000 --- a/selftest/knownfail.d/acl-spn-delete +++ /dev/null @@ -1 +0,0 @@ -^samba4.ldap.acl.python.*__main__.AclSPNTests.test_delete_disallowed_spn\( diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c index 21e83276bfd..8016a2d4bd0 100644 --- a/source4/dsdb/samdb/ldb_modules/acl.c +++ b/source4/dsdb/samdb/ldb_modules/acl.c @@ -734,8 +734,9 @@ static int acl_check_spn(TALLOC_CTX *mem_ctx, * If not add or replace (eg delete), * return success */ - if ((el->flags - & (LDB_FLAG_MOD_ADD|LDB_FLAG_MOD_REPLACE)) == 0) { + if (LDB_FLAG_MOD_TYPE(el->flags) != LDB_FLAG_MOD_ADD && + LDB_FLAG_MOD_TYPE(el->flags) != LDB_FLAG_MOD_REPLACE) + { talloc_free(tmp_ctx); return LDB_SUCCESS; } |