From 1d3c5a49a9604a85e50e30d9f93b02bfded45f74 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 3 May 2024 14:08:06 +0200 Subject: [PATCH] Get rid of confusing "REHASH -all" as "REHASH" already does the same. And this is easily mistaken with "REHASH -global" which rehashes all the IRC servers on the network. In fact, who knows some year(s) from now we may map "REHASH -all" to "REHASH -global", but... not yet... --- doc/RELEASE-NOTES.md | 3 ++- src/serv.c | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/RELEASE-NOTES.md b/doc/RELEASE-NOTES.md index 6ee877f7a..653fccdc5 100644 --- a/doc/RELEASE-NOTES.md +++ b/doc/RELEASE-NOTES.md @@ -8,7 +8,8 @@ in progress and may not always be a stable version. * TODO ### Changes: -* TODO +* For many years `REHASH -all` is the same as `REHASH` so we now reject + the former. ### Fixes: * When booting for the first time (without any cached files) the IRCd diff --git a/src/serv.c b/src/serv.c index a9a8b669c..7d0647905 100644 --- a/src/serv.c +++ b/src/serv.c @@ -556,7 +556,7 @@ CMD_FUNC(cmd_rehash) if (x != HUNTED_ISME) return; /* Now forwarded or server didnt exist */ - if (!MyConnect(client)) + if (!MyUser(client)) { #ifndef REMOTE_REHASH sendnumeric(client, ERR_NOPRIVILEGES); @@ -577,7 +577,18 @@ CMD_FUNC(cmd_rehash) /* Ok this is in an 'else' because it should be only executed for local clients, * but it's totally unrelated to the above ;). */ - if (parv[1] && match_simple("-glob*", parv[1])) + if (parv[1] && !strcasecmp(parv[1], "-all")) + { + sendnumeric(client, ERR_CANNOTDOCOMMAND, "REHASH", + "The command 'REHASH -all' does not exist. " + "Did you mean just 'REHASH'? " + "Or did you mean 'REHASH -global' which rehashes all IRC servers on the network?"); + /* In a future version we may make 'REHASH -all' to mean 'REHASH -global', but not yet.. */ + return; + } + if (parv[1] && + (match_simple("-glob*", parv[1]) + /* || (MyUser(client) && !strcasecmp(parv[1], "-all"))*/ )) { /* /REHASH -global [options] */ Client *acptr; @@ -599,7 +610,7 @@ CMD_FUNC(cmd_rehash) sendto_one(acptr, NULL, ":%s REHASH %s %s", client->name, acptr->name, - parv[1] ? parv[1] : "-all"); + parv[1] ? parv[1] : ""); } /* Don't return, continue, because we need to REHASH ourselves as well. */ }