From 53f7042e9312b34d6f530e5bf9feced10b387f9a Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Fri, 11 Apr 2025 20:46:18 +0200 Subject: [PATCH 01/13] Optimized G-Line and added an execption for opers --- include/gline.h | 5 +-- include/ircd_features.h | 1 + include/struct.h | 1 + ircd/gline.c | 85 ++++++++++++++++++++++++++++++++++------- ircd/ircd_features.c | 1 + ircd/m_account.c | 16 +++++++- 6 files changed, 92 insertions(+), 17 deletions(-) diff --git a/include/gline.h b/include/gline.h index f79b801e..26db3a30 100644 --- a/include/gline.h +++ b/include/gline.h @@ -96,9 +96,8 @@ enum GlineAction { #define GLINE_UPDATE (GLINE_EXPIRE | GLINE_LIFETIME | GLINE_REASON) /** Test whether \a g is active. */ -#define GlineIsActive(g) ((((g)->gl_flags & GLINE_ACTIVE) && \ - (g)->gl_state != GLOCAL_DEACTIVATED) || \ - (g)->gl_state == GLOCAL_ACTIVATED) +#define GlineIsActive(g) (((g)->gl_flags & GLINE_ACTMASK) == \ + GLINE_ACTIVE) /** Test whether \a g is remotely (globally) active. */ #define GlineIsRemActive(g) ((g)->gl_flags & GLINE_ACTIVE) /** Test whether \a g is an IP-based G-line. */ diff --git a/include/ircd_features.h b/include/ircd_features.h index 70acc947..5b46e9e1 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -102,6 +102,7 @@ enum Feature { /* features that affect all operators */ FEAT_CONFIG_OPERCMDS, + FEAT_ENABLE_GLINE_OPER_EXCEPTION, /* IRCv3 capabilities */ FEAT_CAP_ACCOUNTNOTIFY, diff --git a/include/struct.h b/include/struct.h index 78d5f89e..3cab2b7c 100644 --- a/include/struct.h +++ b/include/struct.h @@ -86,6 +86,7 @@ struct User { char username[USERLEN + 1]; char host[HOSTLEN + 1]; /**< displayed hostname */ char realhost[HOSTLEN + 1]; /**< actual hostname */ + char authhost[HOSTLEN + 1]; /**< actual hostname */ char account[ACCOUNTLEN + 1]; /**< IRC account name */ uint64_t acc_id; /**< IRC account id */ uint64_t acc_flags; /**< IRC account flags */ diff --git a/ircd/gline.c b/ircd/gline.c index ec36e021..4c5ad984 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -106,29 +106,81 @@ struct Gline* BadChanGlineList = 0; * Otherwise, assign \a def_user to *user_p and \a userhost to *host_p. * * @param[in] userhost Input string from user. + * @param[out] nick_p Gets pointer to nick part of hostmask. * @param[out] user_p Gets pointer to user (or channel/realname) part of hostmask. * @param[out] host_p Gets point to host part of hostmask (may be assigned NULL). * @param[in] def_user Default value for user part. */ static void -canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user) +canon_userhost(char *userhost, char **nick_p, char **user_p, char **host_p, char *def_user) { - char *tmp; + char *tmp, *s; if (*userhost == '$') { *user_p = userhost; *host_p = NULL; + *nick_p = NULL; return; } - if (!(tmp = strchr(userhost, '@'))) { - *user_p = def_user; - *host_p = userhost; - } else { - *user_p = userhost; + if ((tmp = strchr(userhost, '!'))) { + *nick_p = userhost; *(tmp++) = '\0'; + } else { + *nick_p = def_user; + tmp = userhost; + } + + if (!(s = strchr(tmp, '@'))) { + *user_p = def_user; *host_p = tmp; + } else { + *user_p = tmp; + *(s++) = '\0'; + *host_p = s; + } +} + +/** This scans all users for the real host + * @param[in] host The host to parse + */ +static void +get_realhost(char **host) { + struct Client *acptr; + int fd; + /* + * checks G-line affects accounts! + */ + for (fd = HighestFd; fd >= 0; --fd) { + /* + * get the users! + */ + if ((acptr = LocalClientArray[fd])) { + if (!cli_user(acptr)) + continue; + if (IsAccount(acptr)) { + if(match(*host, cli_user(acptr)->authhost)) { + return; + } + } + } } + /* + * G-lines the real host! + */ + for (fd = HighestFd; fd >= 0; --fd) { + /* + * get the users! + */ + if ((acptr = LocalClientArray[fd])) { + if (!cli_user(acptr)) + continue; + if (cli_user(acptr)->realhost && match(*host, cli_user(acptr)->host)) { + *host = cli_user(acptr)->realhost; + return; + } + } + } } /** Create a Gline structure. @@ -232,9 +284,15 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) continue; } else { - if (match(gline->gl_host, cli_sockhost(acptr)) != 0) + if (match(gline->gl_host, cli_user(acptr)->host) != 0 && match(gline->gl_host, cli_sockhost(acptr)) != 0 && match(gline->gl_host, cli_user(acptr)->authhost) != 0) continue; } + if (IsAnOper(acptr) && feature_bool(FEAT_ENABLE_GLINE_OPER_EXCEPTION)) { + sendto_opmask_butone(0, SNO_GLINE, "G-line for %s ignored, nick is an oper...", + cli_name(acptr)); + continue; + } + } /* ok, here's one that got G-lined */ @@ -436,7 +494,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, { struct Gline *agline; char uhmask[USERLEN + HOSTLEN + 2]; - char *user, *host; + char *nick, *user, *host; int tmp; assert(0 != userhost); @@ -484,7 +542,8 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, return send_reply(sptr, ERR_TOOMANYUSERS, tmp); } } else { - canon_userhost(userhost, &user, &host, "*"); + canon_userhost(userhost, &nick, &user, &host, "*"); + get_realhost(&host); if (sizeof(uhmask) < ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host)) return send_reply(sptr, ERR_LONGMASK); @@ -943,7 +1002,7 @@ gline_find(char *userhost, unsigned int flags) { struct Gline *gline = 0; struct Gline *sgline; - char *user, *host, *t_uh; + char *nick, *user, *host, *t_uh; if (flags & (GLINE_BADCHAN | GLINE_ANY)) { gliter(BadChanGlineList, gline, sgline) { @@ -961,7 +1020,7 @@ gline_find(char *userhost, unsigned int flags) return 0; DupString(t_uh, userhost); - canon_userhost(t_uh, &user, &host, "*"); + canon_userhost(t_uh, &nick, &user, &host, "*"); gliter(GlobalGlineList, gline, sgline) { if ((flags & (GlineIsLocal(gline) ? GLINE_GLOBAL : GLINE_LOCAL)) || @@ -1016,7 +1075,7 @@ gline_lookup(struct Client *cptr, unsigned int flags) continue; } else { - if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0) + if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0 && match(gline->gl_host, cli_user(cptr)->host) != 0 && match(gline->gl_host, cli_sockhost(cptr)) != 0 && match(gline->gl_host, cli_user(cptr)->authhost) != 0) continue; } } diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index 1f141259..a4c3e6de 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -367,6 +367,7 @@ static struct FeatureDesc { /* features that affect all operators */ F_B(CONFIG_OPERCMDS, 0, 0, 0), + F_B(ENABLE_GLINE_OPER_EXCEPTION, 0, 1, 0), /* IRCv3 capabilities */ F_B(CAP_ACCOUNTNOTIFY, 0, 1, 0), diff --git a/ircd/m_account.c b/ircd/m_account.c index a55f6944..50637d89 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -81,13 +81,19 @@ #include "config.h" #include "client.h" +#include "hash.h" #include "ircd.h" +#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" +#include "ircd_snprintf.h" #include "ircd_string.h" #include "msg.h" +#include "numeric.h" #include "numnicks.h" +#include "s_conf.h" #include "s_debug.h" +#include "s_misc.h" #include "s_user.h" #include "send.h" @@ -108,6 +114,7 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client *acptr; + int killreason; uint64_t acc_id = 0, acc_flags = 0; if (parc < 3) @@ -170,6 +177,13 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, acptr, cli_user(acptr)->account, cli_user(acptr)->acc_id, cli_user(acptr)->acc_flags); - + ircd_snprintf(0, cli_user(acptr)->authhost, HOSTLEN, "%s.%s", parv[2], feature_str(FEAT_HIDDEN_HOST)); + killreason = find_kill(acptr); + if (killreason) + { + ++ServerStats->is_k_lined; + return exit_client(acptr, acptr, cptr, + (killreason == -1 ? "K-lined" : "G-lined")); + } return 0; } From 131e9fc71f5e551707df66d0945de9009f5044cb Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 05:07:44 +0200 Subject: [PATCH 02/13] Fixed G-Line --- ircd/gline.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/ircd/gline.c b/ircd/gline.c index 4c5ad984..5ff59e2b 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -141,48 +141,6 @@ canon_userhost(char *userhost, char **nick_p, char **user_p, char **host_p, char } } -/** This scans all users for the real host - * @param[in] host The host to parse - */ -static void -get_realhost(char **host) { - struct Client *acptr; - int fd; - /* - * checks G-line affects accounts! - */ - for (fd = HighestFd; fd >= 0; --fd) { - /* - * get the users! - */ - if ((acptr = LocalClientArray[fd])) { - if (!cli_user(acptr)) - continue; - if (IsAccount(acptr)) { - if(match(*host, cli_user(acptr)->authhost)) { - return; - } - } - } - } - /* - * G-lines the real host! - */ - for (fd = HighestFd; fd >= 0; --fd) { - /* - * get the users! - */ - if ((acptr = LocalClientArray[fd])) { - if (!cli_user(acptr)) - continue; - if (cli_user(acptr)->realhost && match(*host, cli_user(acptr)->host)) { - *host = cli_user(acptr)->realhost; - return; - } - } - } -} - /** Create a Gline structure. * @param[in] user User part of mask. * @param[in] host Host part of mask (NULL if not applicable). @@ -543,7 +501,6 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, } } else { canon_userhost(userhost, &nick, &user, &host, "*"); - get_realhost(&host); if (sizeof(uhmask) < ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host)) return send_reply(sptr, ERR_LONGMASK); From 4a2dbed850d358dfce8119813d88863b472f6df3 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 06:05:56 +0200 Subject: [PATCH 03/13] fixed crash issue on gline list --- ircd/gline.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/ircd/gline.c b/ircd/gline.c index 5ff59e2b..e77baf6e 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -1032,7 +1032,7 @@ gline_lookup(struct Client *cptr, unsigned int flags) continue; } else { - if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0 && match(gline->gl_host, cli_user(cptr)->host) != 0 && match(gline->gl_host, cli_sockhost(cptr)) != 0 && match(gline->gl_host, cli_user(cptr)->authhost) != 0) + if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0 && match(gline->gl_host, cli_user(cptr)->host) != 0 && match(gline->gl_host, cli_sockhost(cptr)) != 0) continue; } } @@ -1131,26 +1131,25 @@ gline_list(struct Client *sptr, char *userhost) return send_reply(sptr, ERR_NOSUCHGLINE, userhost); /* send gline information along */ - send_reply(sptr, RPL_GLIST, gline->gl_user, - gline->gl_host ? "@" : "", + send_reply(sptr, RPL_GLIST, + "", + "", + gline->gl_user, GlineIsBadChan(gline) || GlineIsRealName(gline) ? "" : "@", gline->gl_host ? gline->gl_host : "", - gline->gl_expire, gline->gl_lastmod, - gline->gl_lifetime, + gline->gl_expire + TSoffset, GlineIsLocal(gline) ? cli_name(&me) : "*", - gline->gl_state == GLOCAL_ACTIVATED ? ">" : - (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""), - GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason); + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); } else { gliter(GlobalGlineList, gline, sgline) { - send_reply(sptr, RPL_GLIST, gline->gl_user, - gline->gl_host ? "@" : "", - gline->gl_host ? gline->gl_host : "", - gline->gl_expire, gline->gl_lastmod, - gline->gl_lifetime, - GlineIsLocal(gline) ? cli_name(&me) : "*", - gline->gl_state == GLOCAL_ACTIVATED ? ">" : - (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""), - GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason); + send_reply(sptr, RPL_GLIST, + "", + "", + gline->gl_user, + gline->gl_host ? "@" : "", + gline->gl_host ? gline->gl_host : "", + gline->gl_expire + TSoffset, + GlineIsLocal(gline) ? cli_name(&me) : "*", + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); } gliter(BadChanGlineList, gline, sgline) { From 66afbac34698a62d03f04f67d3881b82bd231e12 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 06:38:30 +0200 Subject: [PATCH 04/13] Fixed gline --- include/gline.h | 5 ++-- ircd/gline.c | 70 ++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/include/gline.h b/include/gline.h index 26db3a30..f79b801e 100644 --- a/include/gline.h +++ b/include/gline.h @@ -96,8 +96,9 @@ enum GlineAction { #define GLINE_UPDATE (GLINE_EXPIRE | GLINE_LIFETIME | GLINE_REASON) /** Test whether \a g is active. */ -#define GlineIsActive(g) (((g)->gl_flags & GLINE_ACTMASK) == \ - GLINE_ACTIVE) +#define GlineIsActive(g) ((((g)->gl_flags & GLINE_ACTIVE) && \ + (g)->gl_state != GLOCAL_DEACTIVATED) || \ + (g)->gl_state == GLOCAL_ACTIVATED) /** Test whether \a g is remotely (globally) active. */ #define GlineIsRemActive(g) ((g)->gl_flags & GLINE_ACTIVE) /** Test whether \a g is an IP-based G-line. */ diff --git a/ircd/gline.c b/ircd/gline.c index e77baf6e..1e94b44b 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -106,38 +106,28 @@ struct Gline* BadChanGlineList = 0; * Otherwise, assign \a def_user to *user_p and \a userhost to *host_p. * * @param[in] userhost Input string from user. - * @param[out] nick_p Gets pointer to nick part of hostmask. * @param[out] user_p Gets pointer to user (or channel/realname) part of hostmask. * @param[out] host_p Gets point to host part of hostmask (may be assigned NULL). * @param[in] def_user Default value for user part. */ static void -canon_userhost(char *userhost, char **nick_p, char **user_p, char **host_p, char *def_user) +canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user) { - char *tmp, *s; + char *tmp; if (*userhost == '$') { *user_p = userhost; *host_p = NULL; - *nick_p = NULL; return; } - if ((tmp = strchr(userhost, '!'))) { - *nick_p = userhost; - *(tmp++) = '\0'; - } else { - *nick_p = def_user; - tmp = userhost; - } - - if (!(s = strchr(tmp, '@'))) { + if (!(tmp = strchr(userhost, '@'))) { *user_p = def_user; - *host_p = tmp; + *host_p = userhost; } else { - *user_p = tmp; - *(s++) = '\0'; - *host_p = s; + *user_p = userhost; + *(tmp++) = '\0'; + *host_p = tmp; } } @@ -452,7 +442,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, { struct Gline *agline; char uhmask[USERLEN + HOSTLEN + 2]; - char *nick, *user, *host; + char *user, *host; int tmp; assert(0 != userhost); @@ -500,7 +490,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, return send_reply(sptr, ERR_TOOMANYUSERS, tmp); } } else { - canon_userhost(userhost, &nick, &user, &host, "*"); + canon_userhost(userhost, &user, &host, "*"); if (sizeof(uhmask) < ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host)) return send_reply(sptr, ERR_LONGMASK); @@ -959,7 +949,7 @@ gline_find(char *userhost, unsigned int flags) { struct Gline *gline = 0; struct Gline *sgline; - char *nick, *user, *host, *t_uh; + char *user, *host, *t_uh; if (flags & (GLINE_BADCHAN | GLINE_ANY)) { gliter(BadChanGlineList, gline, sgline) { @@ -977,7 +967,7 @@ gline_find(char *userhost, unsigned int flags) return 0; DupString(t_uh, userhost); - canon_userhost(t_uh, &nick, &user, &host, "*"); + canon_userhost(t_uh, &user, &host, "*"); gliter(GlobalGlineList, gline, sgline) { if ((flags & (GlineIsLocal(gline) ? GLINE_GLOBAL : GLINE_LOCAL)) || @@ -1113,6 +1103,13 @@ gline_resend(struct Client *cptr, struct Gline *gline) return 0; } +/** Display one or all G-lines to a user. + * If \a userhost is not NULL, only send the first matching G-line. + * Otherwise send the whole list. + * @param[in] sptr User asking for G-line list. + * @param[in] userhost G-line mask to search for (or NULL). + * @return Zero. + */ /** Display one or all G-lines to a user. * If \a userhost is not NULL, only send the first matching G-line. * Otherwise send the whole list. @@ -1131,25 +1128,26 @@ gline_list(struct Client *sptr, char *userhost) return send_reply(sptr, ERR_NOSUCHGLINE, userhost); /* send gline information along */ - send_reply(sptr, RPL_GLIST, - "", - "", - gline->gl_user, GlineIsBadChan(gline) || GlineIsRealName(gline) ? "" : "@", + send_reply(sptr, RPL_GLIST, gline->gl_user, + gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "", - gline->gl_expire + TSoffset, + gline->gl_expire, gline->gl_lastmod, + gline->gl_lifetime, GlineIsLocal(gline) ? cli_name(&me) : "*", - GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + gline->gl_state == GLOCAL_ACTIVATED ? ">" : + (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""), + GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason); } else { gliter(GlobalGlineList, gline, sgline) { - send_reply(sptr, RPL_GLIST, - "", - "", - gline->gl_user, - gline->gl_host ? "@" : "", - gline->gl_host ? gline->gl_host : "", - gline->gl_expire + TSoffset, - GlineIsLocal(gline) ? cli_name(&me) : "*", - GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + send_reply(sptr, RPL_GLIST, gline->gl_user, + gline->gl_host ? "@" : "", + gline->gl_host ? gline->gl_host : "", + gline->gl_expire, gline->gl_lastmod, + gline->gl_lifetime, + GlineIsLocal(gline) ? cli_name(&me) : "*", + gline->gl_state == GLOCAL_ACTIVATED ? ">" : + (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""), + GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason); } gliter(BadChanGlineList, gline, sgline) { From fa99183be8f39984efe5f4a581ca6d0379bb7741 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 08:04:50 +0200 Subject: [PATCH 05/13] remove not needed comment --- ircd/gline.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ircd/gline.c b/ircd/gline.c index 1e94b44b..6fc0730a 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -1103,13 +1103,6 @@ gline_resend(struct Client *cptr, struct Gline *gline) return 0; } -/** Display one or all G-lines to a user. - * If \a userhost is not NULL, only send the first matching G-line. - * Otherwise send the whole list. - * @param[in] sptr User asking for G-line list. - * @param[in] userhost G-line mask to search for (or NULL). - * @return Zero. - */ /** Display one or all G-lines to a user. * If \a userhost is not NULL, only send the first matching G-line. * Otherwise send the whole list. From 4a7505333cbbca5bcbedf5ec0fec619f11284b50 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:09:45 +0200 Subject: [PATCH 06/13] Update gline.c --- ircd/gline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ircd/gline.c b/ircd/gline.c index 6fc0730a..c0317cbc 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -232,7 +232,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) continue; } else { - if (match(gline->gl_host, cli_user(acptr)->host) != 0 && match(gline->gl_host, cli_sockhost(acptr)) != 0 && match(gline->gl_host, cli_user(acptr)->authhost) != 0) + if (match(gline->gl_host, cli_user(acptr)->host) != 0) continue; } if (IsAnOper(acptr) && feature_bool(FEAT_ENABLE_GLINE_OPER_EXCEPTION)) { @@ -1022,7 +1022,7 @@ gline_lookup(struct Client *cptr, unsigned int flags) continue; } else { - if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0 && match(gline->gl_host, cli_user(cptr)->host) != 0 && match(gline->gl_host, cli_sockhost(cptr)) != 0) + if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0) continue; } } From ccbd2c6c930a6a95bc6f51d4e20a95339ffb7d64 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:11:06 +0200 Subject: [PATCH 07/13] Update m_account.c --- ircd/m_account.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ircd/m_account.c b/ircd/m_account.c index 50637d89..0e972112 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -81,19 +81,13 @@ #include "config.h" #include "client.h" -#include "hash.h" #include "ircd.h" -#include "ircd_features.h" #include "ircd_log.h" #include "ircd_reply.h" -#include "ircd_snprintf.h" #include "ircd_string.h" #include "msg.h" -#include "numeric.h" #include "numnicks.h" -#include "s_conf.h" #include "s_debug.h" -#include "s_misc.h" #include "s_user.h" #include "send.h" @@ -114,7 +108,6 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client *acptr; - int killreason; uint64_t acc_id = 0, acc_flags = 0; if (parc < 3) @@ -160,9 +153,10 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, } ircd_strncpy(cli_user(acptr)->account, parv[2], ACCOUNTLEN); - sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, NULL, CAP_ACCOUNTNOTIFY, - 0, "%s", cli_user(acptr)->account); hide_hostmask(acptr, FLAG_ACCOUNT); + + sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, NULL, CAP_ACCOUNTNOTIFY, + _CAP_LAST_CAP, "%s", cli_user(acptr)->account); } if (parc > 4) { @@ -177,13 +171,6 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, acptr, cli_user(acptr)->account, cli_user(acptr)->acc_id, cli_user(acptr)->acc_flags); - ircd_snprintf(0, cli_user(acptr)->authhost, HOSTLEN, "%s.%s", parv[2], feature_str(FEAT_HIDDEN_HOST)); - killreason = find_kill(acptr); - if (killreason) - { - ++ServerStats->is_k_lined; - return exit_client(acptr, acptr, cptr, - (killreason == -1 ? "K-lined" : "G-lined")); - } + return 0; } From 636c57eac9f840f553c9faf220e593dea5274fe4 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:11:52 +0200 Subject: [PATCH 08/13] Update m_account.c --- ircd/m_account.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/m_account.c b/ircd/m_account.c index 0e972112..05ddf8d9 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -156,7 +156,7 @@ int ms_account(struct Client* cptr, struct Client* sptr, int parc, hide_hostmask(acptr, FLAG_ACCOUNT); sendcmdto_capflag_common_channels_butone(acptr, CMD_ACCOUNT, NULL, CAP_ACCOUNTNOTIFY, - _CAP_LAST_CAP, "%s", cli_user(acptr)->account); + 0, "%s", cli_user(acptr)->account); } if (parc > 4) { From 6c16932381f0045ce47e1bb5d5292f1cc04b4b67 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:13:00 +0200 Subject: [PATCH 09/13] Update m_account.c --- ircd/m_account.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ircd/m_account.c b/ircd/m_account.c index 05ddf8d9..a55f6944 100644 --- a/ircd/m_account.c +++ b/ircd/m_account.c @@ -153,10 +153,9 @@ 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, NULL, CAP_ACCOUNTNOTIFY, 0, "%s", cli_user(acptr)->account); + hide_hostmask(acptr, FLAG_ACCOUNT); } if (parc > 4) { From 66cd8d4c3f5a9025aad7fbc93eccf0666d889c4a Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:13:45 +0200 Subject: [PATCH 10/13] Update struct.h --- include/struct.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/struct.h b/include/struct.h index 3cab2b7c..78d5f89e 100644 --- a/include/struct.h +++ b/include/struct.h @@ -86,7 +86,6 @@ struct User { char username[USERLEN + 1]; char host[HOSTLEN + 1]; /**< displayed hostname */ char realhost[HOSTLEN + 1]; /**< actual hostname */ - char authhost[HOSTLEN + 1]; /**< actual hostname */ char account[ACCOUNTLEN + 1]; /**< IRC account name */ uint64_t acc_id; /**< IRC account id */ uint64_t acc_flags; /**< IRC account flags */ From 3cb4160473b8972ec5c5a297b0116b6bdc230d6f Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:14:44 +0200 Subject: [PATCH 11/13] Update gline.c --- ircd/gline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/gline.c b/ircd/gline.c index c0317cbc..688697aa 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -232,7 +232,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) continue; } else { - if (match(gline->gl_host, cli_user(acptr)->host) != 0) + if (match(gline->gl_host, cli_sockhost(acptr) != 0) continue; } if (IsAnOper(acptr) && feature_bool(FEAT_ENABLE_GLINE_OPER_EXCEPTION)) { From a78f2f09d9feb7996d9d01909655b97389c4e203 Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:15:59 +0200 Subject: [PATCH 12/13] Update gline.c --- ircd/gline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/gline.c b/ircd/gline.c index 688697aa..102f799d 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -490,7 +490,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, return send_reply(sptr, ERR_TOOMANYUSERS, tmp); } } else { - canon_userhost(userhost, &user, &host, "*"); + canon_userhost(userhost, &user, &host, "*"); if (sizeof(uhmask) < ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host)) return send_reply(sptr, ERR_LONGMASK); From ed991c2ff721d2cea6078042438d8730cb80d0aa Mon Sep 17 00:00:00 2001 From: WarPigs1602 Date: Sat, 12 Apr 2025 17:16:48 +0200 Subject: [PATCH 13/13] Fixed an issue --- ircd/gline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/gline.c b/ircd/gline.c index 102f799d..48a3fcbb 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -232,7 +232,7 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) continue; } else { - if (match(gline->gl_host, cli_sockhost(acptr) != 0) + if (match(gline->gl_host, cli_sockhost(acptr)) != 0) continue; } if (IsAnOper(acptr) && feature_bool(FEAT_ENABLE_GLINE_OPER_EXCEPTION)) {