]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
SQL connect_query is not expected to return data
authorNick Porter <nick@portercomputing.co.uk>
Mon, 29 Apr 2024 15:42:59 +0000 (16:42 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 7 Jun 2024 02:26:58 +0000 (22:26 -0400)
So run with `rlm_sql_query()` rather than `rlm_sql_select_query()`

src/modules/rlm_sql/sql.c

index f2f0ff73c99c0637a2cfe44de4d1e58faedb6bf5..754dafda8693e4d964c967abf383d2bd917f4769 100644 (file)
@@ -98,8 +98,15 @@ void *sql_mod_conn_create(TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeo
        }
 
        if (inst->config.connect_query) {
-               if (rlm_sql_select_query(inst, NULL, &handle, inst->config.connect_query) != RLM_SQL_OK) goto fail;
-               (inst->driver->sql_finish_select_query)(handle, &inst->config);
+               fr_sql_query_t  *query_ctx;
+               rlm_rcode_t     p_result;
+               MEM(query_ctx = fr_sql_query_alloc(ctx, inst, handle, inst->config.connect_query, SQL_QUERY_OTHER));
+               rlm_sql_query(&p_result, NULL, NULL, query_ctx);
+               if (query_ctx->rcode != RLM_SQL_OK) {
+                       talloc_free(query_ctx);
+                       goto fail;
+               }
+               talloc_free(query_ctx);
        }
 
        return handle;