typedef struct rlm_sql_map_t {
char const *sql_instance_name; //!< Instance of SQL module to use,
//!< usually just 'sql'.
- rlm_sql_t *sql_inst;
+ bool multiple_rows; //!< Process all rows creating an attr[*] array
+
+ char const *query; //!< SQL query to retrieve current
- char const *query; //!< SQL query to retrieve current
+ rlm_sql_t *sql_inst;
CONF_SECTION *cs;
*/
static const CONF_PARSER module_config[] = {
{ "sql_module_instance", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_sql_map_t, sql_instance_name), NULL },
-
+ { "multiple_rows", FR_CONF_OFFSET(PW_TYPE_BOOLEAN, rlm_sql_map_t, multiple_rows), "no" },
{ "query", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_XLAT | PW_TYPE_REQUIRED, rlm_sql_map_t, query), NULL },
CONF_PARSER_TERMINATOR
ctx.row = (*handle)->row;
ctx.num_columns = (inst->sql_inst->module->sql_num_fields)(*handle, inst->sql_inst->config);
+ if (applied >= 1 && !inst->multiple_rows) {
+ RWDEBUG("Ignoring multiple rows. Enable the option 'multiple_rows' if you need multiple rows.");
+ break;
+ }
+
for (map = inst->user_map; map != NULL; map = map->next) {
/*
* If something bad happened, just skip, this is probably
return -1; /* Fail */
}
}
+
+ applied++;
}
return applied;