Skip to content

Commit bc59b54

Browse files
committed
Merge remote-tracking branch 'upstream/insp4' into insp4
2 parents 7a45eb7 + c1899f6 commit bc59b54

4 files changed

Lines changed: 33 additions & 21 deletions

File tree

docs/Doxyfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ MARKDOWN_SUPPORT = YES
3737
TOC_INCLUDE_HEADINGS = 5
3838
MARKDOWN_ID_STYLE = GITHUB
3939
AUTOLINK_SUPPORT = YES
40+
AUTOLINK_IGNORE_WORDS =
4041
BUILTIN_STL_SUPPORT = YES
4142
CPP_CLI_SUPPORT = NO
4243
SIP_SUPPORT = NO
@@ -61,6 +62,7 @@ EXTRACT_ANON_NSPACES = NO
6162
RESOLVE_UNNAMED_PARAMS = YES
6263
HIDE_UNDOC_MEMBERS = NO
6364
HIDE_UNDOC_CLASSES = NO
65+
HIDE_UNDOC_NAMESPACES = YES
6466
HIDE_FRIEND_COMPOUNDS = NO
6567
HIDE_IN_BODY_DOCS = NO
6668
INTERNAL_DOCS = NO
@@ -90,13 +92,15 @@ SHOW_NAMESPACES = YES
9092
FILE_VERSION_FILTER =
9193
LAYOUT_FILE =
9294
CITE_BIB_FILES =
95+
EXTERNAL_TOOL_PATH =
9396
QUIET = NO
9497
WARNINGS = NO
9598
WARN_IF_UNDOCUMENTED = NO
9699
WARN_IF_DOC_ERROR = YES
97100
WARN_IF_INCOMPLETE_DOC = YES
98101
WARN_NO_PARAMDOC = NO
99102
WARN_IF_UNDOC_ENUM_VAL = NO
103+
WARN_LAYOUT_FILE = YES
100104
WARN_AS_ERROR = NO
101105
WARN_FORMAT = "$file:$line: $text"
102106
WARN_LINE_FORMAT = "at line $line of file $file"
@@ -121,6 +125,7 @@ FILTER_PATTERNS =
121125
FILTER_SOURCE_FILES = NO
122126
FILTER_SOURCE_PATTERNS =
123127
USE_MDFILE_AS_MAINPAGE = README.md
128+
IMPLICIT_DIR_DOCS = YES
124129
FORTRAN_COMMENT_AFTER = 72
125130
SOURCE_BROWSER = NO
126131
INLINE_SOURCES = NO
@@ -179,6 +184,7 @@ DISABLE_INDEX = NO
179184
GENERATE_TREEVIEW = NO
180185
FULL_SIDEBAR = NO
181186
ENUM_VALUES_PER_LINE = 4
187+
SHOW_ENUM_VALUES = NO
182188
TREEVIEW_WIDTH = 250
183189
EXT_LINKS_IN_WINDOW = NO
184190
OBFUSCATE_EMAILS = YES
@@ -289,6 +295,7 @@ DIAFILE_DIRS =
289295
PLANTUML_JAR_PATH =
290296
PLANTUML_CFG_FILE =
291297
PLANTUML_INCLUDE_PATH =
298+
PLANTUMLFILE_DIRS =
292299
DOT_GRAPH_MAX_NODES = 50
293300
MAX_DOT_GRAPH_DEPTH = 0
294301
DOT_MULTI_TARGETS = NO

src/configreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ServerConfig::ServerLimits::ServerLimits(const std::shared_ptr<ConfigTag>& tag)
5252
, MaxKick(tag->getNum<size_t>("maxkick", 300, 1, MaxLine))
5353
, MaxReal(tag->getNum<size_t>("maxreal", 130, 1, MaxLine))
5454
, MaxAway(tag->getNum<size_t>("maxaway", 200, 1, MaxLine))
55-
, MaxHost(tag->getNum<size_t>("maxhost", 64, 1, MaxLine))
55+
, MaxHost(tag->getNum<size_t>("maxhost", 64, 45, MaxLine))
5656
{
5757
}
5858

src/helperfuncs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ bool InspIRCd::DefaultIsNick(const std::string_view& n)
277277
/* return true for good username, false else */
278278
bool InspIRCd::DefaultIsUser(const std::string_view& n)
279279
{
280-
if (n.empty())
280+
if (n.empty() || n.length() > ServerInstance->Config->Limits.MaxUser)
281281
return false;
282282

283283
for (const auto chr : n)

src/users.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -901,26 +901,28 @@ bool User::SharesChannelWith(User* other) const
901901

902902
void User::ChangeRealName(const std::string& real)
903903
{
904-
if (!this->realname.compare(real))
904+
const auto treal = real.substr(0, ServerInstance->Config->Limits.MaxReal);
905+
if (!this->realname.compare(treal))
905906
return;
906907

907-
FOREACH_MOD(OnChangeRealName, (this, real));
908+
FOREACH_MOD(OnChangeRealName, (this, treal));
908909

909-
this->realname.assign(real, 0, ServerInstance->Config->Limits.MaxReal);
910+
this->realname.assign(treal);
910911
this->realname.shrink_to_fit();
911912
}
912913

913914
void User::ChangeDisplayedHost(const std::string& newhost)
914915
{
915-
if (GetDisplayedHost() == newhost)
916+
const auto tnewhost = newhost.substr(0, ServerInstance->Config->Limits.MaxHost);
917+
if (GetDisplayedHost() == tnewhost)
916918
return;
917919

918-
FOREACH_MOD(OnChangeHost, (this, newhost));
920+
FOREACH_MOD(OnChangeHost, (this, tnewhost));
919921

920-
if (realhost == newhost)
922+
if (realhost == tnewhost)
921923
this->displayhost.clear();
922924
else
923-
this->displayhost.assign(newhost, 0, ServerInstance->Config->Limits.MaxHost);
925+
this->displayhost.assign(tnewhost);
924926
this->displayhost.shrink_to_fit();
925927

926928
this->InvalidateCache();
@@ -933,7 +935,8 @@ void User::ChangeRealHost(const std::string& newhost, bool resetdisplay)
933935
{
934936
// If the real host is the new host and we are not resetting the
935937
// display host then we have nothing to do.
936-
const bool changehost = (realhost != newhost);
938+
const auto tnewhost = newhost.substr(0, ServerInstance->Config->Limits.MaxHost);
939+
const bool changehost = (realhost != tnewhost);
937940
if (!changehost && !resetdisplay)
938941
return;
939942

@@ -944,7 +947,7 @@ void User::ChangeRealHost(const std::string& newhost, bool resetdisplay)
944947

945948
// If the displayhost is the new host or we are resetting it then
946949
// we clear its contents to save memory.
947-
else if (displayhost == newhost || resetdisplay)
950+
else if (displayhost == tnewhost || resetdisplay)
948951
displayhost.clear();
949952

950953
// If we are just resetting the display host then we don't need to
@@ -958,9 +961,9 @@ void User::ChangeRealHost(const std::string& newhost, bool resetdisplay)
958961
// Don't call the OnChangeRealHost event when initialising a user.
959962
const bool initializing = realhost.empty();
960963
if (!initializing)
961-
FOREACH_MOD(OnChangeRealHost, (this, newhost));
964+
FOREACH_MOD(OnChangeRealHost, (this, tnewhost));
962965

963-
realhost = newhost;
966+
realhost = tnewhost;
964967
realhost.shrink_to_fit();
965968

966969
this->InvalidateCache();
@@ -974,7 +977,8 @@ void User::ChangeRealUser(const std::string& newuser, bool resetdisplay)
974977
{
975978
// If the real user is the new user and we are not resetting the
976979
// display user then we have nothing to do.
977-
const bool changeuser = (realuser != newuser);
980+
const auto tnewuser = newuser.substr(0, ServerInstance->Config->Limits.MaxUser);
981+
const bool changeuser = (realuser != tnewuser);
978982
if (!changeuser && !resetdisplay)
979983
return;
980984

@@ -985,7 +989,7 @@ void User::ChangeRealUser(const std::string& newuser, bool resetdisplay)
985989

986990
// If the displayuser is the new user or we are resetting it then
987991
// we clear its contents to save memory.
988-
else if (displayuser == newuser || resetdisplay)
992+
else if (displayuser == tnewuser || resetdisplay)
989993
displayuser.clear();
990994

991995
// If we are just resetting the display user then we don't need to
@@ -996,9 +1000,9 @@ void User::ChangeRealUser(const std::string& newuser, bool resetdisplay)
9961000
// Don't call the OnChangeRealUser event when initialising a user.
9971001
const bool initializing = realuser.empty();
9981002
if (!initializing)
999-
FOREACH_MOD(OnChangeRealUser, (this, newuser));
1003+
FOREACH_MOD(OnChangeRealUser, (this, tnewuser));
10001004

1001-
realuser = newuser;
1005+
realuser = tnewuser;
10021006
realuser.shrink_to_fit();
10031007

10041008
this->InvalidateCache();
@@ -1010,15 +1014,16 @@ void User::ChangeRealUser(const std::string& newuser, bool resetdisplay)
10101014

10111015
void User::ChangeDisplayedUser(const std::string& newuser)
10121016
{
1013-
if (GetDisplayedUser() == newuser)
1017+
const auto tnewuser = newuser.substr(0, ServerInstance->Config->Limits.MaxUser);
1018+
if (GetDisplayedUser() == tnewuser)
10141019
return;
10151020

1016-
FOREACH_MOD(OnChangeUser, (this, newuser));
1021+
FOREACH_MOD(OnChangeUser, (this, tnewuser));
10171022

1018-
if (realuser == newuser)
1023+
if (realuser == tnewuser)
10191024
this->displayuser.clear();
10201025
else
1021-
this->displayuser.assign(newuser, 0, ServerInstance->Config->Limits.MaxUser);
1026+
this->displayuser.assign(tnewuser);
10221027
this->displayuser.shrink_to_fit();
10231028

10241029
this->InvalidateCache();

0 commit comments

Comments
 (0)