]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
better to just report if the option is not set
authorMatthew Newton <matthew-git@newtoncomputing.co.uk>
Mon, 28 Jun 2021 16:05:09 +0000 (17:05 +0100)
committerMatthew Newton <matthew-git@newtoncomputing.co.uk>
Mon, 28 Jun 2021 16:05:55 +0000 (17:05 +0100)
src/modules/rlm_sql/drivers/rlm_sql_sqlite/rlm_sql_sqlite.c

index fb5a13c24135a765e6527f3a2afca56b08669f91..4cfa7421cf8cac7ff6ee8bd96a874fa7aec36dd3 100644 (file)
@@ -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");