summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c
index b3e239d..443c75c 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -1331,6 +1331,13 @@ int main(int argc, char *argv[]) {
strncat(conffailmsg, "Error getting 'alertautheddisconnect' from configuration file.\n", sizeof conffailmsg - strlen(conffailmsg) - 1);
}
+ // Is check for updates upon startup and successful client authentication enabled?
+ settings.checkupdates = getconfint("checkupdates", settings.conffile);
+ if (errno == ECONFINT) {
+ conffail = 1;
+ strncat(conffailmsg, "Error getting 'checkupdates' from configuration file.\n", sizeof conffailmsg - strlen(conffailmsg) - 1);
+ }
+
// How many debug logs should we keep?
settings.debugkeep = getconfint("debugkeep", settings.conffile);
if (errno == ECONFINT) {
@@ -1439,6 +1446,21 @@ int main(int argc, char *argv[]) {
debugprint(DEBUG_SOME, "Using configuration file '%s'.\n", settings.conffile);
+ // Check for updates (if enabled in configuration file with checkupdates = "1")
+ if (settings.checkupdates) {
+ debugprint(DEBUG_SOME, "Checking for blabouncer updates (checkupdates = \"0\" to disable)...\n");
+ char version[MAXDNSTXTLEN];
+ version[0] = '\0';
+ int ret = checkversion(version);
+ if (ret == 1) {
+ debugprint(DEBUG_SOME, "main(): blabouncer appears to be up to date.\n");
+ } else if (ret == -1) {
+ debugprint(DEBUG_SOME, "main(): blabouncer appears to be out of date, latest version is %s.\n", version);
+ } else {
+ debugprint(DEBUG_CRIT, "main(): Version check failed!\n");
+ }
+ }
+
// Unless specified otherwise on the command line, fork to background
if (settings.background) {
pid_t pid, sid;