From 2a1d4b2e958de1581e9bda7b07b705b963e394a6 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 11 Aug 2025 23:02:08 +0100 Subject: Implement update checking using the command "BLABOUNCER UPDATECHECK", or optionally (enabled by default, toggled with configuration option "checkupdates") at startup and successful client authentication. This is implemented using a DNS TXT record check to the domain "version.blabouncer.blatech.net". --- functions.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'functions.h') diff --git a/functions.h b/functions.h index ff9d656..72a2129 100644 --- a/functions.h +++ b/functions.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,8 @@ #define MAXCLIENTS 32 // Maximum number of clients that can connect to the bouncer at a time #define MAXCHANNELS 1024 // Let's assume 1024 is reasonable for now (it's configured per IRCd) #define MAXRFCNICKLEN 9 // From RFC 1459 +#define MAXDNSTXTLEN 2048 // Maximum size to store in a DNS TXT record response +#define VERSIONTXTNAME "version.blabouncer.blatech.net" // DNS name of blabouncer latest version check TXT record #define MAXTOKENS 100 // For strsep string splitting @@ -220,4 +223,14 @@ void stripprefixesfromnick(char *nick); // Convert the given 'string' into lowercase void strlower(char *string); + +// Gets a single TXT record from DNS for "dnsname" and stores the result in "record" +// Returns 1 on success or 0 on failure +// TODO: If this is ever used for more than just version checks, then it needs to do more than a single record. +int gettxtrecordsingle(char *dnsname, char *record); + +// Gets the latest blabouncer version string from DNS and stores it in "version" +// Ignores the Git version portion (everything after the first '-') of VERSION, if present +// Returns 1 if local VERSION is current, -1 if local VERSION is not current, or 0 on failure +int checkversion(char *version); #endif -- cgit v1.2.3