Skip to content

Commit 6e12ccc

Browse files
committed
Merge remote-tracking branch 'upstream/insp4' into insp4
2 parents 510cc90 + 236e830 commit 6e12ccc

3 files changed

Lines changed: 37 additions & 45 deletions

File tree

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Supported Versions
44

5-
Currently the v3 (old stable) and v4 (stable) branches are actively receiving security fixes. Support for v3 has ended as of 2026-01-01.
5+
Currently the v4 (stable) branch is actively receiving security fixes. Support for the v3 branch has ended as of 2026-01-01.
66

77
The v5 branch is still early in development and only receives security fixes when they are synced from the v4 branch.
88

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
InspIRCd is a modular C++ Internet Relay Chat (IRC) server for UNIX-like and Windows systems.
44

5-
**IMPORTANT** InspIRCd v3 is no longer maintained. Please upgrade as soon as possible.
6-
75
## Supported Platforms
86

97
InspIRCd is supported on the following platforms:

src/modules/m_sslmodes.cpp

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -74,61 +74,44 @@ class SSLMode final
7474
: public ModeHandler
7575
{
7676
private:
77-
UserCertificateAPI& API;
77+
UserCertificateAPI& sslapi;
7878

7979
public:
8080
SSLMode(Module* Creator, UserCertificateAPI& api)
8181
: ModeHandler(Creator, "sslonly", 'z', PARAM_NONE, MODETYPE_CHANNEL)
82-
, API(api)
82+
, sslapi(api)
8383
{
8484
}
8585

8686
bool OnModeChange(User* source, User* dest, Channel* channel, Modes::Change& change) override
8787
{
88-
if (change.adding)
88+
if (change.adding == dest->IsModeSet(this))
89+
return false;
90+
91+
if (change.adding && IS_LOCAL(source))
8992
{
90-
if (!channel->IsModeSet(this))
93+
if (!sslapi)
9194
{
92-
if (IS_LOCAL(source))
93-
{
94-
if (!API)
95-
{
96-
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, "Unable to determine whether all members of the channel are connected via TLS");
97-
return false;
98-
}
99-
100-
size_t nonssl = 0;
101-
for (const auto& [u, _] : channel->GetUsers())
102-
{
103-
if (!API->IsSecure(u) && !u->server->IsService())
104-
nonssl++;
105-
}
106-
107-
if (nonssl)
108-
{
109-
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, INSP_FORMAT("All members of the channel must be connected via TLS ({}/{} are non-TLS)",
110-
nonssl, channel->GetUsers().size()));
111-
return false;
112-
}
113-
}
114-
channel->SetMode(this, true);
115-
return true;
95+
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, "Unable to determine whether all members of the channel are connected using TLS");
96+
return false;
11697
}
117-
else
98+
99+
size_t nonssl = 0;
100+
for (const auto& [u, _] : channel->GetUsers())
118101
{
119-
return false;
102+
if (!sslapi->IsSecure(u) && !u->server->IsService())
103+
nonssl++;
120104
}
121-
}
122-
else
123-
{
124-
if (channel->IsModeSet(this))
105+
if (nonssl)
125106
{
126-
channel->SetMode(this, false);
127-
return true;
107+
source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, INSP_FORMAT("All members of the channel must be connected using TLS ({}/{} are non-TLS)",
108+
nonssl, channel->GetUsers().size()));
109+
return false;
128110
}
129-
130-
return false;
131111
}
112+
113+
channel->SetMode(this, change.adding);
114+
return true;
132115
}
133116
};
134117

@@ -138,12 +121,12 @@ class SSLModeUser final
138121
: public ModeHandler
139122
{
140123
private:
141-
UserCertificateAPI& API;
124+
UserCertificateAPI& sslapi;
142125

143126
public:
144127
SSLModeUser(Module* Creator, UserCertificateAPI& api)
145128
: ModeHandler(Creator, "sslqueries", 'z', PARAM_NONE, MODETYPE_USER)
146-
, API(api)
129+
, sslapi(api)
147130
{
148131
}
149132

@@ -152,8 +135,19 @@ class SSLModeUser final
152135
if (change.adding == dest->IsModeSet(this))
153136
return false;
154137

155-
if (change.adding && IS_LOCAL(user) && (!API || !API->IsSecure(user)))
156-
return false;
138+
if (change.adding && IS_LOCAL(user))
139+
{
140+
if (!sslapi)
141+
{
142+
user->WriteNumeric(ERR_ALLMUSTSSL, dest->nick, INSP_FORMAT("Unable to determine whether {} is connected with TLS", dest->nick));
143+
return false;
144+
}
145+
if (!sslapi->IsSecure(dest))
146+
{
147+
user->WriteNumeric(ERR_ALLMUSTSSL, dest->nick, INSP_FORMAT("{} is not connected using TLS", dest->nick));
148+
return false;
149+
}
150+
}
157151

158152
dest->SetMode(this, change.adding);
159153
return true;

0 commit comments

Comments
 (0)