]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2018-1057: s4:dsdb/acl: remove unused else branches in acl_check_password_rights()
authorRalph Boehme <slow@samba.org>
Thu, 15 Feb 2018 16:38:31 +0000 (17:38 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 12 Mar 2018 09:05:43 +0000 (10:05 +0100)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13272

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/samdb/ldb_modules/acl.c

index edc6733c7abade0bde80c4cd6819b271b6e83fc6..c1655f9eebaa97e3d6de1bc643ab161b6f016c60 100644 (file)
@@ -1016,14 +1016,24 @@ static int acl_check_password_rights(TALLOC_CTX *mem_ctx,
                                               sid);
                goto checked;
        }
-       else if (rep_attr_cnt > 0 || (add_attr_cnt != del_attr_cnt)) {
+
+       if (rep_attr_cnt > 0) {
                ret = acl_check_extended_right(tmp_ctx, sd, acl_user_token(module),
                                               GUID_DRS_FORCE_CHANGE_PASSWORD,
                                               SEC_ADS_CONTROL_ACCESS,
                                               sid);
                goto checked;
        }
-       else if (add_attr_cnt == 1 && del_attr_cnt == 1) {
+
+       if (add_attr_cnt != del_attr_cnt) {
+               ret = acl_check_extended_right(tmp_ctx, sd, acl_user_token(module),
+                                              GUID_DRS_FORCE_CHANGE_PASSWORD,
+                                              SEC_ADS_CONTROL_ACCESS,
+                                              sid);
+               goto checked;
+       }
+
+       if (add_attr_cnt == 1 && del_attr_cnt == 1) {
                ret = acl_check_extended_right(tmp_ctx, sd, acl_user_token(module),
                                               GUID_DRS_USER_CHANGE_PASSWORD,
                                               SEC_ADS_CONTROL_ACCESS,