From 81c857c332da9be52d91136ca935e98da1200d6f Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 11 Mar 2015 00:38:09 -0700 Subject: [PATCH 1/5] Update my name --- CREDITS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index 2edb19c..8c694b0 100644 --- a/CREDITS +++ b/CREDITS @@ -4,7 +4,7 @@ Elemental-IRCd is a fork of the now-defunct ShadowIRCD project. The Elemental-IRCd team is listed below in nick-alphabetical order: -Xena, Sam Dodrill +Xena, Christine Dodrill Some Elemental-IRCd features are modeled after or direct ports of code from Charybdis. @@ -17,7 +17,7 @@ The ponychat-ircd team is listed in nick-alphabetical order: aji, Alex Iadicico Kabaka, Kyle Johnson -Xe, Sam Dodrill +Xena, Christine Dodrill ShadowIRCd 6 is a modern restart of the old ShadowIRCd project based on Charybdis with a few additional features to make it appeal From a03437b72553d36cc0b40dd8769cce8d0452cbb9 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 22 Mar 2015 05:17:42 -0700 Subject: [PATCH 2/5] Add user mode extban Cherry-picked from: - atheme/charybdis@0b18e32cad7c6c1b26ae947e035115b44aad2f7f - atheme/charybids@11f2e7872746ba994b9e61b5169c020b295ebb25 - atheme/charybdis@a8eae73002c806fba8a4b2f02b822f9fe111708b - atheme/charybdis@63dd387b13211147ca290e6e3f0f42adaeaeea53 --- extensions/Makefile.in | 1 + extensions/extb_usermode.c | 79 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 extensions/extb_usermode.c diff --git a/extensions/Makefile.in b/extensions/Makefile.in index 2a3ba89..6c42435 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -50,6 +50,7 @@ SRCS = \ extb_ssl.c \ extb_realname.c \ extb_extgecos.c \ + extb_usermode.c \ force_user_invis.c \ hurt.c \ ip_cloaking.c \ diff --git a/extensions/extb_usermode.c b/extensions/extb_usermode.c new file mode 100644 index 0000000..eb087b3 --- /dev/null +++ b/extensions/extb_usermode.c @@ -0,0 +1,79 @@ +/* + * Usermode extban type: bans all users with a specific usermode + * -- nenolod + */ + +#include "stdinc.h" +#include "modules.h" +#include "hook.h" +#include "client.h" +#include "ircd.h" +#include "send.h" +#include "hash.h" +#include "s_conf.h" +#include "s_user.h" +#include "s_serv.h" +#include "numeric.h" + +static int _modinit(void); +static void _moddeinit(void); +static int eb_usermode(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); + +DECLARE_MODULE_AV1(extb_usermode, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision: 1299 $"); + +static int +_modinit(void) +{ + extban_table['m'] = eb_usermode; + + return 0; +} + +static void +_moddeinit(void) +{ + extban_table['m'] = NULL; +} + +static int eb_usermode(const char *data, struct Client *client_p, + struct Channel *chptr, long mode_type) +{ + int dir = MODE_ADD; + unsigned int modes_ack = 0, modes_nak = 0; + const char *p; + + (void)chptr; + + /* $m must have a specified mode */ + if (data == NULL) + return EXTBAN_INVALID; + + for (p = data; *p != '\0'; p++) + { + switch (*p) + { + case '+': + dir = MODE_ADD; + break; + case '-': + dir = MODE_DEL; + break; + default: + switch (dir) + { + case MODE_DEL: + modes_nak |= user_modes[(unsigned char) *p]; + break; + case MODE_ADD: + default: + modes_ack |= user_modes[(unsigned char) *p]; + break; + } + break; + } + } + + return ((client_p->umodes & modes_ack) == modes_ack && + !(client_p->umodes & modes_nak)) ? + EXTBAN_MATCH : EXTBAN_NOMATCH; +} From ad62a8365f0545694e5f9ea3ec4d4e41f8132d5e Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 22 Mar 2015 05:07:17 -0700 Subject: [PATCH 3/5] atheme module: add support for +u Closes #25 --- extra/services/atheme/elemental-ircd.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/extra/services/atheme/elemental-ircd.c b/extra/services/atheme/elemental-ircd.c index 55c79ea..4f813ec 100644 --- a/extra/services/atheme/elemental-ircd.c +++ b/extra/services/atheme/elemental-ircd.c @@ -12,7 +12,30 @@ #include "atheme.h" #include "uplink.h" #include "pmodule.h" -#include "protocol/shadowircd.h" + +/* Extended channel modes will eventually go here. */ +/* Note that these are involved in atheme.db file format */ +#define CMODE_NOCOLOR 0x00001000 /* hyperion +c */ +#define CMODE_REGONLY 0x00002000 /* hyperion +r */ +#define CMODE_OPMOD 0x00004000 /* hyperion +z */ +#define CMODE_FINVITE 0x00008000 /* hyperion +g */ +#define CMODE_EXLIMIT 0x00010000 /* charybdis +L */ +#define CMODE_PERM 0x00020000 /* charybdis +P */ +#define CMODE_FTARGET 0x00040000 /* charybdis +F */ +#define CMODE_DISFWD 0x00080000 /* charybdis +Q */ +#define CMODE_NOCTCP 0x00100000 /* charybdis +C */ +#define CMODE_IMMUNE 0x00200000 /* shadowircd +M */ +#define CMODE_ADMINONLY 0x00400000 /* shadowircd +A */ +#define CMODE_OPERONLY 0x00800000 /* shadowircd +O */ +#define CMODE_SSLONLY 0x01000000 /* shadowircd +S */ +#define CMODE_NOACTIONS 0x02000000 /* shadowircd +D */ +#define CMODE_NONOTICE 0x04000000 /* shadowircd +T */ +#define CMODE_NOCAPS 0x08000000 /* shadowircd +G */ +#define CMODE_NOKICKS 0x10000000 /* shadowircd +E */ +#define CMODE_NONICKS 0x20000000 /* shadowircd +N */ +#define CMODE_NOREPEAT 0x40000000 /* shadowircd +K */ +#define CMODE_KICKNOREJOIN 0x80000000 /* shadowircd +J */ +#define CMODE_HIDEBANS 0x100000000 /* elemental +u */ DECLARE_MODULE_V1("protocol/elemental-ircd", true, _modinit, NULL, PACKAGE_STRING, "PonyChat Development Group "); @@ -71,6 +94,7 @@ struct cmode_ elemental_mode_list[] = { { 'd', CMODE_NONICKS }, { 'K', CMODE_NOREPEAT }, { 'J', CMODE_KICKNOREJOIN }, + { 'u', CMODE_HIDEBANS }, { '\0', 0 } }; From 79bd2087c4b267fb2e5535ca5dc83b435927c16e Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Sun, 8 Mar 2015 11:38:36 -0700 Subject: [PATCH 4/5] add usermode for webchat users Closes #54 --- extensions/m_webirc.c | 3 +++ help/opers/umode | 1 + help/users/umode | 1 + include/client.h | 1 + include/numeric.h | 1 + modules/m_whois.c | 5 +++++ src/messages.tab | 2 +- src/s_user.c | 13 +++++++------ 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/extensions/m_webirc.c b/extensions/m_webirc.c index 43d3c27..2fce29d 100644 --- a/extensions/m_webirc.c +++ b/extensions/m_webirc.c @@ -130,6 +130,9 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char } } + /* Set UMODE_WEBCLIENT */ + source_p->umodes = source_p->umodes | UMODE_WEBCLIENT; + sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]); return 0; } diff --git a/help/opers/umode b/help/opers/umode index cdae8a9..7c8e911 100644 --- a/help/opers/umode +++ b/help/opers/umode @@ -28,3 +28,4 @@ User modes: (* designates that the umode is oper only) +I - Prevents non-opers from seeing your channel list in a whois query. +Z - Is connected via SSL (set only on connection). + +W - Is connected via a web client (set only on connection). diff --git a/help/users/umode b/help/users/umode index 519e5b1..3ed4415 100644 --- a/help/users/umode +++ b/help/users/umode @@ -22,3 +22,4 @@ User modes: (? designates that the umode is provided by an extension anyone who's in a common channel with you to message you. +V - Prevents you from receiving invites. +Z - Is connected via SSL (set only on connection). + +W - Is connected via a web client (set only on connection). diff --git a/include/client.h b/include/client.h index 70fd0d1..1da2f14 100644 --- a/include/client.h +++ b/include/client.h @@ -425,6 +425,7 @@ struct ListClient { #define UMODE_OPER 0x1000 /* Operator */ #define UMODE_ADMIN 0x2000 /* Admin on server */ #define UMODE_SSLCLIENT 0x4000 /* using SSL */ +#define UMODE_WEBCLIENT 0x100000 /* user is connected via a web client */ #define UMODE_OVERRIDE 0x20000 /* able to override */ #define IsOverride(x) ((x)->umodes & UMODE_OVERRIDE) diff --git a/include/numeric.h b/include/numeric.h index 123ea1f..e870916 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -330,6 +330,7 @@ extern const char *form_str(int); #define ERR_HELPNOTFOUND 524 #define RPL_WHOISSECURE 671 /* Unreal3.2 --nenolod */ +#define RPL_WHOISWEBIRC 672 /* plexus -- Xe */ #define RPL_MODLIST 702 #define RPL_ENDOFMODLIST 703 diff --git a/modules/m_whois.c b/modules/m_whois.c index eef1d4b..d91e87e 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -313,6 +313,11 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) if(IsSSLClient(target_p)) sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE), target_p->name); + + if(!(target_p->umodes & UMODE_WEBCLIENT)) { + sendto_one_numeric(source_p, RPL_WHOISWEBIRC, form_str(RPL_WHOISWEBIRC)); + } + if((source_p == target_p || IsOper(source_p)) && target_p->certfp != NULL) sendto_one_numeric(source_p, RPL_WHOISCERTFP, diff --git a/src/messages.tab b/src/messages.tab index dfc5e54..d87faa2 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -693,7 +693,7 @@ static const char * replies[] = { /* 669 */ NULL, /* 670 */ NULL, /* 671 RPL_WHOISSECURE, */ "%s :is using a secure connection", -/* 672 */ NULL, +/* 672 RPL_WHOISWEBIRC, */ "%s :is using a web IRC client", /* 673 */ NULL, /* 674 */ NULL, /* 675 */ NULL, diff --git a/src/s_user.c b/src/s_user.c index b7295cd..be4383d 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -88,7 +88,7 @@ int user_modes[256] = { 0, /* T */ 0, /* U */ UMODE_NOINVITE, /* V */ - 0, /* W */ + UMODE_WEBCLIENT, /* W */ 0, /* X */ 0, /* Y */ UMODE_SSLCLIENT, /* Z */ @@ -1011,13 +1011,14 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char } break; - /* we may not get these, - * but they shouldnt be in default - */ + /* we may not get these, + * but they shouldnt be in default + */ - /* can only be set on burst */ + /* can only be set on burst */ case 'S': case 'Z': + case 'W': case ' ': case '\n': case '\r': @@ -1046,7 +1047,7 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char source_p->umodes &= ~UMODE_SERVNOTICE; break; } - /* FALLTHROUGH */ + /* FALLTHROUGH */ default: if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward) { badflag = YES; From f0fc7fa407e94ac8e069a55337a680388735c5dd Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Tue, 24 Mar 2015 07:53:17 -0700 Subject: [PATCH 5/5] Make format string for RPL_WHOISWEBCLIENT include target Closes #62 --- modules/m_whois.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/m_whois.c b/modules/m_whois.c index d91e87e..42dd4b8 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -315,7 +315,8 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) target_p->name); if(!(target_p->umodes & UMODE_WEBCLIENT)) { - sendto_one_numeric(source_p, RPL_WHOISWEBIRC, form_str(RPL_WHOISWEBIRC)); + sendto_one_numeric(source_p, RPL_WHOISWEBIRC, form_str(RPL_WHOISWEBIRC), + target_p->name); } if((source_p == target_p || IsOper(source_p)) &&