thread->trunk, arg->vb_strvalue, SQL_QUERY_SELECT));
unlang_xlat_yield(request, sql_xlat_select_resume, NULL, 0, query_ctx);
- if (unlang_function_push(NULL, request, inst->select, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx) != UNLANG_ACTION_PUSHED_CHILD) return XLAT_ACTION_FAIL;
+
+ if (unlang_function_push(/* discard, sql_xlat_select_resume just uses query_ctx->rcode */ NULL,
+ request,
+ inst->select,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME, query_ctx) == UNLANG_ACTION_FAIL) return XLAT_ACTION_FAIL;
return XLAT_ACTION_PUSH_UNLANG;
}
thread->trunk, arg->vb_strvalue, SQL_QUERY_SELECT));
unlang_xlat_yield(request, sql_xlat_select_resume, NULL, 0, query_ctx);
- if (unlang_function_push(NULL, request, inst->select, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx) != UNLANG_ACTION_PUSHED_CHILD) return XLAT_ACTION_FAIL;
+ if (unlang_function_push(/* discard, sql_xlat_select_resume just uses query_ctx->rcode */NULL,
+ request,
+ inst->select,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME, query_ctx) != UNLANG_ACTION_PUSHED_CHILD) return XLAT_ACTION_FAIL;
return XLAT_ACTION_PUSH_UNLANG;
}
thread->trunk, query_head->vb_strvalue, SQL_QUERY_SELECT);
if (unlang_map_yield(request, mod_map_resume, NULL, 0, query_ctx) != UNLANG_ACTION_YIELD) RETURN_UNLANG_FAIL;
- return unlang_function_push(NULL, request, inst->select, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx);
+ return unlang_function_push(/* discard, mod_map_resume just uses query_ctx->rcode */ NULL,
+ request,
+ inst->select,
+ NULL,
+ NULL,
+ 0, UNLANG_SUB_FRAME,
+ query_ctx);
}
/** xlat escape function for drivers which do not provide their own
RETURN_UNLANG_OK;
}
-static unlang_action_t sql_get_grouplist(sql_group_ctx_t *group_ctx, trunk_t *trunk, request_t *request)
+static unlang_action_t sql_get_grouplist(unlang_result_t *p_result, sql_group_ctx_t *group_ctx, trunk_t *trunk, request_t *request)
{
rlm_sql_t const *inst = group_ctx->inst;
MEM(group_ctx->query_ctx = fr_sql_query_alloc(group_ctx, inst, request, trunk,
group_ctx->query->vb_strvalue, SQL_QUERY_SELECT));
- if (unlang_function_push(NULL, request, NULL, sql_get_grouplist_resume, NULL, 0, UNLANG_SUB_FRAME, group_ctx) < 0) return UNLANG_ACTION_FAIL;
- return unlang_function_push(NULL, request, inst->select, NULL, NULL, 0, UNLANG_SUB_FRAME, group_ctx->query_ctx);
+ if (unlang_function_push(/* sql_get_grouplist_resume translates the query_ctx->rocde into a module rcode */p_result,
+ request,
+ NULL,
+ sql_get_grouplist_resume,
+ NULL,
+ 0, UNLANG_SUB_FRAME,
+ group_ctx) < 0) return UNLANG_ACTION_FAIL;
+
+ return unlang_function_push(/* discard, sql_get_grouplist_resume translates rcodes */NULL,
+ request,
+ inst->select,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME, group_ctx->query_ctx);
}
typedef struct {
if (unlang_xlat_yield(request, sql_group_xlat_query_resume, NULL, 0, xlat_ctx) != XLAT_ACTION_YIELD) return XLAT_ACTION_FAIL;
- if (sql_get_grouplist(xlat_ctx->group_ctx, thread->trunk, request) != UNLANG_ACTION_PUSHED_CHILD) {
+ if (sql_get_grouplist(NULL, xlat_ctx->group_ctx, thread->trunk, request) != UNLANG_ACTION_PUSHED_CHILD) {
return XLAT_ACTION_FAIL;
}
.query = query,
};
- if (sql_get_grouplist(autz_ctx->group_ctx, autz_ctx->trunk, request) == UNLANG_ACTION_PUSHED_CHILD) {
+ if (sql_get_grouplist(p_result, autz_ctx->group_ctx, autz_ctx->trunk, request) == UNLANG_ACTION_PUSHED_CHILD) {
autz_ctx->status = SQL_AUTZ_GROUP_MEMB_RESUME;
return UNLANG_ACTION_PUSHED_CHILD;
}
};
if (unlang_module_yield(request, mod_autz_group_resume, NULL, 0, mctx->rctx) == UNLANG_ACTION_FAIL) RETURN_UNLANG_FAIL;
- if (sql_get_map_list(request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD) {
+ if (sql_get_map_list(p_result, request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD) {
autz_ctx->status = autz_ctx->status & SQL_AUTZ_STAGE_GROUP ? SQL_AUTZ_GROUP_CHECK_RESUME : SQL_AUTZ_PROFILE_CHECK_RESUME;
return UNLANG_ACTION_PUSHED_CHILD;
}
};
if (unlang_module_yield(request, mod_autz_group_resume, NULL, 0, mctx->rctx) == UNLANG_ACTION_FAIL) RETURN_UNLANG_FAIL;
- if (sql_get_map_list(request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD) {
+ if (sql_get_map_list(p_result, request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD) {
autz_ctx->status = autz_ctx->status & SQL_AUTZ_STAGE_GROUP ? SQL_AUTZ_GROUP_REPLY_RESUME : SQL_AUTZ_PROFILE_REPLY_RESUME;
return UNLANG_ACTION_PUSHED_CHILD;
}
};
if (unlang_module_yield(request, mod_authorize_resume, NULL, 0, autz_ctx) == UNLANG_ACTION_FAIL) RETURN_UNLANG_FAIL;
- if (sql_get_map_list(request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD){
+ if (sql_get_map_list(p_result, request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD){
autz_ctx->status = SQL_AUTZ_CHECK_RESUME;
return UNLANG_ACTION_PUSHED_CHILD;
}
};
if (unlang_module_yield(request, mod_authorize_resume, NULL, 0, autz_ctx) == UNLANG_ACTION_FAIL) RETURN_UNLANG_FAIL;
- if (sql_get_map_list(request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD){
+ if (sql_get_map_list(p_result, request, map_ctx, autz_ctx->trunk) == UNLANG_ACTION_PUSHED_CHILD){
autz_ctx->status = SQL_AUTZ_REPLY_RESUME;
return UNLANG_ACTION_PUSHED_CHILD;
}
redundant_ctx->query_vb->vb_strvalue, SQL_QUERY_OTHER));
unlang_module_yield(request, mod_sql_redundant_query_resume, NULL, 0, redundant_ctx);
- return unlang_function_push(NULL, request, inst->query, NULL, NULL, 0, UNLANG_SUB_FRAME, redundant_ctx->query_ctx);
+ return unlang_function_push(/* discard, mod_sql_redundant_query_resume uses query_ctx->rcode*/ NULL,
+ request,
+ inst->query,
+ NULL,
+ NULL,
+ 0, UNLANG_SUB_FRAME,
+ redundant_ctx->query_ctx);
}
/** Generic module call for failing between a bunch of queries.
* state of the trunk request to reapable - so in that case don't
* yield (in sql_trunk_query_start)
*/
- if (unlang_function_push(NULL, request,
+ if (unlang_function_push(/* allow the caller of rlm_sql_trunk_query to get at the rcode */p_result,
+ request,
query_ctx->treq->state == TRUNK_REQUEST_STATE_REAPABLE ?
NULL : sql_trunk_query_start,
query_ctx->type == SQL_QUERY_SELECT ?
/** Submit the query to get any user / group check or reply pairs
*
*/
-unlang_action_t sql_get_map_list(request_t *request, fr_sql_map_ctx_t *map_ctx, trunk_t *trunk)
+unlang_action_t sql_get_map_list(unlang_result_t *p_result, request_t *request, fr_sql_map_ctx_t *map_ctx, trunk_t *trunk)
{
rlm_sql_t const *inst = map_ctx->inst;
MEM(map_ctx->query_ctx = fr_sql_query_alloc(map_ctx->ctx, inst, request, trunk,
map_ctx->query->vb_strvalue, SQL_QUERY_SELECT));
- if (unlang_function_push(NULL, request, NULL, sql_get_map_list_resume, NULL, 0, UNLANG_SUB_FRAME, map_ctx) < 0) return UNLANG_ACTION_FAIL;
-
- return unlang_function_push(NULL, request, inst->select, NULL, NULL, 0, UNLANG_SUB_FRAME, map_ctx->query_ctx);
+ if (unlang_function_push(p_result,
+ request,
+ NULL,
+ sql_get_map_list_resume,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ map_ctx) < 0) return UNLANG_ACTION_FAIL;
+
+ return unlang_function_push(/* discard, sql_get_map_list_resume uses query_ctx->rcode */ NULL,
+ request,
+ inst->select,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ map_ctx->query_ctx);
}
/*
query_ctx->type = _type; \
query_ctx->status = SQL_QUERY_PREPARED; \
alloc_ctx->query = query; \
- return unlang_function_push(NULL, request, sql->_function, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx); \
+ return unlang_function_push(p_result, request, sql->_function, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx); \
} while (0)
/** Resume function called after each IP allocation query is expanded
if ((env->begin.type == FR_TYPE_STRING) && env->begin.vb_length) {
alloc_ctx->query_ctx->query_str = env->begin.vb_strvalue;
- return unlang_function_push(NULL, request, sql->query, NULL, NULL, 0, UNLANG_SUB_FRAME, alloc_ctx->query_ctx);
+ return unlang_function_push(/* mod_alloc_resume looks at frame result */ p_result,
+ request,
+ sql->query,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ alloc_ctx->query_ctx);
}
return UNLANG_ACTION_PUSHED_CHILD;
common_ctx->query_ctx->query_str = common_ctx->env->update.vb_strvalue;
query_ctx->status = SQL_QUERY_PREPARED;
- return unlang_function_push(NULL, request, sql->query, NULL, NULL, 0, UNLANG_SUB_FRAME, query_ctx);
+ return unlang_function_push(/* mod_common_update_resume uses frame rcode */p_result,
+ request,
+ sql->query,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ query_ctx);
}
/** Common function used by module methods which perform an optional "free" then "update"
talloc_free(common_ctx);
RETURN_UNLANG_FAIL;
}
- return unlang_function_push(NULL, request, sql->query, NULL, NULL, 0, UNLANG_SUB_FRAME, common_ctx->query_ctx);
+ return unlang_function_push(/* mod_common_free_resume looks at frame result */ NULL,
+ request,
+ sql->query,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ common_ctx->query_ctx);
}
common_ctx->query_ctx->query_str = env->update.vb_strvalue;
talloc_free(common_ctx);
RETURN_UNLANG_FAIL;
}
- return unlang_function_push(NULL, request, sql->query, NULL, NULL, 0, UNLANG_SUB_FRAME, common_ctx->query_ctx);
+ return unlang_function_push(/* mod_common_update_resume looks at frame result */ p_result,
+ request,
+ sql->query,
+ NULL,
+ NULL, 0,
+ UNLANG_SUB_FRAME,
+ common_ctx->query_ctx);
}
/** Call SQL module box_escape_func to escape tainted values