Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2021-07-01 12:33:51 +01:00
commit d95d7fc4f5
43 changed files with 166 additions and 138 deletions

View File

@ -43,6 +43,8 @@ InspIRCd is licensed under [version 2 of the GNU General Public License](https:/
* [Website](https://www.inspircd.org)
* [Documentation](https://docs.inspircd.org)
* [GitHub](https://github.com/inspircd)
* [Twitter](https://twitter.com/inspircdteam)
* [Mastodon](https://fosstodon.org/@inspircd)
* Support IRC channel — \#inspircd on irc.inspircd.org
* Development IRC channel — \#inspircd.dev on irc.inspircd.org
* InspIRCd test network — testnet.inspircd.org

View File

@ -44,10 +44,11 @@ VHOST WATCH WHO WHOIS WHOWAS
Sends a message to the network service specified in <target>.
">
<helpop key="servlist" title="/SERVLIST [<mask>]" value="
List network services that are currently connected to the network
and visible to you. The optional glob-based mask parameter matches
against the network service nickname.
<helpop key="servlist" title="/SERVLIST [<nick> [<oper-type>]]" value="
List network services that are currently connected to the network and
visible to you. The optional glob-based nick and oper-type parameters
match against the nickname of the network service and the oper type of
the network service.
">
<helpop key="sslinfo" title="/SSLINFO <nick>" value="
@ -846,6 +847,8 @@ using their cloak when they quit.
non-server operators (requires the hidechans module).
L Stops redirections done by the redirect module (requires
the redirect module).
N Allows users to opt-out of receiving channel history
(requires the chanhistory module).
O Allows server operators to opt-in to overriding
restrictions (requires the override module).
R Blocks private messages from unregistered users

View File

@ -1653,6 +1653,9 @@
#
# Generate hashes using the /MKPASSWD command on the server.
# Don't run it on a server you don't trust with your password.
#
# You can also make the MKPASSWD command oper only by uncommenting this:
#<mkpasswd operonly="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# PBKDF2 module: Allows other modules to generate PBKDF2 hashes,

View File

@ -124,9 +124,11 @@
#fingerprint="67cb9dc013248a829bb2171ed11becd4"
# autologin: If a TLS client certificate fingerprint for this oper is specified,
# you can have the oper block automatically log in. This moves all security
# of the oper block to the protection of the TLS client certificate, so be sure
# that the private key is well-protected! Requires the sslinfo module.
# you can have the oper block automatically log in. This can also be set to
# "if-host-match", to additionally check the host setting for this block before
# automatically logging in. Otherwise, all security of the oper block rests on the
# protection of the TLS client certificate, so be sure that the private key is
# well-protected!. Requires the sslinfo module.
#autologin="yes"
# sslonly: If enabled, this oper can only oper up if they're using a TLS connection.

View File

@ -49,7 +49,7 @@ Computers make very fast, very accurate mistakes
Life would be so much easier if we only had the source code
Who is this 'General Failure' and why is he reading my disk?
hAS aNYONE sEEN MY cAPSLOCK kEY?
InspIRCd, now with excessive ammounts of Cheeze
InspIRCd, now with excessive amounts of Cheeze
I'm in the computer business, I make Out-Of-Order signs
Kevorkian Virus: helps your computer shut down whenever it wants to.
[OUT OF QUOTES, PLEASE ORDER MORE]

View File

@ -46,4 +46,4 @@ In this case every character of line except first dot specifies one character-co
*** TODO ***
- UTF-8 collation rules (Inapplieable to InspIRCd atm).
- UTF-8 collation rules (Inapplicable to InspIRCd atm).

View File

@ -64,7 +64,7 @@ class CoreExport CommandParser
* and the command completeld successfully. It will return CmdResult::FAILURE if the command handler was found
* and called, but the command did not complete successfully, and it will return CmdResult::INVALID if the
* command simply did not exist at all or the wrong number of parameters were given, or the user
* was not privilaged enough to execute the command.
* was not privileged enough to execute the command.
*/
CmdResult CallHandler(const std::string& commandname, const CommandBase::Params& parameters, User* user, Command** cmd = NULL);

View File

@ -147,7 +147,7 @@ class CoreExport Extensible
unsigned int culled:1;
public:
/**
* Get the extension items for iteraton (i.e. for metadata sync during netburst)
* Get the extension items for iteration (i.e. for metadata sync during netburst)
*/
inline const ExtensibleStore& GetExtList() const { return extensions; }

View File

@ -532,7 +532,7 @@ class CoreExport ModeWatcher : public Cullable
* @param dest The target user for the mode, if you are watching a user mode
* @param channel The target channel for the mode, if you are watching a channel mode
* @param change Information regarding the mode change.
* If you alter the parameter you are given, the mode handler will see your atered version
* If you alter the parameter you are given, the mode handler will see your altered version
* when it handles the mode.
* @return True to allow the mode change to go ahead, false to abort it. If you abort the
* change, the mode handler (and ModeWatcher::AfterMode()) will never see the mode change.

View File

@ -478,7 +478,7 @@ class CoreExport Module : public Cullable, public usecountbase
* @param user The user joining the channel
* @param chan If the channel is a new channel, this will be NULL, otherwise it will be a pointer to the channel being joined
* @param cname The channel name being joined. For new channels this is valid where chan is not.
* @param privs A string containing the users privilages when joining the channel. For new channels this will contain "o".
* @param privs A string containing the users privileges when joining the channel. For new channels this will contain "o".
* You may alter this string to alter the user's modes on the channel.
* @param keygiven The key given to join the channel, or an empty string if none was provided
* @param override Whether the channel join can be blocked by returning MOD_RES_DENY.
@ -578,7 +578,7 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called before local nickname changes. This can be used to implement Q-lines etc.
* If your method returns nonzero, the nickchange is silently forbidden, and it is down to your
* module to generate some meaninful output.
* module to generate some meaningful output.
* @param user The username changing their nick
* @param newnick Their new nickname
* @return 1 to deny the change, 0 to allow
@ -635,14 +635,14 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called whenever a user's hostname is changed.
* This event triggers after the host has been set.
* @param user The user whos host is being changed
* @param user The user whose host is being changed
* @param newhost The new hostname being set
*/
virtual void OnChangeHost(User* user, const std::string &newhost);
/** Called whenever a user's real hostname is changed.
* This event triggers before the host has been set.
* @param user The user whos host is being changed
* @param user The user whose host is being changed
* @param newhost The new hostname being set
*/
virtual void OnChangeRealHost(User* user, const std::string& newhost);
@ -699,7 +699,7 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called after any nickchange, local or remote. This can be used to track users after nickchanges
* have been applied. Please note that although you can see remote nickchanges through this function, you should
* NOT make any changes to the User if the user is a remote user as this may cause a desnyc.
* NOT make any changes to the User if the user is a remote user as this may cause a desync.
* check user->server before taking any action (including returning nonzero from the method).
* Because this method is called after the nickchange is taken place, no return values are possible
* to indicate forbidding of the nick change. Use OnUserPreNick for this.
@ -810,14 +810,14 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called after a user object is initialised and added to the user list.
* When this is called the user has not had their I/O hooks checked or had their initial
* connect class assigned and may not yet have a serialiser. You probably want to use
* connect class assigned and may not yet have a serializer. You probably want to use
* the OnUserPostInit or OnUserSetIP hooks instead of this one.
* @param user The connecting user.
*/
virtual void OnUserInit(LocalUser* user);
/** Called after a user object has had their I/O hooks checked, their initial connection
* class assigned, and had a serialiser set.
* class assigned, and had a serializer set.
* @param user The connecting user.
*/
virtual void OnUserPostInit(LocalUser* user);
@ -909,7 +909,7 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called whenever a change of a local users displayed host is attempted.
* Return 1 to deny the host change, or 0 to allow it.
* @param user The user whos host will be changed
* @param user The user whose host will be changed
* @param newhost The new hostname
* @return 1 to deny the host change, 0 to allow
*/
@ -917,7 +917,7 @@ class CoreExport Module : public Cullable, public usecountbase
/** Called whenever a change of a local users real name is attempted.
* return MOD_RES_DENY to deny the name change, or MOD_RES_ALLOW to allow it.
* @param user The user whos real name will be changed
* @param user The user whose real name will be changed
* @param newhost The new real name.
* @return MOD_RES_DENY to deny the real name change, MOD_RES_ALLOW to allow
*/

View File

@ -87,7 +87,7 @@ struct HTTPRequestURI
std::string fragment;
};
/** A modifyable list of HTTP header fields
/** A modifiable list of HTTP header fields
*/
class HTTPHeaders
{

View File

@ -111,7 +111,7 @@ class ssl_cert : public refcountbase
return unknownsigner;
}
/** Get revokation status.
/** Get revocation status.
* @return True if the certificate is revoked.
* Note that this only works properly for GnuTLS
* right now.

View File

@ -60,7 +60,7 @@ class CoreExport Serializable
/** Loads the value with the specified key.
* @param key The key by which this data is identified.
* @param out The location to store the value for this keu
* @param out The location to store the value for this key.
*/
Data& Load(const std::string& key, std::string& out);
@ -109,7 +109,7 @@ class CoreExport Serializable
*/
virtual bool Deserialize(Data& data) = 0;
/** Serializes the this object into the specified Data obect.
/** Serializes the this object into the specified Data object.
* @param data The Data object to serialize to.
* @return True if the serialisation succeeded; otherwise, false.
*/

View File

@ -68,7 +68,7 @@ enum EventMask
/** Mask for all read events */
FD_WANT_READ_MASK = 0x0F,
/** Do not test this socket for writeability
/** Do not test this socket for writability
*/
FD_WANT_NO_WRITE = 0x10,
/** Give a write event at all times when writes will not block.

View File

@ -476,7 +476,7 @@ class CoreExport User : public Extensible
void SetMode(ModeHandler* mh, bool value);
void SetMode(ModeHandler& mh, bool value) { SetMode(&mh, value); }
/** Returns true or false for if a user can execute a privilaged oper command.
/** Returns true or false for if a user can execute a privileged oper command.
* This is done by looking up their oper type from User::oper, then referencing
* this to their oper classes and checking the commands they can execute.
* @param command A command (should be all CAPS)
@ -488,7 +488,7 @@ class CoreExport User : public Extensible
* This is used to check whether or not users may perform certain actions which admins may not wish to give to
* all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc.
*
* @param privstr The priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file.
* @param privstr The priv to check, e.g. "users/override/topic". These are loaded free-form from the config file.
* @return True if this user has the permission in question.
*/
virtual bool HasPrivPermission(const std::string& privstr);
@ -595,7 +595,7 @@ class CoreExport User : public Extensible
/** Change the ident (username) of a user.
* ALWAYS use this function, rather than writing User::ident directly,
* as this triggers module events allowing the change to be syncronized to
* as this triggers module events allowing the change to be synchronized to
* remote servers.
* @param newident The new ident to set
* @return True if the change succeeded, false if it didn't
@ -776,7 +776,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
*/
void WriteRemoteNotice(const std::string& text) override;
/** Returns true or false for if a user can execute a privilaged oper command.
/** Returns true or false for if a user can execute a privileged oper command.
* This is done by looking up their oper type from User::oper, then referencing
* this to their oper classes and checking the commands they can execute.
* @param command A command (should be all CAPS)
@ -788,7 +788,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node<Local
* This is used to check whether or not users may perform certain actions which admins may not wish to give to
* all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc.
*
* @param privstr The priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file.
* @param privstr The priv to check, e.g. "users/override/topic". These are loaded free-form from the config file.
* @return True if this user has the permission in question.
*/
bool HasPrivPermission(const std::string& privstr) override;

View File

@ -395,7 +395,7 @@ sub getpidfile
$i =~ s/[^=]+=\s(.*)/\1/;
if (($i =~ s/\<include file=\"(.+?)\"\>//i) && ($i !~ /^#/))
{
# Decend into that file, and check for PIDs.. (that sounds like an STD ;/)
# Descend into that file, and check for PIDs.. (that sounds like an STD ;/)
getpidfile($1);
# Was a PID found?
if ($pidfile ne "") {

View File

@ -32,7 +32,7 @@ CommandServList::CommandServList(Module* parent)
, invisiblemode(parent, "invisible")
{
allow_empty_last_param = false;
syntax = { "[<mask> [<type>]]" };
syntax = { "[<nick> [<oper-type>]]" };
}
CmdResult CommandServList::HandleLocal(LocalUser* user, const Params& parameters)

View File

@ -102,7 +102,7 @@ namespace
FIRST_MOD_RESULT(OnUserPreMessage, modres, (source, msgtarget, msgdetails));
if (modres == MOD_RES_DENY)
{
// Inform modules that a module blocked the mssage.
// Inform modules that a module blocked the message.
FOREACH_MOD(OnUserMessageBlocked, (source, msgtarget, msgdetails));
return false;
}

View File

@ -407,7 +407,7 @@ class CoreModStats : public Module
void ReadConfig(ConfigStatus& status) override
{
auto security = ServerInstance->Config->ConfValue("security");
cmd.userstats = security->getString("userstats");
cmd.userstats = security->getString("userstats", "Pu");
}
};

View File

@ -38,7 +38,7 @@
* the best way to write hash functions to hash irc
* nicknames, channels etc.
* We are lucky as C++ developers as unordered_map does
* a lot of this for us. It does intellegent memory
* a lot of this for us. It does intelligent memory
* requests, bucketing, search functions, insertion
* and deletion etc. All we have to do is write some
* overloaded comparison and hash value operators which
@ -48,7 +48,7 @@
* Case insensitivity: The hash_map will be case
* insensitive.
*
* Scandanavian Comparisons: The characters [, ], \ will
* Scandinavian Comparisons: The characters [, ], \ will
* be considered the lowercase of {, } and |.
*
******************************************************/

View File

@ -52,7 +52,6 @@ Module::Module(int mprops, const std::string& mdesc)
{
}
// These declarations define the behavours of the base class Module (which does nothing at all)
Cullable::Result Module::Cull()
{
if (ModuleDLLManager)
@ -317,17 +316,17 @@ swap_now:
if (prioritizationState == PRIO_STATE_LAST)
prioritizationState = PRIO_STATE_AGAIN;
/* Suggestion from Phoenix, "shuffle" the modules to better retain call order */
int incrmnt = 1;
int increment = 1;
if (my_pos > swap_pos)
incrmnt = -1;
increment = -1;
for (size_t j = my_pos; j != swap_pos; j += incrmnt)
for (size_t j = my_pos; j != swap_pos; j += increment)
{
if ((j + incrmnt > EventHandlers[i].size() - 1) || ((incrmnt == -1) && (j == 0)))
if ((j + increment > EventHandlers[i].size() - 1) || ((increment == -1) && (j == 0)))
continue;
std::swap(EventHandlers[i][j], EventHandlers[i][j+incrmnt]);
std::swap(EventHandlers[i][j], EventHandlers[i][j+increment]);
}
}
@ -448,7 +447,7 @@ void ModuleManager::UnloadAll()
{
/* We do this more than once, so that any service providers get a
* chance to be unhooked by the modules using them, but then get
* a chance to be removed themsleves.
* a chance to be removed themselves.
*
* Note: this deliberately does NOT delete the DLLManager objects
*/

View File

@ -56,9 +56,9 @@
/* THE NONBLOCKING MYSQL API!
*
* MySQL provides no nonblocking (asyncronous) API of its own, and its developers recommend
* MySQL provides no nonblocking (asynchronous) API of its own, and its developers recommend
* that instead, you should thread your program. This is what i've done here to allow for
* asyncronous SQL requests via mysql. The way this works is as follows:
* asynchronous SQL requests via mysql. The way this works is as follows:
*
* The module spawns a thread via class Thread, and performs its mysql queries in this thread,
* using a queue with priorities. There is a mutex on either end which prevents two threads
@ -81,7 +81,7 @@
* threadsafe. This module is designed to be threadsafe and is careful with its use of threads,
* however, if we were to call a module's OnRequest even from within a thread which was not the
* one the module was originally instantiated upon, there is a chance of all hell breaking loose
* if a module is ever put in a re-enterant state (stack corruption could occur, crashes, data
* if a module is ever put in a reentrant state (stack corruption could occur, crashes, data
* corruption, and worse, so DONT think about it until the day comes when InspIRCd is 100%
* guaranteed threadsafe!)
*/

View File

@ -93,7 +93,7 @@ struct QueueItem
/** PgSQLresult is a subclass of the mostly-pure-virtual class SQLresult.
* All SQL providers must create their own subclass and define it's methods using that
* database library's data retriveal functions. The aim is to avoid a slow and inefficient process
* database library's data retrieval functions. The aim is to avoid a slow and inefficient process
* of converting all data to a common format before it reaches the result structure. This way
* data is passes to the module nearly as directly as if it was using the API directly itself.
*/

View File

@ -662,7 +662,7 @@ class GnuTLSIOHook : public SSLIOHook
}
else
{
// Change the seesion state
// Change the session state
this->status = ISSL_HANDSHAKEN;
VerifyCertificate();

View File

@ -534,7 +534,7 @@ class mbedTLSIOHook : public SSLIOHook
int ret = mbedtls_ssl_handshake(&sess);
if (ret == 0)
{
// Change the seesion state
// Change the session state
this->status = ISSL_HANDSHAKEN;
VerifyCertificate();

View File

@ -286,7 +286,7 @@ namespace OpenSSL
/** OpenSSL makes us have two contexts, one for servers and one for clients
*/
Context ctx;
Context clictx;
Context clientctx;
/** Digest to use when generating fingerprints
*/
@ -352,11 +352,11 @@ namespace OpenSSL
: name(profilename)
, dh(ServerInstance->Config->Paths.PrependConfig(tag->getString("dhfile", "dhparams.pem", 1)))
, ctx(SSL_CTX_new(SSLv23_server_method()))
, clictx(SSL_CTX_new(SSLv23_client_method()))
, clientctx(SSL_CTX_new(SSLv23_client_method()))
, allowrenego(tag->getBool("renegotiation")) // Disallow by default
, outrecsize(static_cast<unsigned int>(tag->getUInt("outrecsize", 2048, 512, 16384)))
{
if ((!ctx.SetDH(dh)) || (!clictx.SetDH(dh)))
if ((!ctx.SetDH(dh)) || (!clientctx.SetDH(dh)))
throw Exception("Couldn't set DH parameters");
const std::string hash = tag->getString("hash", "sha256", 1);
@ -367,7 +367,7 @@ namespace OpenSSL
const std::string ciphers = tag->getString("ciphers");
if (!ciphers.empty())
{
if ((!ctx.SetCiphers(ciphers)) || (!clictx.SetCiphers(ciphers)))
if ((!ctx.SetCiphers(ciphers)) || (!clientctx.SetCiphers(ciphers)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't set cipher list to \"" + ciphers + "\" " + lasterr);
@ -378,7 +378,7 @@ namespace OpenSSL
if (!ciphers.empty())
{
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
if ((!ctx.SetCiphersuites(ciphersuites)) || (!clictx.SetCiphersuites(ciphersuites)))
if ((!ctx.SetCiphersuites(ciphersuites)) || (!clientctx.SetCiphersuites(ciphersuites)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't set ciphersuite list to \"" + ciphersuites + "\" " + lasterr);
@ -395,20 +395,20 @@ namespace OpenSSL
#endif
SetContextOptions("server", tag, ctx);
SetContextOptions("client", tag, clictx);
SetContextOptions("client", tag, clientctx);
/* Load our keys and certificates
* NOTE: OpenSSL's error logging API sucks, don't blame us for this clusterfuck.
*/
std::string filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("certfile", "cert.pem", 1));
if ((!ctx.SetCerts(filename)) || (!clictx.SetCerts(filename)))
if ((!ctx.SetCerts(filename)) || (!clientctx.SetCerts(filename)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't read certificate file: " + lasterr);
}
filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("keyfile", "key.pem", 1));
if ((!ctx.SetPrivateKey(filename)) || (!clictx.SetPrivateKey(filename)))
if ((!ctx.SetPrivateKey(filename)) || (!clientctx.SetPrivateKey(filename)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't read key file: " + lasterr);
@ -416,7 +416,7 @@ namespace OpenSSL
// Load the CAs we trust
filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("cafile", "ca.pem", 1));
if ((!ctx.SetCA(filename)) || (!clictx.SetCA(filename)))
if ((!ctx.SetCA(filename)) || (!clientctx.SetCA(filename)))
{
ERR_print_errors_cb(error_callback, this);
ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Can't read CA list from %s. This is only a problem if you want to verify client certificates, otherwise it's safe to ignore this message. Error: %s", filename.c_str(), lasterr.c_str());
@ -428,14 +428,14 @@ namespace OpenSSL
const std::string crlmode = tag->getString("crlmode", "chain", 1);
ctx.SetCRL(crlfile, crlpath, crlmode);
clictx.SetVerifyCert();
clientctx.SetVerifyCert();
if (tag->getBool("requestclientcert", true))
ctx.SetVerifyCert();
}
const std::string& GetName() const { return name; }
SSL* CreateServerSession() { return ctx.CreateServerSession(); }
SSL* CreateClientSession() { return clictx.CreateClientSession(); }
SSL* CreateClientSession() { return clientctx.CreateClientSession(); }
const EVP_MD* GetDigest() { return digest; }
bool AllowRenegotiation() const { return allowrenego; }
unsigned int GetOutgoingRecordSize() const { return outrecsize; }

View File

@ -12,7 +12,7 @@
* Copyright (C) 2006-2008 Robin Burchell <robin+git@viroteck.net>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
* reditargchanstribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
@ -164,11 +164,8 @@ class CommandCheck : public Command
if (parameters.size() > 1 && !irc::equals(parameters[1], ServerInstance->Config->ServerName))
return CmdResult::SUCCESS;
User *targuser;
Channel *targchan;
targuser = ServerInstance->Users.Find(parameters[0]);
targchan = ServerInstance->Channels.Find(parameters[0]);
User* targetuser = ServerInstance->Users.Find(parameters[0]);
Channel* targchan = ServerInstance->Channels.Find(parameters[0]);
/*
* Syntax of a /check reply:
@ -180,40 +177,40 @@ class CommandCheck : public Command
// Constructor sends START, destructor sends END
CheckContext context(user, parameters[0]);
if (targuser)
if (targetuser)
{
LocalUser* loctarg = IS_LOCAL(targuser);
LocalUser* loctarg = IS_LOCAL(targetuser);
/* /check on a user */
context.Write("nuh", targuser->GetFullHost());
context.Write("realnuh", targuser->GetFullRealHost());
context.Write("realname", targuser->GetRealName());
context.Write("modes", targuser->GetModeLetters());
context.Write("snomasks", GetSnomasks(targuser));
context.Write("server", targuser->server->GetName());
context.Write("uid", targuser->uuid);
context.Write("signon", targuser->signon);
context.Write("nickts", targuser->age);
context.Write("nuh", targetuser->GetFullHost());
context.Write("realnuh", targetuser->GetFullRealHost());
context.Write("realname", targetuser->GetRealName());
context.Write("modes", targetuser->GetModeLetters());
context.Write("snomasks", GetSnomasks(targetuser));
context.Write("server", targetuser->server->GetName());
context.Write("uid", targetuser->uuid);
context.Write("signon", targetuser->signon);
context.Write("nickts", targetuser->age);
if (loctarg)
context.Write("lastmsg", loctarg->idle_lastmsg);
if (targuser->IsAway())
if (targetuser->IsAway())
{
/* user is away */
context.Write("awaytime", targuser->awaytime);
context.Write("awaymsg", targuser->awaymsg);
context.Write("awaytime", targetuser->awaytime);
context.Write("awaymsg", targetuser->awaymsg);
}
if (targuser->IsOper())
if (targetuser->IsOper())
{
/* user is an oper of type ____ */
context.Write("opertype", targuser->oper->name);
context.Write("opertype", targetuser->oper->name);
if (loctarg)
{
context.Write("chanmodeperms", GetAllowedOperOnlyModes(loctarg, MODETYPE_CHANNEL));
context.Write("usermodeperms", GetAllowedOperOnlyModes(loctarg, MODETYPE_USER));
context.Write("snomaskperms", GetAllowedOperOnlySnomasks(loctarg));
context.Write("commandperms", targuser->oper->AllowedOperCommands.ToString());
context.Write("permissions", targuser->oper->AllowedPrivs.ToString());
context.Write("commandperms", targetuser->oper->AllowedOperCommands.ToString());
context.Write("permissions", targetuser->oper->AllowedPrivs.ToString());
}
}
@ -229,14 +226,14 @@ class CommandCheck : public Command
context.Write("exempt", loctarg->exempt ? "yes" : "no");
}
else
context.Write("onip", targuser->GetIPString());
context.Write("onip", targetuser->GetIPString());
CheckContext::List chanlist(context, "onchans");
for (const auto* memb : targuser->chans)
for (const auto* memb : targetuser->chans)
chanlist.Add(memb->GetAllPrefixChars() + memb->chan->name);
chanlist.Flush();
context.DumpExt(targuser);
context.DumpExt(targetuser);
}
else if (targchan)
{

View File

@ -36,14 +36,14 @@ class ModuleCommonChans
if (target.type != MessageTarget::TYPE_USER)
return MOD_RES_PASSTHRU;
User* targuser = target.Get<User>();
if (!targuser->IsModeSet(mode) || user->SharesChannelWith(targuser))
User* targetuser = target.Get<User>();
if (!targetuser->IsModeSet(mode) || user->SharesChannelWith(targetuser))
return MOD_RES_PASSTHRU;
if (user->HasPrivPermission("users/ignore-commonchans") || user->server->IsService())
return MOD_RES_PASSTHRU;
user->WriteNumeric(Numerics::CannotSendTo(targuser, "messages", &mode));
user->WriteNumeric(Numerics::CannotSendTo(targetuser, "messages", &mode));
return MOD_RES_DENY;
}

View File

@ -165,8 +165,8 @@ ModResult ModuleDelayJoin::OnWhoLine(const Who::Request& request, LocalUser* sou
if (!memb || !unjoined.Get(memb))
return MOD_RES_PASSTHRU;
// Only show delayjoined users if the d flag has been specified.
if (!request.flags['d'])
// Only show delayjoined users to others if the d flag has been specified.
if (source != user && !request.flags['d'])
return MOD_RES_DENY;
// Add the < flag to mark the user as delayjoined.

View File

@ -546,7 +546,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params&
parameters[parting ? 1 : 0] = "Reason filtered";
/* We're warning or blocking, OR they're quitting and its a KILL action
* (we cant kill someone whos already quitting, so filter them anyway)
* (we cant kill someone who's already quitting, so filter them anyway)
*/
if ((f->action == FA_WARN) || (f->action == FA_BLOCK) || (((!parting) && (f->action == FA_KILL))) || (f->action == FA_SILENT))
{

View File

@ -28,13 +28,13 @@
enum
{
// Either the ident looup has not started yet or the user is registered.
// Either the ident lookup has not started yet or the user is registered.
IDENT_UNKNOWN = 0,
// Ident lookups are not enabled and a user has been marked as being skipped.
IDENT_SKIPPED,
// Ident looups are not enabled and a user has been an insecure ident prefix.
// Ident lookups are not enabled and a user has been an insecure ident prefix.
IDENT_PREFIXED,
// An ident lookup was done and an ident was found.
@ -56,7 +56,7 @@ enum
* nasty race conditions that would cause segfaults etc) we have
* rewritten this module to use a simplified socket object based
* directly off EventHandler. As EventHandler only has low level
* readability, writeability and error events tied directly to the
* readability, writability and error events tied directly to the
* socket engine, this makes our lives easier as nothing happens to
* our ident lookup class that is outside of this module, or out-
* side of the control of the class. There are no timers, internal
@ -74,11 +74,11 @@ enum
* itself.
*
* O Closure of the ident socket with the Close() method will
* not cause removal of the socket from memory or detatchment
* not cause removal of the socket from memory or detachment
* from its 'parent' User class. It will only flag it as an
* inactive socket in the socket engine.
*
* O Timeouts are handled in OnCheckReaady at the same time as
* O Timeouts are handled in OnCheckReady at the same time as
* checking if the ident socket has a result. This is done
* by checking if the age the of the class (its instantiation
* time) plus the timeout value is greater than the current time.

View File

@ -155,7 +155,7 @@ private:
{
if (f->addmessage(user, weight))
{
/* Youre outttta here! */
/* You're outttta here! */
f->clear(user);
if (f->ban)
{

View File

@ -87,7 +87,13 @@ class ModulePasswordHash : public Module
{
}
ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) override
void ReadConfig(ConfigStatus& status) override
{
auto tag = ServerInstance->Config->ConfValue("mkpasswd");
cmd.access_needed = tag->getBool("operonly") ? CmdAccess::OPERATOR : CmdAccess::NORMAL;
}
ModResult OnPassCompare(Extensible* ex, const std::string& data, const std::string& input, const std::string& hashtype) override
{
if (!hashtype.compare(0, 5, "hmac-", 5))
{

View File

@ -261,15 +261,15 @@ class ModuleServicesAccount
}
case MessageTarget::TYPE_USER:
{
User* targuser = target.Get<User>();
if (!targuser->IsModeSet(regdeafmode) || is_registered)
User* targetuser = target.Get<User>();
if (!targetuser->IsModeSet(regdeafmode) || is_registered)
return MOD_RES_PASSTHRU;
if (calleridapi && calleridapi->IsOnAcceptList(user, targuser))
if (calleridapi && calleridapi->IsOnAcceptList(user, targetuser))
return MOD_RES_PASSTHRU;
// User is messaging a +R user and is not registered or on an accept list.
user->WriteNumeric(ERR_NEEDREGGEDNICK, targuser->nick, "You need to be identified to a registered account to message this user");
user->WriteNumeric(ERR_NEEDREGGEDNICK, targetuser->nick, "You need to be identified to a registered account to message this user");
return MOD_RES_DENY;
}
case MessageTarget::TYPE_SERVER:

View File

@ -172,9 +172,9 @@ class SilenceEntry
out.push_back('P');
if (flags & SF_PRIVMSG_CHANNEL)
out.push_back('p');
if (flags & SF_TAGMSG_CHANNEL)
out.push_back('T');
if (flags & SF_TAGMSG_USER)
out.push_back('T');
if (flags & SF_TAGMSG_CHANNEL)
out.push_back('t');
if (flags & SF_EXEMPT)
out.push_back('x');

View File

@ -54,7 +54,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
* When two sides of a split heal and this occurs, the following things
* will happen:
*
* If the timestamps are exactly equal, both sides merge their privilages
* If the timestamps are exactly equal, both sides merge their privileges
* and users, as in InspIRCd 1.0 and ircd2.8. The channels have not been
* re-created during a split, this is safe to do.
*
@ -80,7 +80,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
* [[<modes>,]<uuid>[:<membid>]
* <modes> is a concatenation of the mode letters the user has on the channel
* (e.g.: "ov" if the user is opped and voiced). The order of the mode letters
* are not important but if a server ecounters an unknown mode letter, it will
* are not important but if a server encounters an unknown mode letter, it will
* drop the link to avoid desync.
*
* InspIRCd 2.0 and older required a comma before the uuid even if the user

View File

@ -50,7 +50,7 @@ CmdResult CommandFTopic::Handle(User* user, Params& params)
/*
* If the topics were updated at the exact same second, accept
* the remote only when it's "bigger" than ours as defined by
* string comparison, so non-empty topics always overridde
* string comparison, so non-empty topics always override
* empty topics if their timestamps are equal
*
* Similarly, if the topic texts are equal too, keep one topic

View File

@ -34,7 +34,7 @@
/*
* The server list in InspIRCd is maintained as two structures
* which hold the data in different ways. Most of the time, we
* want to very quicky obtain three pieces of information:
* want to very quickly obtain three pieces of information:
*
* (1) The information on a server
* (2) The information on the server we must send data through

View File

@ -385,7 +385,23 @@ class ModuleSSLInfo
for (const auto& [_, ifo] : ServerInstance->Config->oper_blocks)
{
std::string fp = ifo->oper_block->getString("fingerprint");
if (MatchFP(cert, fp) && ifo->oper_block->getBool("autologin"))
if (!MatchFP(cert, fp))
continue;
bool do_login = false;
const std::string autologin = ifo->oper_block->getString("autologin");
if (stdalgo::string::equalsci(autologin, "if-host-match"))
{
const std::string& userHost = localuser->MakeHost();
const std::string& userIP = localuser->MakeHostIP();
do_login = InspIRCd::MatchMask(ifo->oper_block->getString("host"), userHost, userIP);
}
else if (ifo->oper_block->getBool("autologin"))
{
do_login = true;
}
if (do_login)
user->Oper(ifo);
}
}

View File

@ -1165,7 +1165,7 @@ void LocalUser::SetClass(const std::string &explicit_name)
continue;
}
/* we stop at the first class that meets ALL critera. */
/* we stop at the first class that meets ALL criteria. */
ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is suitable for %s (%s)",
c->GetName().c_str(), this->uuid.c_str(), this->GetFullRealHost().c_str());
found = c;

View File

@ -165,7 +165,7 @@ void XLineManager::CheckELines()
{
u->exempt = false;
/* This uses safe iteration to ensure that if a line expires here, it doenst trash the iterator */
/* This uses safe iteration to ensure that if a line expires here, it doesn't trash the iterator */
LookupIter safei;
for (LookupIter i = ELines.begin(); i != ELines.end(); )

View File

@ -42,7 +42,7 @@ if (scalar @ARGV < 2) {
STDOUT->autoflush(1);
my $hostip = shift @ARGV;
if ($hostip =~ /[^A-Za-z0-9.:]/) {
if ($hostip =~ /[^A-Za-z0-9.:-]/) {
say STDERR "Error: invalid hostname or IP address: $hostip";
exit 1;
}

View File

@ -385,7 +385,7 @@ Function un.RemoveFromPath
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Uninstall sutff
; Uninstall stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
###########################################
@ -489,15 +489,15 @@ Done:
Exch $R1
FunctionEnd
Function ConditionalAddToRegisty
Function ConditionalAddToRegistry
Pop $0
Pop $1
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
StrCmp "$0" "" ConditionalAddToRegistry_EmptyString
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
"$1" "$0"
;MessageBox MB_OK "Set Registry: '$1' to '$0'"
DetailPrint "Set install registry entry: '$1' to '$0'"
ConditionalAddToRegisty_EmptyString:
ConditionalAddToRegistry_EmptyString:
FunctionEnd
;--------------------------------
@ -647,44 +647,44 @@ Section "-Core installation"
WriteUninstaller "$INSTDIR\Uninstall.exe"
Push "DisplayName"
Push "@CPACK_NSIS_DISPLAY_NAME@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "DisplayVersion"
Push "@CPACK_PACKAGE_VERSION@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "Publisher"
Push "@CPACK_PACKAGE_VENDOR@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "UninstallString"
Push "$INSTDIR\Uninstall.exe"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "NoRepair"
Push "1"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
!ifdef CPACK_NSIS_ADD_REMOVE
;Create add/remove functionality
Push "ModifyPath"
Push "$INSTDIR\AddRemove.exe"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
!else
Push "NoModify"
Push "1"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
!endif
; Optional registration
Push "DisplayIcon"
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "HelpLink"
Push "@CPACK_NSIS_HELP_LINK@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "URLInfoAbout"
Push "@CPACK_NSIS_URL_INFO_ABOUT@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "Contact"
Push "@CPACK_NSIS_CONTACT@"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
@ -702,19 +702,19 @@ Section "-Core installation"
; Write special uninstall registry entries
Push "StartMenu"
Push "$STARTMENU_FOLDER"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "DoNotAddToPath"
Push "$DO_NOT_ADD_TO_PATH"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "AddToPathAllUsers"
Push "$ADD_TO_PATH_ALL_USERS"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "AddToPathCurrentUser"
Push "$ADD_TO_PATH_CURRENT_USER"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
Push "InstallToDesktop"
Push "$INSTALL_DESKTOP"
Call ConditionalAddToRegisty
Call ConditionalAddToRegistry
!insertmacro MUI_STARTMENU_WRITE_END
@ -855,7 +855,7 @@ Section "Uninstall"
@CPACK_NSIS_DELETE_ICONS@
@CPACK_NSIS_DELETE_ICONS_EXTRA@
;Delete empty start menu parent diretories
;Delete empty start menu parent directories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
@ -868,13 +868,13 @@ Section "Uninstall"
StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
; If the user changed the shortcut, then untinstall may not work. This should
; If the user changed the shortcut, then uninstall may not work. This should
; try to fix it.
StrCpy $MUI_TEMP "$START_MENU"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
@CPACK_NSIS_DELETE_ICONS_EXTRA@
;Delete empty start menu parent diretories
;Delete empty start menu parent directories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
secondStartMenuDeleteLoop: