1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

CVE-2020-25722 selftest: Ensure check for duplicate servicePrincipalNames is not bypassed for an add operation

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

If one of the objectClass checks passed, samldb_add() could return
through one of the samldb_fill_*() functions and skip the
servicePrincipalName uniqueness checking.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton 2021-11-02 21:00:00 +13:00 committed by Jule Anger
parent ae47a73077
commit 5f46343101
2 changed files with 12 additions and 15 deletions

View File

@ -1,2 +0,0 @@
^samba4.sam.python\(ad_dc_default\).__main__.SamTests.test_service_principal_name_uniqueness\(ad_dc_default\)
^samba4.sam.python\(fl2008r2dc\).__main__.SamTests.test_service_principal_name_uniqueness\(fl2008r2dc\)

View File

@ -4843,6 +4843,18 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req)
}
}
el = ldb_msg_find_element(ac->msg, "servicePrincipalName");
if ((el != NULL)) {
/*
* We need to check whether the SPN collides with an existing
* one (anywhere) including via aliases.
*/
ret = samldb_spn_uniqueness_check(ac, el);
if (ret != LDB_SUCCESS) {
return ret;
}
}
if (samdb_find_attribute(ldb, ac->msg,
"objectclass", "user") != NULL) {
ac->type = SAMLDB_TYPE_USER;
@ -4941,19 +4953,6 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req)
return samldb_fill_object(ac);
}
el = ldb_msg_find_element(ac->msg, "servicePrincipalName");
if ((el != NULL)) {
/*
* We need to check whether the SPN collides with an existing
* one (anywhere) including via aliases.
*/
ret = samldb_spn_uniqueness_check(ac, el);
if (ret != LDB_SUCCESS) {
return ret;
}
}
if (samdb_find_attribute(ldb, ac->msg,
"objectclass", "subnet") != NULL) {
ret = samldb_verify_subnet(ac, ac->msg->dn);