From 2b7722dcb5185fd58a8d54c9eb7bd2d7eedbd64c Mon Sep 17 00:00:00 2001 From: Michael Ortmann Date: Sat, 1 Jun 2024 04:50:28 +0200 Subject: [PATCH] Fixes for 1.12 Fix restrict Fix typo Fix comparison Fix stats.help [Patch by: wilk wilkowy] --- README | 4 +- UPDATES | 6 ++ core/mini_httpd.c | 10 ++-- core/templates_stats_commands.c | 2 +- help/stats.help | 75 ++++++++++++++++--------- language/stats.en.lang | 2 +- stats.c | 4 +- templates/stats/classic/classic.de.lang | 4 +- 8 files changed, 70 insertions(+), 37 deletions(-) diff --git a/README b/README index eeef855..efe40d4 100644 --- a/README +++ b/README @@ -24,8 +24,8 @@ Unfortunately, you need to compile stats.mod within your eggdrop source, so if you removed your original compile directory, you'll have to compile the whole bot again... sorry. -Put stats.mod.1.11.tar.gz in ~/eggdrop-1.9.5/src/mod/, -and unpack it (tar xfz stats.mod-1.11.tar.gz). Change directory +Put stats.mod.1.12.tar.gz in ~/eggdrop-1.9.5/src/mod/, +and unpack it (tar xfz stats.mod-1.12.tar.gz). Change directory back to ~/eggdrop-1.9.5/. Type 'make config'. Type 'make', wait until compiling is done and use 'make install' to install the bot and stats.mod. diff --git a/UPDATES b/UPDATES index 0a309ca..8345993 100644 --- a/UPDATES +++ b/UPDATES @@ -1,5 +1,11 @@ Changes in Stats.mod: (since v1.0.1) -------------------- +1.12 +- Fix restrict +- Fix typo +- Fix comparison +- Fix stats.help [Patch by: wilk wilkowy] + 1.11 - Fix heap-use-after-free - Enhance FIXME comment for heap-use-after-free diff --git a/core/mini_httpd.c b/core/mini_httpd.c index 2d299a1..5bb62c7 100644 --- a/core/mini_httpd.c +++ b/core/mini_httpd.c @@ -935,8 +935,9 @@ static char *encode_url(char *url) */ static char *decode_url(char *paramurl) { - char *p, *buf, *url, c, hex[5]; + char *p, *buf, *url, hex[5]; long int i; + size_t l; // free url-buffer (global var) if (httpd_text_buf) @@ -967,10 +968,11 @@ static char *decode_url(char *paramurl) i = '?'; debug0("MiniHTTPd: decode_url(): i is 0"); } - c = (char) i; // now append the decoded char to the url - httpd_text_buf = nrealloc(httpd_text_buf, strlen(httpd_text_buf) + 1 + 1); - sprintf(httpd_text_buf, "%s%c", httpd_text_buf, c); + l = strlen(httpd_text_buf); + httpd_text_buf = nrealloc(httpd_text_buf, l + 1 + 1); + httpd_text_buf[l++] = (char) i; + httpd_text_buf[l] = 0; // increase the pointer to abandon the encoded char url += 2; } else { diff --git a/core/templates_stats_commands.c b/core/templates_stats_commands.c index d1dbb99..b188a5e 100644 --- a/core/templates_stats_commands.c +++ b/core/templates_stats_commands.c @@ -540,7 +540,7 @@ static void template_send_hosts(int idx, struct template_content *h_tpc) continue; host = strrchr(h->host, '.') + 1; // skip other unusable hosts - if (!((host - 1) && host)) { + if (!host) { debug1("[stats.mod] Skipping host-stats for '%s'.", h->host); continue; } diff --git a/help/stats.help b/help/stats.help index 8f83238..5503838 100644 --- a/help/stats.help +++ b/help/stats.help @@ -1,59 +1,84 @@ %{help=savestats}%{+m} ### %bsavestats%b - Saves all data. + Saves all data. + +See also: purgestats %{help=resetuser}%{+m|-} ### %bresetuser%b - resets all statistics of in to 0. + Resets all channel statistics of user to 0. + +See also: purgestats, savestats %{help=schannel}%{+o|+o} ### %bschannel%b [channel] - displays a list of users on the channel, listing their nicks and - corresponding stats-usernames. + Displays a list of users on the channel, listing their nicks and + corresponding stats-usernames. + +See also: swhois %{help=swhois}%{+o|+o} ### %bswhois%b - displays information about (stat-flags, hosts, etc...) - flags: - +/-list: list a user in the top10/20/etc? - +/-addhosts: automatically add new hosts to user? + Displays information about user (stat-flags, hosts, etc...). + Flags: + +/-list: list a user in the top10/20/etc? + +/-addhosts: automatically add new hosts to user? + +See also: schattr, smatch %{help=+shost}%{+m|-} ### %b+shost%b - adds a host to + Adds a host to user. + +See also: -shost %{help=-shost}%{+m|-} ### %b-shost%b - removes a host from + Removes a host from user. + +See also: +shost %{help=+suser}%{+m|-} ### %b+suser%b [host] - creates a new stat-user record + Creates a new stat-user record. + +See also: -suser, +shost, -shost %{help=-suser}%{+m|-} ### %b-suser%b - deletes a stat-user + Deletes a stat-user. + +See also: +suser %{help=schattr}%{+m|-} ### %bschattr%b - changes the flags of a stat-user + Changes the flags of a stat-user. + +See also: swhois %{help=smatch}%{+m} ### %bsmatch%b [user] [host] [flags] - displays all matching users - wildcards allowed. + Displays all matching users. Wildcards allowed. + +See also: swhois %{help=chsusername}%{+m} ### %bchsusername%b - changes the name of an user + Changes the name of an user. + +See also: +suser, -suser, sumuser %{help=writewebstats}%{+m|-} ### %bwritewebstats%b - writes the static (*cough*!) webfiles for the given channels. + Writes the static (*cough*!) webfiles for the given channels. %{help=purgestats}%{+m|-} ### %bpurgestats%b - purges all outdates statistics and deletes old users + Purges all outdated statistics and deletes old users. + +See also: savestats %{help=sumuser}%{+n|-} ### %bsumuser%b - transfers all stats from user2 to user1 and deletes user2 + Transfers all stats from user2 to user1 and deletes user2. + +See also: chsusername %{help=stats module}%{+m} -### help on the %bstats module%b +### %bstats module%b commands Commands available: (use %b'.help '%b for more info) %{+o|o} - for ops: + For ops: %bschannel%b %bswhois%b %{+m|m} - for masters: + For masters: %bsavestats%b %bresetuser%b %b+shost%b @@ -70,14 +95,14 @@ There is also a list of tcl settings available, use %b'.help stats settings'%b %{help=all}%{+m} -### commands for the %bstats module%b +### %bstats module%b commands Commands available: (use %b'.help '%b for more info) %{+o|o} - for ops: + For ops: %bschannel%b %bswhois%b %{+m|m} - for masters: + For masters: %bsavestats%b %bresetuser%b %b+shost%b diff --git a/language/stats.en.lang b/language/stats.en.lang index 049894a..26e7151 100644 --- a/language/stats.en.lang +++ b/language/stats.en.lang @@ -54,7 +54,7 @@ T minutes time wasted 500 Hello, you've just been added to my userbase! Your username is "". 500 From now on, I'll log various statistics about you, unless you stop me. 500 If you set a password with "/msg STATSPASS ", you can edit the settings of your account. -500 The password will be transferred and stored in plain-text, so please don't re-use a password for any important account. +500 The password will be transferred and stored in plain-text, so please don't reuse a password for any important account. 500 The URL of the stats-pages is http://: 1020 Sorry, I don't recognize you. diff --git a/stats.c b/stats.c index 5421ebd..2e4aa7e 100644 --- a/stats.c +++ b/stats.c @@ -31,7 +31,7 @@ #define MAKING_STATS #define MODULE_NAME "stats" -#define MODULE_VERSION "1.11" +#define MODULE_VERSION "1.12" #ifndef NO_EGG #include "../module.h" #include "../irc.mod/irc.h" @@ -446,7 +446,7 @@ char *stats_start(Function * global_funcs) chanlangs = NULL; slang_glob_init(); - module_register(MODULE_NAME, stats_table, 1, 11); + module_register(MODULE_NAME, stats_table, 1, 12); if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0))) return "You need the irc module to use the stats module."; if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0))) diff --git a/templates/stats/classic/classic.de.lang b/templates/stats/classic/classic.de.lang index f9b476e..92b7882 100644 --- a/templates/stats/classic/classic.de.lang +++ b/templates/stats/classic/classic.de.lang @@ -91,7 +91,7 @@ D 12 etwas Zeit # userpage head 710 Statistiken für in 720 ICQ# -721 eMail +721 E-Mail 722 Homepage 723 Alter 730 Platz @@ -162,7 +162,7 @@ F vocables 2 Auch 's Wortschatz ist n 1040 Neues Passwort 1045 Neues Passwort (Bestätigung) 1050 ICQ# -1060 eMail +1060 E-Mail 1070 Homepage 1080 List me in the top? 1081 Soll ich automatisch neue Hosts zu deinem Account hinzufügen?