From 893f6d4b3cebd9053e95a809a3b8b26340b19a7f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 29 Sep 2023 02:55:05 +0300 Subject: [PATCH 42/42] fcdb: Check database capstr on server launch See osdn #48723 Signed-off-by: Marko Lindqvist --- server/connecthand.c | 4 +--- server/scripting/script_fcdb.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/server/connecthand.c b/server/connecthand.c index e1f001d2ea..f4f3dfe7b3 100644 --- a/server/connecthand.c +++ b/server/connecthand.c @@ -184,9 +184,7 @@ void establish_new_connection(struct connection *pconn) log_normal(_("%s has connected from %s."), pconn->username, pconn->addr); if (srvarg.fcdb_enabled) { - if (script_fcdb_capstr()) { - script_fcdb_call("conn_established", pconn); - } + script_fcdb_call("conn_established", pconn); } conn_compression_freeze(pconn); diff --git a/server/scripting/script_fcdb.c b/server/scripting/script_fcdb.c index 66f415f672..eeccaf618c 100644 --- a/server/scripting/script_fcdb.c +++ b/server/scripting/script_fcdb.c @@ -300,11 +300,19 @@ bool script_fcdb_init(const char *fcdb_luafile) return FALSE; } - if (srvarg.fcdb_enabled && !script_fcdb_call("database_init")) { - log_error("Error connecting to the database"); - script_fcdb_free(); - return FALSE; + if (srvarg.fcdb_enabled) { + if (!script_fcdb_call("database_init")) { + log_error("Error connecting to the database"); + script_fcdb_free(); + return FALSE; + } + + if (!script_fcdb_capstr()) { + log_error(_("Database capabilities not compatible with server")); + return FALSE; + } } + #endif /* HAVE_FCDB */ return TRUE; -- 2.40.1