Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2021-06-01 01:46:53 +01:00
commit 7f88bd76c9
8 changed files with 63 additions and 26 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
github:
- SadieCat

View File

@ -327,7 +327,7 @@ for my $mod (sort keys %todo) {
}
$mod_versions{$mod} = $ver;
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
my $ua = LWP::UserAgent->new;
my $response = $ua->get($url);
if ($response->is_success) {

View File

@ -198,7 +198,7 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned
WhoisContextImpl whois(user, dest, lineevprov);
whois.SendLine(RPL_WHOISUSER, dest->ident, dest->GetDisplayedHost(), '*', dest->GetRealName());
if (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex"))
if (!dest->server->IsService() && (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex")))
{
whois.SendLine(RPL_WHOISHOST, InspIRCd::Format("is connecting from %s@%s %s", dest->ident.c_str(), dest->GetRealHost().c_str(), dest->GetIPString().c_str()));
}

View File

@ -588,9 +588,10 @@ void ModuleManager::AddService(ServiceProvider& item)
std::string::size_type slash = item.name.find('/');
if (slash != std::string::npos)
{
// Also register foo/bar as foo.
DataProviders.emplace(item.name.substr(0, slash), &item);
DataProviders.emplace(item.name.substr(slash + 1), &item);
}
dynamic_reference_base::reset_all();
break;
}

View File

@ -167,10 +167,20 @@ namespace OpenSSL
bool SetCiphers(const std::string& ciphers)
{
// TLSv1 to TLSv1.2 ciphers.
ERR_clear_error();
return SSL_CTX_set_cipher_list(ctx, ciphers.c_str());
}
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
bool SetCiphersuites(const std::string& ciphers)
{
// TLSv1.3+ ciphers.
ERR_clear_error();
return SSL_CTX_set_ciphersuites(ctx, ciphers.c_str());
}
#endif
bool SetCerts(const std::string& filename)
{
ERR_clear_error();
@ -354,7 +364,7 @@ namespace OpenSSL
if (digest == NULL)
throw Exception("Unknown hash type " + hash);
std::string ciphers = tag->getString("ciphers");
const std::string ciphers = tag->getString("ciphers");
if (!ciphers.empty())
{
if ((!ctx.SetCiphers(ciphers)) || (!clictx.SetCiphers(ciphers)))
@ -364,6 +374,20 @@ namespace OpenSSL
}
}
const std::string ciphersuites = tag->getString("ciphersuites");
if (!ciphers.empty())
{
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
if ((!ctx.SetCiphersuites(ciphersuites)) || (!clictx.SetCiphersuites(ciphersuites)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't set ciphersuite list to \"" + ciphersuites + "\" " + lasterr);
}
#else
ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "You have configured <sslprofile:ciphersuites> but your version of OpenSSL does not support TLSv1.3+");
#endif
}
#ifndef OPENSSL_NO_ECDH
const std::string curvename = tag->getString("ecdhcurve", "prime256v1", 1);
if (!curvename.empty())

View File

@ -28,6 +28,7 @@
#include "modules/ctctags.h"
#include "modules/ircv3_servertime.h"
#include "modules/names.h"
#include "modules/who.h"
class DelayJoinMode : public ModeHandler
{
@ -86,6 +87,7 @@ class ModuleDelayJoin
: public Module
, public CTCTags::EventListener
, public Names::EventListener
, public Who::EventListener
{
private:
IntExtItem unjoined;
@ -110,6 +112,7 @@ class ModuleDelayJoin
: Module(VF_VENDOR, "Adds channel mode D (delayjoin) which hides JOIN messages from users until they speak.")
, CTCTags::EventListener(this)
, Names::EventListener(this)
, Who::EventListener(this)
, unjoined(this, "delayjoin", ExtensionItem::EXT_MEMBERSHIP)
, joinhook(this, unjoined)
, djm(this, unjoined)
@ -117,6 +120,7 @@ class ModuleDelayJoin
}
ModResult OnNamesListItem(LocalUser* issuer, Membership*, std::string& prefixes, std::string& nick) override;
ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) override;
void OnUserJoin(Membership*, bool, bool, CUList&) override;
void CleanUser(User* user);
void OnUserPart(Membership*, std::string &partmessage, CUList&) override;
@ -159,6 +163,23 @@ ModResult ModuleDelayJoin::OnNamesListItem(LocalUser* issuer, Membership* memb,
return MOD_RES_PASSTHRU;
}
ModResult ModuleDelayJoin::OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric)
{
// We don't need to do anything if they're not delayjoined.
if (!memb || !unjoined.Get(memb))
return MOD_RES_PASSTHRU;
// Only show delayjoined users if the d flag has been specified.
if (!request.flags['d'])
return MOD_RES_DENY;
// Add the < flag to mark the user as delayjoined.
size_t flag_index;
if (request.GetFieldIndex('f', flag_index))
numeric.GetParams()[flag_index].push_back('<');
return MOD_RES_PASSTHRU;
}
void ModuleDelayJoin::OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
{
if (memb->chan->IsModeSet(djm))

View File

@ -35,6 +35,8 @@ enum
{
// From UnrealIRCd.
ERR_SECUREONLYCHAN = 489,
// InspIRCd-specific.
ERR_ALLMUSTSSL = 490
};
@ -138,27 +140,14 @@ class SSLModeUser : public ModeHandler
ModeAction OnModeChange(User* user, User* dest, Channel* channel, Modes::Change& change) override
{
if (change.adding)
{
if (!dest->IsModeSet(this))
{
if (!API || !API->GetCertificate(user))
return MODEACTION_DENY;
if (change.adding == dest->IsModeSet(this))
return MODEACTION_DENY;
dest->SetMode(this, true);
return MODEACTION_ALLOW;
}
}
else
{
if (dest->IsModeSet(this))
{
dest->SetMode(this, false);
return MODEACTION_ALLOW;
}
}
if (change.adding && IS_LOCAL(user) && (!API || !API->GetCertificate(user)))
return MODEACTION_DENY;
return MODEACTION_DENY;
dest->SetMode(this, change.adding);
return MODEACTION_ALLOW;
}
};

View File

@ -38,7 +38,7 @@ my $root = dirname $RealDir;
my @compilers = $#ARGV >= 0 ? @ARGV : qw(g++ clang++ icpc);
for my $compiler (@compilers) {
if (system "$compiler -v > /dev/null 2>&1") {
say "Skipping $compiler as it is not installed on this system!";
say STDERR "Skipping $compiler as it is not installed on this system!";
next;
}
$ENV{CXX} = $compiler;
@ -54,11 +54,11 @@ for my $compiler (@compilers) {
push @configure_flags, '--disable-auto-extras';
}
if (execute "$root/configure", '--development', '--socketengine', $socketengine, @configure_flags) {
say "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
say STDERR "Failed to configure using the $compiler compiler and the $socketengine socket engine!";
exit 1;
}
if (execute 'make', '--directory', $root, '--jobs', get_cpu_count() + 1, 'install') {
say "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
say STDERR "Failed to compile using the $compiler compiler and the $socketengine socket engine!";
exit 1;
}
say "Building using the $compiler compiler and the $socketengine socket engine succeeded!";