CVE-2022-0336: s4/dsdb/samldb: Don't return early when an SPN is re-added to an object
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 17 Jan 2022 23:02:45 +0000 (12:02 +1300)
committerJule Anger <janger@samba.org>
Sun, 30 Jan 2022 13:05:32 +0000 (14:05 +0100)
If an added SPN already exists on an object, we still want to check the
rest of the element values for conflicts.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14950

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
selftest/knownfail.d/ldap_spn
source4/dsdb/samdb/ldb_modules/samldb.c

index 16dafa91b665e6e838032dc933ec5ce6ebca7b75..63f9fe02ef7df4b0b9880b2ea23325df7e7954f2 100644 (file)
@@ -1,2 +1 @@
 samba.tests.ldap_spn.+LdapSpnTest.test_spn_dodgy_spns
-samba.tests.ldap_spn.+LdapSpnSambaOnlyTest.test_spn_add_a_conflict_along_with_a_re_added_SPN
index f0227411ccd2c03eb35ed7a8cf570a796eaf2758..a219446bba727345ef9c2552686e377af7097716 100644 (file)
@@ -4001,8 +4001,7 @@ static int samldb_spn_uniqueness_check(struct samldb_ctx *ac,
                                                 ac->msg->dn);
                if (ret == LDB_ERR_COMPARE_TRUE) {
                        DBG_INFO("SPN %s re-added to the same object\n", spn);
-                       talloc_free(tmp_ctx);
-                       return LDB_SUCCESS;
+                       continue;
                }
                if (ret != LDB_SUCCESS) {
                        DBG_ERR("SPN %s failed direct uniqueness check\n", spn);