Skip to content

Commit

Permalink
Simpler checking for password attributes now all lists are nested
Browse files Browse the repository at this point in the history
Previous switch of search list was transitional when both nested and
flat lists were in place.
  • Loading branch information
ndptech committed Nov 5, 2024
1 parent bf19154 commit 2335ad4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/modules/rlm_ldap/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,14 @@ void rlm_ldap_check_reply(request_t *request, rlm_ldap_t const *inst, char const
*/
if ((inst->user.expect_password_is_set && !inst->user.expect_password) || !expect_password || !RDEBUG_ENABLED2) return;

parent = fr_pair_find_by_da_nested(&request->control_pairs, NULL, attr_password);
if (!parent) parent = request->control_ctx;

if (!fr_pair_find_by_da_nested(&parent->vp_group, NULL, attr_cleartext_password) &&
!fr_pair_find_by_da_nested(&parent->vp_group, NULL, attr_nt_password) &&
!fr_pair_find_by_da_nested(&parent->vp_group, NULL, attr_password_with_header) &&
!fr_pair_find_by_da_nested(&parent->vp_group, NULL, attr_crypt_password)) {
parent = fr_pair_find_by_da(&request->control_pairs, NULL, attr_password);
if (!parent) goto warnings;

if (!fr_pair_find_by_da(&parent->vp_group, NULL, attr_cleartext_password) &&
!fr_pair_find_by_da(&parent->vp_group, NULL, attr_nt_password) &&
!fr_pair_find_by_da(&parent->vp_group, NULL, attr_password_with_header) &&
!fr_pair_find_by_da(&parent->vp_group, NULL, attr_crypt_password)) {
warnings:
switch (ttrunk->directory->type) {
case FR_LDAP_DIRECTORY_ACTIVE_DIRECTORY:
RWDEBUG2("!!! Found map between LDAP attribute and a FreeRADIUS password attribute");
Expand Down

0 comments on commit 2335ad4

Please sign in to comment.