From: Matthew Newton Date: Mon, 28 Jun 2021 16:05:09 +0000 (+0100) Subject: better to just report if the option is not set X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4e72e7b096f90278e35d4211ef88a9fb6b5778b;p=thirdparty%2Ffreeradius-server.git better to just report if the option is not set --- diff --git a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c index fb5a13c2413..4cfa7421cf8 100644 --- a/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c +++ b/src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c @@ -58,7 +58,7 @@ typedef struct { typedef struct { char const *filename; uint32_t busy_timeout; - bool bootstrapped; + bool bootstrap; } rlm_sql_sqlite_t; static const CONF_PARSER driver_config[] = { @@ -431,7 +431,7 @@ static int CC_HINT(nonnull) sql_socket_init(rlm_sql_handle_t *handle, rlm_sql_co if (!conn->db || (sql_check_error(conn->db, status) != RLM_SQL_OK)) { sql_print_error(conn->db, status, "Error opening SQLite database \"%s\"", inst->filename); #ifdef HAVE_SQLITE3_OPEN_V2 - if (!inst->bootstrapped) { + if (!inst->bootstrap) { INFO("Use the sqlite driver 'bootstrap' option to automatically create the database file"); } #endif @@ -705,7 +705,11 @@ static int mod_instantiate(rlm_sql_config_t const *config, void *instance, CONF_ return -1; } - if (cf_pair_find(cs, "bootstrap") && !exists) { + if (cf_pair_find(cs, "bootstrap")) { + inst->bootstrap = true; + } + + if (inst->bootstrap && !exists) { #ifdef HAVE_SQLITE3_OPEN_V2 int status; int ret; @@ -787,8 +791,6 @@ static int mod_instantiate(rlm_sql_config_t const *config, void *instance, CONF_ } return -1; } - - inst->bootstrapped = true; #else WARN("sqlite3_open_v2() not available, cannot bootstrap database. " "Upgrade to SQLite >= 3.5.1 if you need this functionality");