This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Undernet IRC Server Source Code.".
The branch, u2_10_12_branch has been updated
via 3525ba0c3306b7cf6c551467df5329a469b40f41 (commit)
via 6878a25cfa23f7ee603ec731265d75eb3858203c (commit)
via c38fb6e87c7e86cbd3affcaa2919c95c0b223d12 (commit)
via 88917ff729fd2d72cf6046669386ae69a35666f2 (commit)
via aa4fa7cac116cf04af3da2dde63ebfcf66c6c68a (commit)
via 85c37ef6060b4099ca816e59d030ed503d1abd86 (commit)
from 24532c5f9b69cc5e6da23fecb26463812f4c6d45 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3525ba0c3306b7cf6c551467df5329a469b40f41
Merge: 6878a25c c38fb6e8
Author: Michael Poole <[email protected]>
Date: Sun Jan 19 19:01:29 2025 -0500
Merge pull request #46 from MrIron-no/xflags
Added support for account flags
commit 6878a25cfa23f7ee603ec731265d75eb3858203c
Merge: 24532c5f 85c37ef6
Author: Michael Poole <[email protected]>
Date: Sun Jan 19 18:52:11 2025 -0500
Merge pull request #45 from MrIron-no/username-req
Disable certain username checks per default.
commit c38fb6e87c7e86cbd3affcaa2919c95c0b223d12
Author: Erik Tørrissen <[email protected]>
Date: Mon Jan 13 19:24:43 2025 +0100
Changed datatype of account id and account flags
diff --git a/include/struct.h b/include/struct.h
index bef946fd..78d5f89e 100644
--- a/include/struct.h
+++ b/include/struct.h
@@ -24,6 +24,10 @@
*/
#ifndef INCLUDED_struct_h
#define INCLUDED_struct_h
+#ifndef INCLUDED_stdint_h
+#include <stdint.h>
+#define INCLUDED_stdint_h
+#endif
#ifndef INCLUDED_sys_types_h
#include <sys/types.h> /* time_t */
#define INCLUDED_sys_types_h
@@ -83,8 +87,8 @@ struct User {
char host[HOSTLEN + 1]; /**< displayed hostname */
char realhost[HOSTLEN + 1]; /**< actual hostname */
char account[ACCOUNTLEN + 1]; /**< IRC account name */
- unsigned int acc_id; /**< IRC account id */
- unsigned short int acc_flags; /**< IRC account flags */
+ uint64_t acc_id; /**< IRC account id */
+ uint64_t acc_flags; /**< IRC account flags */
};
#endif /* INCLUDED_struct_h */
diff --git a/ircd/m_account.c b/ircd/m_account.c
index adce5091..0e972112 100644
--- a/ircd/m_account.c
+++ b/ircd/m_account.c
@@ -108,8 +108,7 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
char* parv[])
{
struct Client *acptr;
- unsigned int acc_id = 0;
- unsigned short int acc_flags = 0;
+ uint64_t acc_id = 0, acc_flags = 0;
if (parc < 3)
return need_more_params(sptr, "ACCOUNT");
@@ -137,7 +136,7 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
cli_user(acptr)->acc_id != 0 &&
cli_user(acptr)->acc_id != acc_id)
return protocol_violation(cptr, "ACCOUNT ID for already registered user
%s "
- "(%d -> %d)", cli_name(acptr),
+ "(%qu -> %qu)", cli_name(acptr),
cli_user(acptr)->acc_id, acc_id);
} else {
/* Client did not already have an account. */
@@ -150,7 +149,7 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
if (acc_id) {
cli_user(acptr)->acc_id = acc_id;
Debug((DEBUG_DEBUG, "Received account id: account \"%s\", "
- "id %u", parv[2], cli_user(acptr)->acc_id));
+ "id %qu", parv[2], cli_user(acptr)->acc_id));
}
ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
@@ -163,12 +162,12 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
if (parc > 4) {
cli_user(acptr)->acc_flags = acc_flags;
Debug((DEBUG_DEBUG, "Received account flags: account \"%s\", "
- "flags %u", parv[2], cli_user(acptr)->acc_flags));
+ "flags %qu", parv[2], cli_user(acptr)->acc_flags));
}
/* To propagate a 0 flag, we check the param number rather than whether
acc_flags is true. */
sendcmdto_serv_butone(sptr, CMD_ACCOUNT, cptr,
- cli_user(acptr)->acc_id ? (parc > 4 ? "%C %s %u %u" :
"%C %s %u") : "%C %s",
+ cli_user(acptr)->acc_id ? (parc > 4 ? "%C %s %qu %qu"
: "%C %s %qu") : "%C %s",
acptr, cli_user(acptr)->account,
cli_user(acptr)->acc_id,
cli_user(acptr)->acc_flags);
diff --git a/ircd/s_user.c b/ircd/s_user.c
index eb17c02c..b4f2d783 100644
--- a/ircd/s_user.c
+++ b/ircd/s_user.c
@@ -1151,7 +1151,7 @@ int set_user_mode(struct Client *cptr, struct Client
*sptr, int parc,
len = (id++) - account;
cli_user(sptr)->acc_id = atoi(id);
Debug((DEBUG_DEBUG, "Received account id in user mode; "
- "account \"%s\", id %u", account,
+ "account \"%s\", id %qu", account,
cli_user(sptr)->acc_id));
/* Check for account flags */
@@ -1160,7 +1160,7 @@ int set_user_mode(struct Client *cptr, struct Client
*sptr, int parc,
cli_user(sptr)->acc_flags = atoi(flags + 1);
// Null-terminate the account string before flags.
*flags = '\0';
- Debug((DEBUG_DEBUG, "Received account flags; account \"%s\", flags
%u",
+ Debug((DEBUG_DEBUG, "Received account flags; account \"%s\", flags
%qu",
account, cli_user(sptr)->acc_flags));
}
}
@@ -1235,18 +1235,18 @@ char *umode_str(struct Client *cptr)
if (cli_user(cptr)->acc_id) {
char nbuf[30];
Debug((DEBUG_DEBUG, "Sending account id in user mode for "
- "account \"%s\"; id %u", cli_user(cptr)->account,
+ "account \"%s\"; id %qu", cli_user(cptr)->account,
cli_user(cptr)->acc_id));
if (cli_user(cptr)->acc_flags) {
Debug((DEBUG_DEBUG, "Sending account flags in user mode for "
- "account \"%s\"; flags %u", cli_user(cptr)->account,
+ "account \"%s\"; flags %qu", cli_user(cptr)->account,
cli_user(cptr)->acc_flags));
- ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%u:%u",
+ ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%qu:%qu",
cli_user(cptr)->acc_id, cli_user(cptr)->acc_flags);
} else {
- ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%u",
+ ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%qu",
cli_user(cptr)->acc_id);
}
m--; /* back up over previous nul-termination */
commit 88917ff729fd2d72cf6046669386ae69a35666f2
Author: Erik Tørrissen <[email protected]>
Date: Mon Jan 6 16:36:23 2025 +0100
Fix to send.c to only send capflag messages to from only if capflag
condition is met. Simplification of CAP_ACCOUNTNOTIFY. Use of variables in
acc_flags handling.
diff --git a/ircd/m_account.c b/ircd/m_account.c
index ab166b4f..adce5091 100644
--- a/ircd/m_account.c
+++ b/ircd/m_account.c
@@ -108,6 +108,8 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
char* parv[])
{
struct Client *acptr;
+ unsigned int acc_id = 0;
+ unsigned short int acc_flags = 0;
if (parc < 3)
return need_more_params(sptr, "ACCOUNT");
@@ -119,16 +121,24 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
if (!(acptr = findNUser(parv[1])))
return 0; /* Ignore ACCOUNT for a user that QUIT; probably crossed */
+ if (parc > 3)
+ acc_id = atoi(parv[3]);
+
+ if (parc > 4)
+ acc_flags = atoi(parv[4]);
+
/* If the client already has an account, we do not accept changes to the
account or acc_id. */
if (IsAccount(acptr)) {
if (strcmp(cli_user(acptr)->account, parv[2]))
return protocol_violation(cptr, "ACCOUNT for already registered user %s "
"(%s -> %s)", cli_name(acptr),
cli_user(acptr)->account, parv[2]);
- if (cli_user(acptr)->acc_id != 0 && cli_user(acptr)->acc_id !=
atoi(parv[3]))
+ if (acc_id &&
+ cli_user(acptr)->acc_id != 0 &&
+ cli_user(acptr)->acc_id != acc_id)
return protocol_violation(cptr, "ACCOUNT ID for already registered user
%s "
"(%d -> %d)", cli_name(acptr),
- cli_user(acptr)->acc_id, atoi(parv[3]));
+ cli_user(acptr)->acc_id, acc_id);
} else {
/* Client did not already have an account. */
if (strlen(parv[2]) > ACCOUNTLEN)
@@ -137,8 +147,8 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
"ignoring.",
parv[2], ACCOUNTLEN, cli_name(acptr));
- if (parc > 3) {
- cli_user(acptr)->acc_id = atoi(parv[3]);
+ if (acc_id) {
+ cli_user(acptr)->acc_id = acc_id;
Debug((DEBUG_DEBUG, "Received account id: account \"%s\", "
"id %u", parv[2], cli_user(acptr)->acc_id));
}
@@ -146,15 +156,12 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
hide_hostmask(acptr, FLAG_ACCOUNT);
- sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, acptr,
CAP_ACCOUNTNOTIFY,
+ sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, NULL,
CAP_ACCOUNTNOTIFY,
_CAP_LAST_CAP, "%s", cli_user(acptr)->account);
-
- if (CapHas(cli_active(acptr), CAP_ACCOUNTNOTIFY))
- sendcmdto_one(acptr, CMD_ACCOUNT, cli_from(acptr), "%s",
cli_user(acptr)->account);
}
if (parc > 4) {
- cli_user(acptr)->acc_flags = atoi(parv[4]);
+ cli_user(acptr)->acc_flags = acc_flags;
Debug((DEBUG_DEBUG, "Received account flags: account \"%s\", "
"flags %u", parv[2], cli_user(acptr)->acc_flags));
}
diff --git a/ircd/s_user.c b/ircd/s_user.c
index 725ea8ed..eb17c02c 100644
--- a/ircd/s_user.c
+++ b/ircd/s_user.c
@@ -904,13 +904,13 @@ hide_hostmask(struct Client *cptr, unsigned int flag)
return 0;
sendcmdto_capflag_common_channels_butone(cptr, CMD_QUIT, cptr,
_CAP_LAST_CAP, CAP_CHGHOST, ":Registered");
- sendcmdto_capflag_common_channels_butone(cptr, CMD_CHGHOST, cptr,
CAP_CHGHOST, _CAP_LAST_CAP, "%s %s.%s",
+ sendcmdto_capflag_common_channels_butone(cptr, CMD_CHGHOST, NULL,
CAP_CHGHOST, _CAP_LAST_CAP, "%s %s.%s",
cli_user(cptr)->username, cli_user(cptr)->account,
feature_str(FEAT_HIDDEN_HOST));
ircd_snprintf(0, cli_user(cptr)->host, HOSTLEN, "%s.%s",
cli_user(cptr)->account, feature_str(FEAT_HIDDEN_HOST));
/* ok, the client is now fully hidden, so let them know -- hikari */
- if (MyConnect(cptr))
+ if (MyConnect(cptr) && !CapHas(cli_active(cptr), CAP_CHGHOST))
send_reply(cptr, RPL_HOSTHIDDEN, cli_user(cptr)->host);
/*
diff --git a/ircd/send.c b/ircd/send.c
index 22618105..ca00f016 100644
--- a/ircd/send.c
+++ b/ircd/send.c
@@ -568,7 +568,10 @@ void sendcmdto_capflag_common_channels_butone(struct
Client *from, const char *c
}
}
- if (MyConnect(from) && from != one)
+ if (MyConnect(from)
+ && from != one
+ && (require == _CAP_LAST_CAP || CapHas(cli_active(from), require))
+ && (forbid == _CAP_LAST_CAP || !CapHas(cli_active(from), forbid)))
send_buffer(from, mb, 0);
msgq_clean(mb);
commit aa4fa7cac116cf04af3da2dde63ebfcf66c6c68a
Author: Erik Tørrissen <[email protected]>
Date: Sun Jan 5 10:07:59 2025 +0100
Added new flags param in account messages.
diff --git a/include/struct.h b/include/struct.h
index cd2712c9..bef946fd 100644
--- a/include/struct.h
+++ b/include/struct.h
@@ -83,7 +83,8 @@ struct User {
char host[HOSTLEN + 1]; /**< displayed hostname */
char realhost[HOSTLEN + 1]; /**< actual hostname */
char account[ACCOUNTLEN + 1]; /**< IRC account name */
- time_t acc_create; /**< IRC account timestamp */
+ unsigned int acc_id; /**< IRC account id */
+ unsigned short int acc_flags; /**< IRC account flags */
};
#endif /* INCLUDED_struct_h */
diff --git a/ircd/m_account.c b/ircd/m_account.c
index 26b4783e..ab166b4f 100644
--- a/ircd/m_account.c
+++ b/ircd/m_account.c
@@ -101,6 +101,8 @@
* parv[0] = sender prefix
* parv[1] = numeric of client to act on
* parv[2] = account name (12 characters or less)
+ * parv[3] = account id
+ * parv[4] = account flags
*/
int ms_account(struct Client* cptr, struct Client* sptr, int parc,
char* parv[])
@@ -117,38 +119,52 @@ int ms_account(struct Client* cptr, struct Client* sptr,
int parc,
if (!(acptr = findNUser(parv[1])))
return 0; /* Ignore ACCOUNT for a user that QUIT; probably crossed */
- if (IsAccount(acptr))
- return protocol_violation(cptr, "ACCOUNT for already registered user %s "
- "(%s -> %s)", cli_name(acptr),
- cli_user(acptr)->account, parv[2]);
-
- assert(0 == cli_user(acptr)->account[0]);
-
- if (strlen(parv[2]) > ACCOUNTLEN)
- return protocol_violation(cptr,
- "Received account (%s) longer than %d for %s; "
- "ignoring.",
- parv[2], ACCOUNTLEN, cli_name(acptr));
-
- if (parc > 3) {
- cli_user(acptr)->acc_create = atoi(parv[3]);
- Debug((DEBUG_DEBUG, "Received timestamped account: account \"%s\", "
- "timestamp %Tu", parv[2], cli_user(acptr)->acc_create));
+ /* If the client already has an account, we do not accept changes to the
account or acc_id. */
+ if (IsAccount(acptr)) {
+ if (strcmp(cli_user(acptr)->account, parv[2]))
+ return protocol_violation(cptr, "ACCOUNT for already registered user %s "
+ "(%s -> %s)", cli_name(acptr),
+ cli_user(acptr)->account, parv[2]);
+ if (cli_user(acptr)->acc_id != 0 && cli_user(acptr)->acc_id !=
atoi(parv[3]))
+ return protocol_violation(cptr, "ACCOUNT ID for already registered user
%s "
+ "(%d -> %d)", cli_name(acptr),
+ cli_user(acptr)->acc_id, atoi(parv[3]));
+ } else {
+ /* Client did not already have an account. */
+ if (strlen(parv[2]) > ACCOUNTLEN)
+ return protocol_violation(cptr,
+ "Received account (%s) longer than %d for %s; "
+ "ignoring.",
+ parv[2], ACCOUNTLEN, cli_name(acptr));
+
+ if (parc > 3) {
+ cli_user(acptr)->acc_id = atoi(parv[3]);
+ Debug((DEBUG_DEBUG, "Received account id: account \"%s\", "
+ "id %u", parv[2], cli_user(acptr)->acc_id));
+ }
+
+ ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
+ hide_hostmask(acptr, FLAG_ACCOUNT);
+
+ sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, acptr,
CAP_ACCOUNTNOTIFY,
+ _CAP_LAST_CAP, "%s", cli_user(acptr)->account);
+
+ if (CapHas(cli_active(acptr), CAP_ACCOUNTNOTIFY))
+ sendcmdto_one(acptr, CMD_ACCOUNT, cli_from(acptr), "%s",
cli_user(acptr)->account);
}
- ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN);
- hide_hostmask(acptr, FLAG_ACCOUNT);
+ if (parc > 4) {
+ cli_user(acptr)->acc_flags = atoi(parv[4]);
+ Debug((DEBUG_DEBUG, "Received account flags: account \"%s\", "
+ "flags %u", parv[2], cli_user(acptr)->acc_flags));
+ }
+ /* To propagate a 0 flag, we check the param number rather than whether
acc_flags is true. */
sendcmdto_serv_butone(sptr, CMD_ACCOUNT, cptr,
- cli_user(acptr)->acc_create ? "%C %s %Tu" : "%C %s",
+ cli_user(acptr)->acc_id ? (parc > 4 ? "%C %s %u %u" :
"%C %s %u") : "%C %s",
acptr, cli_user(acptr)->account,
- cli_user(acptr)->acc_create);
-
- sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, acptr,
CAP_ACCOUNTNOTIFY,
- _CAP_LAST_CAP, "%s", cli_user(acptr)->account);
-
- if (CapHas(cli_active(acptr), CAP_ACCOUNTNOTIFY))
- sendcmdto_one(acptr, CMD_ACCOUNT, cli_from(acptr), "%s",
cli_user(acptr)->account);
+ cli_user(acptr)->acc_id,
+ cli_user(acptr)->acc_flags);
return 0;
}
diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 944436f1..640f3f8c 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -2129,11 +2129,18 @@ static int iauth_cmd_done_account(struct IAuth *iauth,
struct Client *cli,
sendto_iauth(cli, "E Invalid :Account parameter too long");
return 0;
}
- /* If account has a creation timestamp, use it. */
+ /* If account has an id, use it. */
assert(cli_user(cli) != NULL);
if (params[0][len] == ':') {
- cli_user(cli)->acc_create = strtoul(params[0] + len + 1, NULL, 10);
+ cli_user(cli)->acc_id = strtoul(params[0] + len + 1, NULL, 10);
params[0][len] = '\0';
+
+ /* If account has flags, use it. */
+ char *flags_start = strchr(params[0] + len + 1, ':');
+ if (flags_start != NULL) {
+ cli_user(cli)->acc_flags = strtoul(flags_start + 1, NULL, 10);
+ *flags_start = '\0';
+ }
}
/* Copy account name to User structure. */
diff --git a/ircd/s_user.c b/ircd/s_user.c
index e70a2ea7..725ea8ed 100644
--- a/ircd/s_user.c
+++ b/ircd/s_user.c
@@ -1146,13 +1146,23 @@ int set_user_mode(struct Client *cptr, struct Client
*sptr, int parc,
*/
if (!FlagHas(&setflags, FLAG_ACCOUNT) && IsAccount(sptr)) {
int len = ACCOUNTLEN;
- char *ts;
- if ((ts = strchr(account, ':'))) {
- len = (ts++) - account;
- cli_user(sptr)->acc_create = atoi(ts);
- Debug((DEBUG_DEBUG, "Received timestamped account in user mode; "
- "account \"%s\", timestamp %Tu", account,
- cli_user(sptr)->acc_create));
+ char *id, *flags;
+ if ((id = strchr(account, ':'))) {
+ len = (id++) - account;
+ cli_user(sptr)->acc_id = atoi(id);
+ Debug((DEBUG_DEBUG, "Received account id in user mode; "
+ "account \"%s\", id %u", account,
+ cli_user(sptr)->acc_id));
+
+ /* Check for account flags */
+ if ((flags = strchr(id, ':'))) {
+ // Parse the flags after the second colon.
+ cli_user(sptr)->acc_flags = atoi(flags + 1);
+ // Null-terminate the account string before flags.
+ *flags = '\0';
+ Debug((DEBUG_DEBUG, "Received account flags; account \"%s\", flags
%u",
+ account, cli_user(sptr)->acc_flags));
+ }
}
ircd_strncpy(cli_user(sptr)->account, account, len);
}
@@ -1222,13 +1232,23 @@ char *umode_str(struct Client *cptr)
while ((*m++ = *t++))
; /* Empty loop */
- if (cli_user(cptr)->acc_create) {
- char nbuf[20];
- Debug((DEBUG_DEBUG, "Sending timestamped account in user mode for "
- "account \"%s\"; timestamp %Tu", cli_user(cptr)->account,
- cli_user(cptr)->acc_create));
- ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%Tu",
- cli_user(cptr)->acc_create);
+ if (cli_user(cptr)->acc_id) {
+ char nbuf[30];
+ Debug((DEBUG_DEBUG, "Sending account id in user mode for "
+ "account \"%s\"; id %u", cli_user(cptr)->account,
+ cli_user(cptr)->acc_id));
+
+ if (cli_user(cptr)->acc_flags) {
+ Debug((DEBUG_DEBUG, "Sending account flags in user mode for "
+ "account \"%s\"; flags %u", cli_user(cptr)->account,
+ cli_user(cptr)->acc_flags));
+
+ ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%u:%u",
+ cli_user(cptr)->acc_id, cli_user(cptr)->acc_flags);
+ } else {
+ ircd_snprintf(0, t = nbuf, sizeof(nbuf), ":%u",
+ cli_user(cptr)->acc_id);
+ }
m--; /* back up over previous nul-termination */
while ((*m++ = *t++))
; /* Empty loop */
commit 85c37ef6060b4099ca816e59d030ed503d1abd86
Author: Erik Tørrissen <[email protected]>
Date: Tue Dec 17 12:26:13 2024 +0100
Disable certain username checks per default.
diff --git a/doc/example.conf b/doc/example.conf
index 8f8a9883..9ebc1634 100644
--- a/doc/example.conf
+++ b/doc/example.conf
@@ -912,6 +912,7 @@ features
# "OPLEVELS" = "FALSE";
# "ZANNELS" = "FALSE";
# "LOCAL_CHANNELS" = "TRUE";
+# "STRICT_USERNAME" = "FALSE";
# "TOPIC_BURST" = "TRUE"
# "ANNOUNCE_INVITES" = "FALSE";
# "CAP_ACCOUNTNOTIFY" = "TRUE";
diff --git a/doc/readme.features b/doc/readme.features
index 3531ee6f..a41de64b 100644
--- a/doc/readme.features
+++ b/doc/readme.features
@@ -437,6 +437,20 @@ until the entire network has been upgraded. It is not
required that
all servers set this to "TRUE" in order for the features to be used,
as long as all servers are running u2.10.11 or above.
+STRICT_USERNAME
+ * Type: boolean
+ * Default: FALSE
+
+ircu checks the composition of usernames and reject usernames matching
+certain rules. Enabling this feature will reject users with usernames
+matching any of the following additional criterias:
+ - If mixed case, first must be capital, but no more than three;
+ but if three capitals, they must all be leading.
+ - If two different groups of digits, one must be either at the
+ start or end.
+ - No more than two groups of digits.
+ - Final character must not be punctuation.
+
HIS_MAP
* Type: boolean
* Default: TRUE
diff --git a/include/ircd_features.h b/include/ircd_features.h
index 84516d09..70acc947 100644
--- a/include/ircd_features.h
+++ b/include/ircd_features.h
@@ -84,6 +84,7 @@ enum Feature {
FEAT_IPCHECK_48_CLONE_PERIOD,
FEAT_IPCHECK_CLONE_DELAY,
FEAT_CHANNELLEN,
+ FEAT_STRICT_USERNAME,
/* Some misc. default paths */
FEAT_MPATH,
diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c
index d0d165ca..1f141259 100644
--- a/ircd/ircd_features.c
+++ b/ircd/ircd_features.c
@@ -349,6 +349,7 @@ static struct FeatureDesc {
F_I(IPCHECK_48_CLONE_PERIOD, 0, 10, 0),
F_I(IPCHECK_CLONE_DELAY, 0, 600, 0),
F_I(CHANNELLEN, 0, 200, 0),
+ F_B(STRICT_USERNAME, 0, 0, 0),
/* Some misc. default paths */
F_S(MPATH, FEAT_CASE | FEAT_MYOPER, "ircd.motd", motd_init),
diff --git a/ircd/s_auth.c b/ircd/s_auth.c
index 944436f1..95bed4c9 100644
--- a/ircd/s_auth.c
+++ b/ircd/s_auth.c
@@ -307,9 +307,6 @@ static int auth_set_username(struct AuthRequest *auth)
if (!IsDigit(last))
{
digitgroups++;
- /* If more than two groups of digits, reject. */
- if (digitgroups > 2)
- goto badid;
}
}
else if (ch == '-' || ch == '_' || ch == '.')
@@ -323,6 +320,16 @@ static int auth_set_username(struct AuthRequest *auth)
goto badid;
}
+ /* Must have at least one letter. */
+ if (!lower && !upper)
+ goto badid;
+ /* Simplified username test? Then we're done here. */
+ if (!feature_bool(FEAT_STRICT_USERNAME))
+ return 0;
+
+ /* If more than two groups of digits, reject. */
+ if (digitgroups > 2)
+ goto badid;
/* If mixed case, first must be capital, but no more than three;
* but if three capitals, they must all be leading. */
if (lower && upper && (!leadcaps || leadcaps > 3 ||
@@ -332,9 +339,6 @@ static int auth_set_username(struct AuthRequest *auth)
* start or end. */
if (digitgroups == 2 && !(IsDigit(s[0]) || IsDigit(ch)))
goto badid;
- /* Must have at least one letter. */
- if (!lower && !upper)
- goto badid;
/* Final character must not be punctuation. */
if (!IsAlnum(last))
goto badid;
-----------------------------------------------------------------------
Summary of changes:
doc/example.conf | 1 +
doc/readme.features | 14 +++++++++
include/ircd_features.h | 1 +
include/struct.h | 7 ++++-
ircd/ircd_features.c | 1 +
ircd/m_account.c | 76 +++++++++++++++++++++++++++++++------------------
ircd/s_auth.c | 27 ++++++++++++------
ircd/s_user.c | 52 ++++++++++++++++++++++-----------
ircd/send.c | 5 +++-
9 files changed, 131 insertions(+), 53 deletions(-)
hooks/post-receive
--
Undernet IRC Server Source Code.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].