goto finish;
}
- fr_cursor_init(&cursor, &check_tmp);
- rows = sql_getvpdata(request->control_ctx, inst, request, handle, &cursor, expanded);
+ rows = sql_getvpdata(request->control_ctx, inst, request, handle, &check_tmp, expanded);
TALLOC_FREE(expanded);
if (rows < 0) {
REDEBUG("Error retrieving check pairs for group %s", entry->name);
}
if (inst->config->authorize_group_reply_query) {
- fr_cursor_t cursor;
/*
* Now get the reply pairs since the paircmp matched
goto finish;
}
- fr_cursor_init(&cursor, &reply_tmp);
- rows = sql_getvpdata(request->reply_ctx, inst, request, handle, &cursor, expanded);
+ rows = sql_getvpdata(request->reply_ctx, inst, request, handle, &reply_tmp, expanded);
TALLOC_FREE(expanded);
if (rows < 0) {
REDEBUG("Error retrieving reply pairs for group %s", entry->name);
* Query the check table to find any conditions associated with this user/realm/whatever...
*/
if (inst->config->authorize_check_query) {
- fr_cursor_t cursor;
fr_pair_t *vp;
if (xlat_aeval(request, &expanded, request, inst->config->authorize_check_query,
RETURN_MODULE_RCODE(rcode);
}
- fr_cursor_init(&cursor, &check_tmp);
- rows = sql_getvpdata(request->control_ctx, inst, request, &handle, &cursor, expanded);
+ rows = sql_getvpdata(request->control_ctx, inst, request, &handle, &check_tmp, expanded);
TALLOC_FREE(expanded);
if (rows < 0) {
REDEBUG("Failed getting check attributes");
}
if (inst->config->authorize_reply_query) {
- fr_cursor_t cursor;
/*
* Now get the reply pairs since the paircmp matched
goto error;
}
- fr_cursor_init(&cursor, &reply_tmp);
- rows = sql_getvpdata(request->reply_ctx, inst, request, &handle, &cursor, expanded);
+ rows = sql_getvpdata(request->reply_ctx, inst, request, &handle, &reply_tmp, expanded);
TALLOC_FREE(expanded);
if (rows < 0) {
REDEBUG("SQL query error getting reply attributes");
};
void *sql_mod_conn_create(TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout);
-int sql_pair_list_afrom_str(TALLOC_CTX *ctx, request_t *request, fr_cursor_t *cursor, rlm_sql_row_t row);
+int sql_pair_list_afrom_str(TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *out, rlm_sql_row_t row);
int sql_read_realms(rlm_sql_handle_t *handle);
-int sql_getvpdata(TALLOC_CTX *ctx, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, fr_cursor_t *cursor, char const *query);
+int sql_getvpdata(TALLOC_CTX *ctx, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, fr_pair_list_t *out, char const *query);
int sql_dict_init(rlm_sql_handle_t *handle);
void rlm_sql_query_log(rlm_sql_t const *inst, request_t *request, sql_acct_section_t *section, char const *query) CC_HINT(nonnull (1, 2, 4));
sql_rcode_t rlm_sql_select_query(rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle, char const *query) CC_HINT(nonnull (1, 3, 4));
* Purpose: Read entries from the database and fill fr_pair_t structures
*
*************************************************************************/
-int sql_pair_list_afrom_str(TALLOC_CTX *ctx, request_t *request, fr_cursor_t *cursor, rlm_sql_row_t row)
+int sql_pair_list_afrom_str(TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *out, rlm_sql_row_t row)
{
fr_pair_t *vp;
char const *ptr, *value;
/*
* Add the pair into the packet
*/
- fr_cursor_append(cursor, vp);
+ fr_pair_add(out, vp);
return 0;
}
*
*************************************************************************/
int sql_getvpdata(TALLOC_CTX *ctx, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t **handle,
- fr_cursor_t *cursor, char const *query)
+ fr_pair_list_t *out, char const *query)
{
rlm_sql_row_t row;
int rows = 0;
if (rcode != RLM_SQL_OK) return -1; /* error handled by rlm_sql_select_query */
while (rlm_sql_fetch_row(&row, inst, request, handle) == RLM_SQL_OK) {
- if (sql_pair_list_afrom_str(ctx, request, cursor, row) != 0) {
+ if (sql_pair_list_afrom_str(ctx, request, out, row) != 0) {
REDEBUG("Error parsing user data from database result");
(inst->driver->sql_finish_select_query)(*handle, inst->config);