{ NULL, -1, 0, NULL, NULL } /* end the list */
};
-static char *allowed_chars = NULL;
/*
* Do any per-module initialization that is separate to each
}
inst->conf_section = conf;
- allowed_chars = inst->allowed_chars;
*instance = inst;
return 0;
}
free(*p);
*p = NULL;
}
- allowed_chars = NULL;
free(inst);
return 0;
}
/*
* Translate the SQL queries.
*/
-static size_t sql_escape_func(UNUSED REQUEST *request, char *out, size_t outlen, const char *in, UNUSED void *arg)
+static size_t sql_escape_func(UNUSED REQUEST *request, char *out, size_t outlen, const char *in, void *arg)
{
+ rlm_sql_log_t *inst = (rlm_sql_log_t *)arg;
int len = 0;
while (in[0]) {
* mime-encoded equivalents.
*/
if ((in[0] < 32) ||
- strchr(allowed_chars, *in) == NULL) {
+ strchr(inst->allowed_chars, *in) == NULL) {
/*
* Only 3 or less bytes available.
*/
return len;
}
-static size_t sql_utf8_escape_func(UNUSED REQUEST *request, char *out, size_t outlen, const char *in, UNUSED void *arg)
+static size_t sql_utf8_escape_func(UNUSED REQUEST *request, char *out, size_t outlen, const char *in, void *arg)
{
+ rlm_sql_log_t *inst = (rlm_sql_log_t *)arg;
size_t len = 0;
size_t utf8 = 0;
* mime-encoded equivalents.
*/
if ((in[0] < 32) ||
- strchr(allowed_chars, *in) == NULL) {
+ strchr(inst->allowed_chars, *in) == NULL) {
/*
* Only 3 or less bytes available.
*/
/* Expand variables in the query */
xlat_query[0] = '\0';
radius_xlat(xlat_query, len, query, request,
- inst->utf8 ? sql_utf8_escape_func : sql_escape_func, NULL);
+ inst->utf8 ? sql_utf8_escape_func : sql_escape_func, inst);
if (xlat_query[0] == '\0') {
radlog_request(L_ERR, 0, request, "Couldn't xlat the query %s",
query);