}
+static void *mod_conn_create(TALLOC_CTX *ctx, void *instance)
+{
+ int rcode;
+ rlm_sql_t *inst = instance;
+ rlm_sql_handle_t *handle;
+
+ /*
+ * Connections cannot be alloced from the inst or
+ * pool contexts due to threading issues.
+ */
+ handle = talloc_zero(ctx, rlm_sql_handle_t);
+ if (!handle) return NULL;
+
+ handle->log_ctx = talloc_pool(handle, 2048);
+ if (!handle->log_ctx) {
+ talloc_free(handle);
+ return NULL;
+ }
+
+ /*
+ * Handle requires a pointer to the SQL inst so the
+ * destructor has access to the module configuration.
+ */
+ handle->inst = inst;
+
+ rcode = (inst->module->sql_socket_init)(handle, inst->config);
+ if (rcode != 0) {
+ fail:
+ /*
+ * Destroy any half opened connections.
+ */
+ talloc_free(handle);
+ return NULL;
+ }
+
+ if (inst->config->connect_query) {
+ if (rlm_sql_select_query(inst, NULL, &handle, inst->config->connect_query) != RLM_SQL_OK) goto fail;
+ (inst->module->sql_finish_select_query)(handle, inst->config);
+ }
+
+ return handle;
+}
+
+
static int mod_instantiate(CONF_SECTION *conf, void *instance)
{
rlm_sql_t *inst = instance;
struct sql_grouplist *next;
} rlm_sql_grouplist_t;
-void *mod_conn_create(TALLOC_CTX *ctx, void *instance);
int sql_fr_pair_list_afrom_str(TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **first_pair, rlm_sql_row_t row);
int sql_read_realms(rlm_sql_handle_t *handle);
int sql_getvpdata(TALLOC_CTX *ctx, rlm_sql_t *inst, REQUEST *request, rlm_sql_handle_t **handle, VALUE_PAIR **pair, char const *query);
};
-void *mod_conn_create(TALLOC_CTX *ctx, void *instance)
-{
- int rcode;
- rlm_sql_t *inst = instance;
- rlm_sql_handle_t *handle;
-
- /*
- * Connections cannot be alloced from the inst or
- * pool contexts due to threading issues.
- */
- handle = talloc_zero(ctx, rlm_sql_handle_t);
- if (!handle) return NULL;
-
- handle->log_ctx = talloc_pool(handle, 2048);
- if (!handle->log_ctx) {
- talloc_free(handle);
- return NULL;
- }
-
- /*
- * Handle requires a pointer to the SQL inst so the
- * destructor has access to the module configuration.
- */
- handle->inst = inst;
-
- rcode = (inst->module->sql_socket_init)(handle, inst->config);
- if (rcode != 0) {
- fail:
- /*
- * Destroy any half opened connections.
- */
- talloc_free(handle);
- return NULL;
- }
-
- if (inst->config->connect_query) {
- if (rlm_sql_select_query(inst, NULL, &handle, inst->config->connect_query) != RLM_SQL_OK) goto fail;
- (inst->module->sql_finish_select_query)(handle, inst->config);
- }
-
- return handle;
-}
-
/*************************************************************************
*
* Function: sql_fr_pair_list_afrom_str