]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Set Firebird connection timeout
authorNick Porter <nick@portercomputing.co.uk>
Mon, 14 Oct 2024 17:01:59 +0000 (18:01 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 14 Oct 2024 17:17:44 +0000 (18:17 +0100)
src/modules/rlm_sql/drivers/rlm_sql_firebird/sql_fbapi.c

index 0f5b0dbb8a7b2dd604a2e90b4b4a6deae9fc2dd7..b1ae35af500adaf73d08a9dae2a8a45814e118a8 100644 (file)
@@ -305,8 +305,9 @@ int fb_connect(rlm_sql_firebird_conn_t *conn, rlm_sql_config_t const *config)
 {
        char            *p, *buff = NULL;
        char const      *database;
+       uint8_t         timeout;
 
-       conn->dpb_len = 4;
+       conn->dpb_len = 7;
        if (config->sql_login) conn->dpb_len+= strlen(config->sql_login) + 2;
 
        if (config->sql_password) conn->dpb_len += strlen(config->sql_password) + 2;
@@ -315,10 +316,23 @@ int fb_connect(rlm_sql_firebird_conn_t *conn, rlm_sql_config_t const *config)
        p = conn->dpb;
 
        *conn->dpb++= isc_dpb_version1;
+
+       /*
+        *      Except for the version above, all Database Parameter Buffer options
+        *      are LTV format, built from:
+        *       - 1 byte option code
+        *       - 1 byte length of value
+        *       - 1 or more bytes of value.  Integers are lsb first.
+        */
        *conn->dpb++= isc_dpb_num_buffers;
        *conn->dpb++= 1;
        *conn->dpb++= 90;
 
+       timeout = fr_time_delta_to_sec(config->trunk_conf.conn_conf->connection_timeout);
+       *conn->dpb++= isc_dpb_connect_timeout;
+       *conn->dpb++= 1;
+       *conn->dpb++= timeout;
+
        fb_dpb_add_str(&conn->dpb, isc_dpb_user_name, config->sql_login);
        fb_dpb_add_str(&conn->dpb, isc_dpb_password, config->sql_password);