]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
pap: Hoist &control:User-Password check so that it can be found (#4866)
authorTerry Burton <tez@terryburton.co.uk>
Thu, 26 Jan 2023 14:05:46 +0000 (14:05 +0000)
committerGitHub <noreply@github.com>
Thu, 26 Jan 2023 14:05:46 +0000 (09:05 -0500)
Since loop is rooted at &Password.

src/lib/server/password.c

index 3ca87943e14ede4d4b35af383269c08d18cb12df..5a33cc4b7fc5d43bad7e6c8a4d8c46c71a83f16b 100644 (file)
@@ -964,6 +964,15 @@ fr_pair_t *password_find(bool *ephemeral, TALLOC_CTX *ctx, request_t *request,
        fr_dcursor_t    cursor;
        fr_pair_t       *known_good;
 
+       if (fr_pair_find_by_da(&request->control_pairs, NULL, attr_user) != NULL) {
+               RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+               RWDEBUG("!!! Ignoring control.User-Password.  Update your        !!!");
+               RWDEBUG("!!! configuration so that the \"known good\" clear text   !!!");
+               RWDEBUG("!!! password is in Password.Cleartext and NOT in        !!!");
+               RWDEBUG("!!! User-Password.                                      !!!");
+               RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+       }
+
        for (known_good = fr_pair_dcursor_by_ancestor_init(&cursor, &request->control_pairs, attr_root);
             known_good;
             known_good = fr_dcursor_next(&cursor)) {
@@ -971,16 +980,6 @@ fr_pair_t *password_find(bool *ephemeral, TALLOC_CTX *ctx, request_t *request,
                fr_pair_t               *out;
                size_t                  i;
 
-               if (known_good->da == attr_user) {
-                       RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-                       RWDEBUG("!!! Ignoring control.User-Password.  Update your        !!!");
-                       RWDEBUG("!!! configuration so that the \"known good\" clear text !!!");
-                       RWDEBUG("!!! password is in Password.Cleartext and NOT in        !!!");
-                       RWDEBUG("!!! User-Password.                                      !!!");
-                       RWDEBUG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-                       continue;
-               }
-
                if (known_good->da->attr >= NUM_ELEMENTS(password_info)) continue;
 
                info = &password_info[known_good->da->attr];