]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Correct handling of cache_groups option
authorNick Porter <nick@portercomputing.co.uk>
Mon, 8 Apr 2024 13:07:54 +0000 (14:07 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 8 Apr 2024 13:25:50 +0000 (14:25 +0100)
src/modules/rlm_sql/rlm_sql.c

index f3d86531a4e3aefaf5f118d7b1835bf5c35120f4..70377aa4e3443fbab9d0bc384dbf6320a921cd9f 100644 (file)
@@ -92,6 +92,7 @@ static const conf_parser_t module_config[] = {
        { FR_CONF_OFFSET("read_groups", rlm_sql_config_t, read_groups), .dflt = "yes" },
        { FR_CONF_OFFSET_FLAGS("sql_user_name", CONF_FLAG_XLAT, rlm_sql_config_t, query_user), .dflt = "" },
        { FR_CONF_OFFSET("group_attribute", rlm_sql_config_t, group_attribute) },
+       { FR_CONF_OFFSET("cache_groups", rlm_sql_config_t, cache_groups) },
        { FR_CONF_OFFSET_FLAGS("logfile", CONF_FLAG_XLAT, rlm_sql_config_t, logfile) },
        { FR_CONF_OFFSET("open_query", rlm_sql_config_t, connect_query) },
 
@@ -947,7 +948,7 @@ static int sql_check_groupmemb(rlm_sql_t const *inst, request_t *request, rlm_sq
                map_list_talloc_free(&check_tmp);
 
                if (inst->config.cache_groups) {
-                       MEM(pair_update_control(&vp, inst->group_da) >= 0);
+                       MEM(pair_append_control(&vp, inst->group_da) >= 0);
                        fr_pair_value_strdup(vp, group_name, true);
                        added = true;
                }
@@ -999,7 +1000,7 @@ static int sql_check_groupmemb(rlm_sql_t const *inst, request_t *request, rlm_sq
        }
 
        if (inst->config.cache_groups && !added) {
-               MEM(pair_update_control(&vp, inst->group_da) >= 0);
+               MEM(pair_append_control(&vp, inst->group_da) >= 0);
                fr_pair_value_strdup(vp, group_name, true);
        }