From 12dbbca15e32d4fb05c8dd2305e98b4a6208fa36 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 8 Jun 2019 09:26:55 +0200 Subject: [PATCH] Rip out support for changing offsets via TSCTL and tune file. Use NTP!! Adjustments via TSCTL are never accurate enough. --- include/h.h | 1 - src/ircd.c | 7 +-- src/modules/m_tsctl.c | 127 +++++------------------------------------- src/s_dispatch.c | 2 +- src/s_serv.c | 3 +- 5 files changed, 17 insertions(+), 123 deletions(-) diff --git a/include/h.h b/include/h.h index 925b85c39..37f864b58 100644 --- a/include/h.h +++ b/include/h.h @@ -41,7 +41,6 @@ extern MODVAR aClient me; extern MODVAR aChannel *channel; extern MODVAR struct stats *ircstp; extern MODVAR int bootopt; -extern MODVAR time_t TSoffset; extern MODVAR time_t timeofday; extern MODVAR char cmodestring[512]; extern MODVAR char umodestring[UMODETABLESZ+1]; diff --git a/src/ircd.c b/src/ircd.c index 571b39e86..70ff6818d 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -70,7 +70,6 @@ ID_Notes("2.48 3/9/94"); #ifdef __FreeBSD__ char *malloc_options = "h" MALLOC_FLAGS_EXTRA; #endif -time_t TSoffset = 0; #ifndef _WIN32 extern char unreallogo[]; @@ -815,8 +814,6 @@ static void do_version_check() } } -extern time_t TSoffset; - extern void applymeblock(void); extern MODVAR Event *events; @@ -1498,7 +1495,7 @@ void SocketLoop(void *dummy) #define NEGATIVE_SHIFT_WARN -15 #define POSITIVE_SHIFT_WARN 20 - timeofday = time(NULL) + TSoffset; + timeofday = time(NULL); if (oldtimeofday == 0) oldtimeofday = timeofday; /* pretend everything is ok the first time.. */ if (mytdiff(timeofday, oldtimeofday) < NEGATIVE_SHIFT_WARN) { @@ -1572,7 +1569,7 @@ void SocketLoop(void *dummy) process_clients(); - timeofday = time(NULL) + TSoffset; + timeofday = time(NULL); /* * Debug((DEBUG_DEBUG, "Got message(s)")); diff --git a/src/modules/m_tsctl.c b/src/modules/m_tsctl.c index db6234ac8..ae977e6b8 100644 --- a/src/modules/m_tsctl.c +++ b/src/modules/m_tsctl.c @@ -20,11 +20,6 @@ #include "unrealircd.h" -CMD_FUNC(m_tsctl); - -/* Place includes here */ -#define MSG_TSCTL "TSCTL" - ModuleHeader MOD_HEADER(m_tsctl) = { "tsctl", /* Name of module */ @@ -34,142 +29,46 @@ ModuleHeader MOD_HEADER(m_tsctl) NULL }; -/* This is called on module init, before Server Ready */ +CMD_FUNC(m_tsctl); + MOD_INIT(m_tsctl) { - CommandAdd(modinfo->handle, MSG_TSCTL, m_tsctl, MAXPARA, M_USER|M_SERVER); + CommandAdd(modinfo->handle, "TSCTL", m_tsctl, MAXPARA, M_USER|M_SERVER); MARK_AS_OFFICIAL_MODULE(modinfo); return MOD_SUCCESS; } -/* Is first run when server is 100% ready */ MOD_LOAD(m_tsctl) { return MOD_SUCCESS; } -/* Called when module is unloaded */ MOD_UNLOAD(m_tsctl) { return MOD_SUCCESS; } -/* -** m_tsctl - Stskeeps -** parv[1] = command -** parv[2] = options -*/ CMD_FUNC(m_tsctl) { - time_t timediff; - if (!ValidatePermissionsForPath("server:tsctl:view",sptr,NULL,NULL,NULL)) { sendnumeric(sptr, ERR_NOPRIVILEGES); return 0; } - if (parv[1]) + if (MyClient(sptr) && (!parv[1] || stricmp(parv[1], "alltime"))) { - if (*parv[1] == '\0') - { - sendnumeric(sptr, ERR_NEEDMOREPARAMS, "TSCTL"); - return 0; - } - - if (stricmp(parv[1], "offset") == 0) - { - if (!ValidatePermissionsForPath("server:tsctl:set",sptr,NULL,NULL,NULL)) - { - sendnumeric(sptr, ERR_NOPRIVILEGES); - return 0; - } - - if (BadPtr(parv[2]) || BadPtr(parv[3]) || (*parv[2] != '+') || (*parv[2] != '-')) - { - sendnotice(sptr, "*** TSCTL OFFSET: /tsctl offset <+|->