Skip to content

Commit

Permalink
re-add User-Profile behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 31, 2023
1 parent b0f9a59 commit 1bca847
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/modules/rlm_sql/rlm_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ fr_dict_autoload_t rlm_sql_dict[] = {

static fr_dict_attr_t const *attr_fall_through;
static fr_dict_attr_t const *attr_sql_user_name;
static fr_dict_attr_t const *attr_user_profile;
static fr_dict_attr_t const *attr_user_name;
static fr_dict_attr_t const *attr_expr_bool_enum;

extern fr_dict_attr_autoload_t rlm_sql_dict_attr[];
fr_dict_attr_autoload_t rlm_sql_dict_attr[] = {
{ .out = &attr_fall_through, .name = "Fall-Through", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ .out = &attr_sql_user_name, .name = "SQL-User-Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_user_profile, .name = "User-Profile", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
{ .out = &attr_expr_bool_enum, .name = "Expr-Bool-Enum", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ NULL }
Expand Down Expand Up @@ -1013,6 +1015,7 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
rlm_rcode_t rcode = RLM_MODULE_NOOP;
rlm_sql_grouplist_t *head = NULL, *entry = NULL;
int rows;
fr_pair_t *vp;

fr_assert(request->packet != NULL);

Expand Down Expand Up @@ -1055,6 +1058,20 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
if (*do_fall_through != FALL_THROUGH_YES) break;
}

/*
* Apply user profiles
*/
for (vp = fr_pair_find_by_da(&request->control_pairs, NULL, attr_user_profile);
vp != NULL;
vp = fr_pair_find_by_da(&request->control_pairs, vp, attr_user_profile)) {
if (sql_check_groupmemb(inst, request, handle, entry->name, do_fall_through, &rcode) < 0) {
rcode = RLM_MODULE_FAIL;
goto finish;
}

if (*do_fall_through != FALL_THROUGH_YES) break;
}

finish:
talloc_free(head);
pair_delete_request(inst->group_da);
Expand Down

0 comments on commit 1bca847

Please sign in to comment.