From 676b8eaf7fcec02ad2583dc0bcc531942b65068e Mon Sep 17 00:00:00 2001 From: "dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Wed, 29 Sep 2004 20:19:18 +0000 Subject: BUILD : 1.7.5 (362) BUGS : 17 143 147 166 172 173 NOTES : Applied patch 927 provided by Trystan. git-svn-id: svn://svn.anope.org/anope/trunk@362 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@233 5417fbe8-f217-4b02-8779-1006273d7864 --- src/Makefile | 4 +- src/actions.c | 16 +- src/bahamut.c | 196 +++++++++++--- src/base64.c | 125 +++++++++ src/botserv.c | 80 +----- src/channels.c | 214 ++++++++++++++- src/chanserv.c | 74 ++++- src/config.c | 13 +- src/dreamforge.c | 132 +++++++-- src/hostserv.c | 7 +- src/hybrid.c | 242 +++++++++++++---- src/init.c | 31 +-- src/main.c | 5 +- src/memoserv.c | 3 + src/messages.c | 25 +- src/misc.c | 58 +++- src/modules.c | 20 +- src/modules/ircd_catserv.c | 9 +- src/mysql.c | 1 + src/nickserv.c | 38 ++- src/operserv.c | 15 +- src/ptlink.c | 365 ++++++++++++++++++++++--- src/rageircd.c | 173 ++++++++++-- src/servers.c | 63 +++-- src/ultimate2.c | 235 +++++++++++++++- src/ultimate3.c | 213 ++++++++++++--- src/unreal31.c | 84 +++++- src/unreal32.c | 657 +++++++++++++++++++++++++++++++++++++++------ src/users.c | 68 ++++- src/viagra.c | 211 +++++++++++++-- 30 files changed, 2874 insertions(+), 503 deletions(-) create mode 100644 src/base64.c (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 7db726aa3..dd672c721 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,13 @@ MYSQL_OBJ = $(MYSQL:.c=.o) RDB_OBJ = $(RDB:.c=.o) -OBJS = actions.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \ +OBJS = actions.o base64.o botserv.o channels.o chanserv.o commands.o compat.o converter.o \ config.o datafiles.o encrypt.o helpserv.o hostserv.o init.o language.o list.o log.o mail.o main.o \ memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \ process.o proxy.o send.o servers.o sessions.o slist.o sockutil.o \ timeout.o users.o dreamforge.o bahamut.o unreal31.o ultimate2.o ultimate3.o \ hybrid.o ptlink.o viagra.o rageircd.o unreal32.o \ $(VSNPRINTF_O) $(RDB_OBJ) $(MYSQL_OBJ) -SRCS = actions.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \ +SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c converter.c \ config.c datafiles.c encrypt.c helpserv.c hostserv.c init.c language.c list.c log.c mail.c main.c \ memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \ process.c proxy.c send.c servers.c sessions.c slist.c sockutil.c \ diff --git a/src/actions.c b/src/actions.c index a863eae76..1cfcdf2e1 100644 --- a/src/actions.c +++ b/src/actions.c @@ -113,12 +113,16 @@ void common_unban(ChannelInfo * ci, char *nick) int count, i; char *av[3], **bans; User *u; + char *host; - if (!ci || !ci->c || !ci->bi || !nick) + if (!ci || !ci->c || !nick) return; + if (!(u = finduser(nick))) return; + host = host_resolve(u->host); + if (ircd->svsmode_unban) { anope_cmd_unban(ci->name, nick); } else { @@ -131,7 +135,15 @@ void common_unban(ChannelInfo * ci, char *nick) if (match_usermask(bans[i], u)) { anope_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]); av[2] = bans[i]; - do_cmode(ci->bi->nick, 3, av); + do_cmode(whosends(ci), 3, av); + } + if (host) { + if (match_userip(bans[i], u, host)) { + anope_cmd_mode(whosends(ci), ci->name, "-b %s", + bans[i]); + av[2] = bans[i]; + do_cmode(whosends(ci), 3, av); + } } } free(bans); diff --git a/src/bahamut.c b/src/bahamut.c index 468d3be46..e54627faf 100644 --- a/src/bahamut.c +++ b/src/bahamut.c @@ -91,6 +91,9 @@ IRCDVar ircd[] = { 1, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 1, /* validate - to the #:# standard */ } , {NULL} @@ -195,29 +198,55 @@ void anope_set_umode(User * user, int ac, char **av) } - - unsigned long umodes[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, - 0, - UMODE_R, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - 0, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, 0, 0, /* A B C */ + UMODE_D, 0, UMODE_F, /* D E F */ + 0, 0, UMODE_I, /* G H I */ + 0, UMODE_K, 0, /* J K L */ + 0, 0, UMODE_O, /* M N O */ + 0, 0, UMODE_R, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, UMODE_X, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, UMODE_b, UMODE_c, /* a b c */ + UMODE_d, UMODE_e, UMODE_f, /* d e f */ + UMODE_g, UMODE_h, UMODE_i, /* g h i */ + UMODE_j, UMODE_k, 0, /* j k l */ + UMODE_m, UMODE_n, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, 0, /* s t u */ + 0, 0, UMODE_x, /* v w x */ + UMODE_y, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; char csmodes[128] = { @@ -505,7 +534,7 @@ int anope_event_os(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_OperServ, av[0]); return MOD_CONT; } @@ -514,7 +543,7 @@ int anope_event_ns(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_NickServ, av[0]); return MOD_CONT; } @@ -523,7 +552,7 @@ int anope_event_ms(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_MemoServ, av[0]); return MOD_CONT; } @@ -532,7 +561,7 @@ int anope_event_hs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_HostServ, av[0]); return MOD_CONT; } @@ -541,7 +570,7 @@ int anope_event_cs(char *source, int ac, char **av) { if (ac < 1) return MOD_CONT; - m_privmsg(source, av[0], av[1]); + m_privmsg(source, s_ChanServ, av[0]); return MOD_CONT; } @@ -570,7 +599,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PASS", NULL); addCoreMessage(IRCD,m); + m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); @@ -582,7 +611,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); m = createMessage("AKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("GLOBOPS", NULL); addCoreMessage(IRCD,m); - m = createMessage("GNOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("GNOTICE", anope_event_gnotice); addCoreMessage(IRCD,m); m = createMessage("GOPER", NULL); addCoreMessage(IRCD,m); m = createMessage("RAKILL", NULL); addCoreMessage(IRCD,m); m = createMessage("SILENCE", NULL); addCoreMessage(IRCD,m); @@ -590,7 +619,7 @@ void moduleAddIRCDMsgs(void) { m = createMessage("SVSMODE", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNICK", NULL); addCoreMessage(IRCD,m); m = createMessage("SVSNOOP", NULL); addCoreMessage(IRCD,m); - m = createMessage("SQLINE", NULL); addCoreMessage(IRCD,m); + m = createMessage("SQLINE", anope_event_sqline); addCoreMessage(IRCD,m); m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); m = createMessage("CS", anope_event_cs); addCoreMessage(IRCD,m); @@ -607,6 +636,9 @@ void moduleAddIRCDMsgs(void) { m = createMessage("UNSGLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("UNSZLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); + m = createMessage("LUSERSLOCK",anope_event_luserslock); addCoreMessage(IRCD,m); + m = createMessage("BURST", anope_event_burst); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); } @@ -646,6 +678,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + /* SGLINE */ void anope_cmd_sgline(char *mask, char *reason) { @@ -760,6 +797,11 @@ void anope_cmd_svsmode(User * u, int ac, char **av) } /* SQUIT */ +/* + * parv[0] = sender prefix + * parv[1] = server name + * parv[2] = comment +*/ void anope_cmd_squit(char *servname, char *message) { send_cmd(servname, "SQUIT %s :%s", servname, message); @@ -783,9 +825,18 @@ void anope_cmd_connect(int servernum) anope_cmd_capab(); anope_cmd_server(ServerName, 1, ServerDesc); anope_cmd_svinfo(); + anope_cmd_burst(); } -/* SVINFO */ + +/* + * SVINFO + * parv[0] = sender prefix + * parv[1] = TS_CURRENT for the server + * parv[2] = TS_MIN for the server + * parv[3] = server is standalone or connected to non-TS only + * parv[4] = server's idea of UTC time + */ void anope_cmd_svinfo() { send_cmd(NULL, "SVINFO 3 1 0 :%ld", time(NULL)); @@ -806,7 +857,8 @@ void anope_cmd_server(char *servname, int hop, char *descript) /* CAPAB */ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB NICKIP SSJOIN TS3 NOQUIT TSMODE UNCONNECT"); + send_cmd(NULL, + "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3"); } /* EVENT : SERVER */ @@ -818,7 +870,7 @@ int anope_event_server(char *source, int ac, char **av) uplink = sstrdup(av[0]); } - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1233,6 +1285,7 @@ void anope_cmd_211(const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, ServiceUser, ServiceHost, ServerName, name); anope_cmd_sqline(nick, "Reserved for services"); @@ -1340,6 +1393,7 @@ void anope_cmd_351(char *source) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s 0 0 :%s", nick, time(NULL), modes, user, host, ServerName, real); anope_cmd_sqline(nick, "Reserved for services"); @@ -1443,4 +1497,80 @@ int anope_event_sqline(char *source, int ac, char **av) } +int anope_event_gnotice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_pass(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Can not find any reference to these in Bahamut */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Can not find any reference to these in Bahamut */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + + +void anope_cmd_burst() +{ + send_cmd(NULL, "BURST"); +} + +void anope_cmd_eob() +{ + send_cmd(NULL, "BURST 0"); +} + +int anope_event_burst(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (!ac) { + /* for future use - start burst */ + } else { + if (s) { + s->sync = 1; + } + } + return MOD_CONT; +} + +int anope_event_luserslock(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + + #endif diff --git a/src/base64.c b/src/base64.c new file mode 100644 index 000000000..f17550bba --- /dev/null +++ b/src/base64.c @@ -0,0 +1,125 @@ +/* base64 routines. + * + * (C) 2003 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +/* + This is borrowed from Unreal +*/ + +#include "services.h" + +static char *int_to_base64(long); +static long base64_to_int(char *); + +char *base64enc(long i) +{ + if (i < 0) + return ("0"); + return int_to_base64(i); +} + +long base64dec(char *b64) +{ + if (b64) + return base64_to_int(b64); + else + return 0; +} + +/* ':' and '#' and '&' and '+' and '@' must never be in this table. */ +/* these tables must NEVER CHANGE! >) */ +char int6_to_base64_map[] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', + 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '{', '}' +}; + +char base64_to_int6_map[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, + -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, + -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, -1, 63, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 +}; + +static char *int_to_base64(long val) +{ + /* 32/6 == max 6 bytes for representation, + * +1 for the null, +1 for byte boundaries + */ + static char base64buf[8]; + long i = 7; + + base64buf[i] = '\0'; + + /* Temporary debugging code.. remove before 2038 ;p. + * This might happen in case of 64bit longs (opteron/ia64), + * if the value is then too large it can easily lead to + * a buffer underflow and thus to a crash. -- Syzop + */ + if (val > 2147483647L) { + abort(); + } + + do { + base64buf[--i] = int6_to_base64_map[val & 63]; + } + while (val >>= 6); + + return base64buf + i; +} + +static long base64_to_int(char *b64) +{ + int v = base64_to_int6_map[(u_char) * b64++]; + + if (!b64) + return 0; + + while (*b64) { + v <<= 6; + v += base64_to_int6_map[(u_char) * b64++]; + } + + return v; +} + +long base64dects(char *ts) +{ + char *token; + + if (!ts) { + return 0; + } + token = myStrGetToken(ts, '!', 1); + + if (!token) { + return strtoul(ts, NULL, 10);; + } + return base64dec(token); +} diff --git a/src/botserv.c b/src/botserv.c index 03fdafdf5..d38ab917c 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -1236,46 +1236,9 @@ static int do_bot(User * u) **/ /* Check whether it's a services client's nick and return if so - Certus */ + /* use nickIsServices reduce the total number lines of code - TSL */ - if ((s_NickServ && (stricmp(nick, s_NickServ) == 0)) - || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_ChanServ && (stricmp(nick, s_ChanServ) == 0)) - || (s_ChanServAlias - && !stricmp(nick, s_ChanServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_MemoServ && (stricmp(nick, s_MemoServ) == 0)) - || (s_MemoServAlias - && !stricmp(nick, s_MemoServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_BotServ && (stricmp(nick, s_BotServ) == 0)) - || (s_BotServAlias - && !stricmp(nick, s_BotServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HelpServ && (stricmp(nick, s_HelpServ) == 0)) - || (s_HelpServAlias - && !stricmp(nick, s_HelpServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_OperServ && (stricmp(nick, s_OperServ) == 0)) - || (s_OperServAlias - && !stricmp(nick, s_OperServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else - if ((s_GlobalNoticer - && (stricmp(nick, s_GlobalNoticer) == 0)) - || (s_GlobalNoticerAlias - && !stricmp(nick, s_GlobalNoticerAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HostServ && (stricmp(nick, s_HostServ) == 0)) - || (s_HostServAlias - && !stricmp(nick, s_HostServAlias))) { + if (nickIsServices(nick, 0)) { notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); return MOD_CONT; } @@ -1342,43 +1305,8 @@ static int do_bot(User * u) } /* Check whether it's a services client's nick and return if so - Certus */ - if ((s_NickServ && !stricmp(nick, s_NickServ)) - || (s_NickServAlias && !stricmp(nick, s_NickServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_ChanServ && !stricmp(nick, s_ChanServ)) - || (s_ChanServAlias - && !stricmp(nick, s_ChanServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_MemoServ && !stricmp(nick, s_MemoServ)) - || (s_MemoServAlias - && !stricmp(nick, s_MemoServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_BotServ && !stricmp(nick, s_BotServ)) - || (s_BotServAlias - && !stricmp(nick, s_BotServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HelpServ && !stricmp(nick, s_HelpServ)) - || (s_HelpServAlias - && !stricmp(nick, s_HelpServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_OperServ && !stricmp(nick, s_OperServ)) - || (s_OperServAlias - && !stricmp(nick, s_OperServAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_GlobalNoticer && !stricmp(nick, s_GlobalNoticer)) - || (s_GlobalNoticerAlias - && !stricmp(nick, s_GlobalNoticerAlias))) { - notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } else if ((s_HostServ && !stricmp(nick, s_HostServ)) - || (s_HostServAlias - && !stricmp(nick, s_HostServAlias))) { + /* use nickIsServices() to reduce the number of lines of code - TSL */ + if (nickIsServices(nick, 0)) { notice_lang(s_BotServ, u, BOT_BOT_CREATION_FAILED); return MOD_CONT; } diff --git a/src/channels.c b/src/channels.c index ebee50403..2b871853d 100644 --- a/src/channels.c +++ b/src/channels.c @@ -21,11 +21,13 @@ Channel *chanlist[1024]; void add_ban(Channel * chan, char *mask); void add_exception(Channel * chan, char *mask); +void add_invite(Channel * chan, char *mask); void chan_adduser2(User * user, Channel * c); Channel *chan_create(char *chan); void chan_delete(Channel * c); void del_ban(Channel * chan, char *mask); void del_exception(Channel * chan, char *mask); +void del_invite(Channel * chan, char *mask); char *get_flood(Channel * chan); char *get_key(Channel * chan); char *get_limit(Channel * chan); @@ -390,6 +392,13 @@ void get_channel_stats(long *nrec, long *memuse) mem += strlen(chan->excepts[j]) + 1; } } + if (ircd->invitemode) { + mem += sizeof(char *) * chan->invitesize; + for (j = 0; j < chan->invitecount; j++) { + if (chan->invite[j]) + mem += strlen(chan->invite[j]) + 1; + } + } for (cu = chan->users; cu; cu = cu->next) { mem += sizeof(*cu); if (cu->ud) { @@ -618,22 +627,48 @@ void do_part(const char *source, int ac, char **av) av[0] = timestamp av[1] = user + ============================================================ + + Unreal SJOIN + + On Connect there is + SJOIN !11LkOb #ircops +nt :@Trystan + + av[0] = time stamp (base64) + av[1] = channel + av[2] = modes + av[3] = users + bans + + On Channel Creation or a User joins an existing + Luna.NomadIrc.Net SJOIN !11LkW9 #akill :@Trystan + Luna.NomadIrc.Net SJOIN !11LkW9 #akill :Trystan` + + av[0] = time stamp (base64) + av[1] = channel + av[2] = users + */ void do_sjoin(const char *source, int ac, char **av) { Channel *c; User *user; + char *s, *end, cubuf[ircd->max_symbols + 2], *end2, + *cumodes[ircd->max_symbols + 1]; + int is_sqlined = 0; + int ts = 0; + + if (ircd->sjb64) { + ts = base64dects(av[0]); + } else { + ts = strtoul(av[0], NULL, 10); + } /* Double check to avoid unknown modes that need parameters */ if (ac >= 4 && ac <= 6) { - char *s, *end, cubuf[ircd->max_symbols + 2], *end2, - *cumodes[ircd->max_symbols + 1]; - c = findchan(av[1]); - if (ircd->chansqline) { if (!c) is_sqlined = check_chan_sqline(av[1]); @@ -651,6 +686,26 @@ void do_sjoin(const char *source, int ac, char **av) *end = 0; end2 = cubuf + 1; + +#ifdef SJOINBANNCHAR + if (*s == SJOINBANNCHAR) { + add_ban(c, myStrGetToken(s, SJOINBANNCHAR, 1)); + if (!end) + break; + s = end + 1; + continue; + } +#endif +#ifdef SJOINEXCEPTIONCHAR + if (*s == SJOINEXCEPTIONCHAR) { + add_exception(c, myStrGetToken(s, SJOINEXCEPTIONCHAR, 1)); + if (!end) + break; + s = end + 1; + continue; + } +#endif + while (csmodes[(int) *s] != 0) *end2++ = csmodes[(int) *s++]; *end2 = 0; @@ -693,10 +748,75 @@ void do_sjoin(const char *source, int ac, char **av) if (c) { /* Set the timestamp */ - c->creation_time = strtoul(av[0], NULL, 10); + c->creation_time = ts; /* We now update the channel mode. */ chan_set_modes(source, c, ac - 3, &av[2], 1); } + + /* Unreal just had to be different */ + } else if (ac == 3) { + c = findchan(av[1]); + if (ircd->chansqline) { + if (!c) + is_sqlined = check_chan_sqline(av[1]); + } + + cubuf[0] = '+'; + cumodes[0] = cubuf; + + /* We make all the users join */ + s = av[2]; /* Users are always the last element */ + + while (*s) { + end = strchr(s, ' '); + if (end) + *end = 0; + + end2 = cubuf + 1; + + while (csmodes[(int) *s] != 0) + *end2++ = csmodes[(int) *s++]; + *end2 = 0; + + user = finduser(s); + if (!user) { + alog("user: SJOIN for nonexistent user %s on %s", s, + av[1]); + return; + } + + if (is_sqlined && !is_oper(user)) { + anope_cmd_kick(s_OperServ, av[1], s, "Q-Lined"); + } else { + if (!check_kick(user, av[1])) { + /* Make the user join; if the channel does not exist it + * will be created there. This ensures that the channel + * is not created to be immediately destroyed, and + * that the locked key or topic is not shown to anyone + * who joins the channel when empty. + */ + c = join_user_update(user, c, av[1]); + + /* We update user mode on the channel */ + if (end2 - cubuf > 1) { + int i; + + for (i = 1; i < end2 - cubuf; i++) + cumodes[i] = user->nick; + chan_set_modes(source, c, 1 + (end2 - cubuf - 1), + cumodes, 1); + } + } + } + + if (!end) + break; + s = end + 1; + } + + if (c) { + c->creation_time = ts; + } } else if (ac == 2) { user = finduser(source); if (!user) { @@ -718,7 +838,7 @@ void do_sjoin(const char *source, int ac, char **av) anope_cmd_kick(s_OperServ, av[1], user->nick, "Q-Lined"); } else { c = join_user_update(user, c, av[1]); - c->creation_time = strtoul(av[0], NULL, 10); + c->creation_time = ts; } } } @@ -786,7 +906,16 @@ void do_cmode(const char *source, int ac, char **av) void do_topic(const char *source, int ac, char **av) { Channel *c = findchan(av[0]); - time_t topic_time = strtoul(av[2], NULL, 10); + int ts; + time_t topic_time; + + if (ircd->sjb64) { + ts = base64dects(av[0]); + } else { + ts = strtoul(av[0], NULL, 10); + } + + topic_time = ts; if (!c) { alog("channel: TOPIC %s for nonexistent channel %s", @@ -856,6 +985,21 @@ void add_exception(Channel * chan, char *mask) /*************************************************************************/ +void add_invite(Channel * chan, char *mask) +{ + if (chan->invitecount >= chan->invitesize) { + chan->invitesize += 8; + chan->invite = + srealloc(chan->invite, sizeof(char *) * chan->invitesize); + } + chan->invite[chan->invitecount++] = sstrdup(mask); + + if (debug) + alog("debug: Added invite %s to channel %s", mask, chan->name); +} + +/*************************************************************************/ + /* Add/remove a user to/from a channel, creating or deleting the channel as * necessary. If creating the channel, restore mode lock and topic as * necessary. Also check for auto-opping and auto-voicing. @@ -1012,13 +1156,25 @@ void chan_delete(Channel * c) if (c->excepts[i]) free(c->excepts[i]); else - alog("channel: BUG freeing %s: exceps[%d] is NULL!", + alog("channel: BUG freeing %s: excepts[%d] is NULL!", c->name, i); } if (c->exceptsize) free(c->excepts); } + if (ircd->invitemode) { + for (i = 0; i < c->invitecount; ++i) { + if (c->invite[i]) + free(c->invite[i]); + else + alog("channel: BUG freeing %s: invite[%d] is NULL!", + c->name, i); + } + if (c->invitesize) + free(c->invite); + } + if (c->next) c->next->prev = c->prev; if (c->prev) @@ -1037,6 +1193,11 @@ void del_ban(Channel * chan, char *mask) int i = 0; AutoKick *akick; + /* Sanity check as it seems some IRCD will just send -b without a mask */ + if (!mask) { + return; + } + while (i < chan->bancount && strcmp(*s, mask) != 0) { i++; s++; @@ -1063,6 +1224,11 @@ void del_exception(Channel * chan, char *mask) int i; int reset = 0; + /* Sanity check as it seems some IRCD will just send -e without a mask */ + if (!mask) { + return; + } + for (i = 0; i < chan->exceptcount; i++) { if ((!reset) && (stricmp(chan->excepts[i], mask) == 0)) { free(chan->excepts[i]); @@ -1080,6 +1246,36 @@ void del_exception(Channel * chan, char *mask) alog("debug: Deleted except %s to channel %s", mask, chan->name); } +/*************************************************************************/ + +void del_invite(Channel * chan, char *mask) +{ + int i; + int reset = 0; + + /* Sanity check as it seems some IRCD will just send -I without a mask */ + if (!mask) { + return; + } + + for (i = 0; i < chan->invitecount; i++) { + if ((!reset) && (stricmp(chan->invite[i], mask) == 0)) { + free(chan->invite[i]); + reset = 1; + } + if (reset) + chan->invite[i] = + (i == chan->invitecount) ? NULL : chan->invite[i + 1]; + } + + if (reset) + chan->invitecount--; + + if (debug) + alog("debug: Deleted invite %s to channel %s", mask, chan->name); +} + + /*************************************************************************/ char *get_flood(Channel * chan) @@ -1148,7 +1344,7 @@ void set_flood(Channel * chan, char *value) chan->flood = value ? sstrdup(value) : NULL; if (debug) - alog("debug: Flood of channel %s set to %s", chan->name, + alog("debug: Flood mode for channel %s set to %s", chan->name, chan->flood ? chan->flood : "no flood settings"); } diff --git a/src/chanserv.c b/src/chanserv.c index e210ac5ac..712c22560 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2038,20 +2038,37 @@ int delchan(ChannelInfo * ci) int i; NickCore *nc = ci->founder; + if (debug >= 2) { + alog("debug: delchan removing %s", ci->name); + } + if (ci->bi) { ci->bi->chancount--; } + + if (debug >= 2) { + alog("debug: delchan top of removing the bot"); + } if (ci->c) { if (ci->bi && ci->c->usercount >= BSMinUsers) { anope_cmd_part(ci->bi->nick, ci->c->name, NULL); } ci->c->ci = NULL; } + if (debug >= 2) { + alog("debug: delchan() Bot has been removed moving on"); + } #ifdef USE_RDB + if (debug >= 2) { + alog("debug: delchan() rdb updating"); + } if (rdb_open()) { rdb_cs_delchan(ci); rdb_close(); } + if (debug >= 2) { + alog("debug: delchan() rdb done"); + } #endif if (ci->next) ci->next->prev = ci->prev; @@ -2079,6 +2096,9 @@ int delchan(ChannelInfo * ci) free(ci->forbidreason); if (ci->access) free(ci->access); + if (debug >= 2) { + alog("debug: delchan() top of the akick list"); + } for (i = 0; i < ci->akickcount; i++) { if (!(ci->akick[i].flags & AK_ISNICK) && ci->akick[i].u.mask) free(ci->akick[i].u.mask); @@ -2087,10 +2107,16 @@ int delchan(ChannelInfo * ci) if (ci->akick[i].creator) free(ci->akick[i].creator); } + if (debug >= 2) { + alog("debug: delchan() done with the akick list"); + } if (ci->akick) free(ci->akick); if (ci->levels) free(ci->levels); + if (debug >= 2) { + alog("debug: delchan() top of the memo list"); + } if (ci->memos.memos) { for (i = 0; i < ci->memos.memocount; i++) { if (ci->memos.memos[i].text) @@ -2099,21 +2125,38 @@ int delchan(ChannelInfo * ci) } free(ci->memos.memos); } + if (debug >= 2) { + alog("debug: delchan() done with the memo list"); + } if (ci->ttb) free(ci->ttb); + + if (debug >= 2) { + alog("debug: delchan() top of the badword list"); + } for (i = 0; i < ci->bwcount; i++) { if (ci->badwords[i].word) free(ci->badwords[i].word); } if (ci->badwords) free(ci->badwords); + if (debug >= 2) { + alog("debug: delchan() done with the badword list"); + } + + if (debug >= 2) { + alog("debug: delchan() calling on moduleCleanStruct()"); + } moduleCleanStruct(&ci->moduleData); free(ci); if (nc) nc->channelcount--; + if (debug >= 2) { + alog("debug: delchan() all done"); + } return 1; } @@ -2342,16 +2385,11 @@ char *cs_get_redirect(ChannelInfo * ci) void cs_set_flood(ChannelInfo * ci, char *value) { - char *dp, *end; - if (ci->mlock_flood) free(ci->mlock_flood); /* This looks ugly, but it works ;) */ - if (value && *value != ':' - && (strtoul((*value == '*' ? value + 1 : value), &dp, 10) > 0) - && (*dp == ':') && (*(++dp) != 0) && (strtoul(dp, &end, 10) > 0) - && (*end == 0)) { + if (anope_flood_mode_check(value)) { ci->mlock_flood = sstrdup(value); } else { ci->mlock_on &= ~ircd->chan_fmode; @@ -5645,6 +5683,30 @@ static int do_clear(User * u) } notice_lang(s_ChanServ, u, CHAN_CLEARED_EXCEPTS, chan); free(excepts); + + } else if (ircd->invitemode && stricmp(what, "invites") == 0) { + char *av[3]; + int i; + + /* Save original except info */ + int count = c->invitecount; + char **invites = scalloc(sizeof(char *) * count, 1); + for (i = 0; i < count; i++) + invites[i] = sstrdup(c->invite[i]); + + for (i = 0; i < count; i++) { + av[0] = sstrdup(chan); + av[1] = sstrdup("-I"); + av[2] = invites[i]; + anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1], av[2]); + do_cmode(s_ChanServ, 3, av); + free(av[2]); + free(av[1]); + free(av[0]); + } + notice_lang(s_ChanServ, u, CHAN_CLEARED_INVITES, chan); + free(invites); + } else if (stricmp(what, "modes") == 0) { char buf[BUFSIZE], *end = buf; char *argv[2]; diff --git a/src/config.c b/src/config.c index 8bbbd077d..31dc59fa7 100644 --- a/src/config.c +++ b/src/config.c @@ -117,6 +117,8 @@ int DumpCore; int LogUsers; int NickRegDelay; int UseSVSHOLD; +int UseTokens; +int UseSVS2MODE; int UseMail; char *SendMailPath; @@ -622,6 +624,8 @@ Directive directives[] = { {"UserKey2", {{PARAM_POSINT, PARAM_RELOAD, &UserKey2}}}, {"UserKey3", {{PARAM_POSINT, PARAM_RELOAD, &UserKey3}}}, {"UseSVSHOLD", {{PARAM_SET, PARAM_RELOAD, &UseSVSHOLD}}}, + {"UseSVS2MODE", {{PARAM_SET, PARAM_RELOAD, &UseSVS2MODE}}}, + {"UseTokens", {{PARAM_SET, 0, &UseTokens}}}, {"WallAkillExpire", {{PARAM_SET, PARAM_RELOAD, &WallAkillExpire}}}, {"WallBadOS", {{PARAM_SET, PARAM_RELOAD, &WallBadOS}}}, {"WallDrop", {{PARAM_SET, PARAM_RELOAD, &WallDrop}}}, @@ -941,7 +945,7 @@ int read_config(int reload) CHECK(RemoteServer2); } if (!reload) { - if (LocalHost) { + if (LocalHost && RemoteServer) { if ((!stricmp(LocalHost, RemoteServer)) && LocalPort == RemotePort) { printf @@ -1319,6 +1323,13 @@ int read_config(int reload) CHECK(DefconMessage); } + if (UseTokens) { + if (!ircd->token) { + alog("Anope does not support TOKENS for this ircd setting unsetting UseToken"); + UseTokens = 0; + } + } + /** * If they try to enable any email registration option, * make sure they have everything else they need too... diff --git a/src/dreamforge.c b/src/dreamforge.c index 6cdec5745..7ec4fd081 100644 --- a/src/dreamforge.c +++ b/src/dreamforge.c @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 0, 1, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -185,27 +189,56 @@ void anope_set_umode(User * user, int ac, char **av) } } + unsigned long umodes[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, - 0, - 0, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - UMODE_g, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + UMODE_A, 0, 0, /* A B C */ + 0, 0, 0, /* D E F */ + 0, 0, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, 0, UMODE_O, /* M N O */ + 0, 0, 0, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, 0, UMODE_c, /* a b c */ + 0, 0, UMODE_f, /* d e f */ + UMODE_g, UMODE_h, UMODE_i, /* g h i */ + 0, UMODE_k, 0, /* j k l */ + 0, 0, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, 0, /* s t u */ + 0, 0, 0, /* v w x */ + 0, /* y */ + 0, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; char csmodes[128] = { @@ -447,6 +480,10 @@ void moduleAddIRCDMsgs(void) { m = createMessage("UNSQLINE", NULL); addCoreMessage(IRCD,m); m = createMessage("PROTOCTL", anope_event_capab); addCoreMessage(IRCD,m); + m = createMessage("REHASH", anope_event_rehash); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("CREDITS", anope_event_credits); addCoreMessage(IRCD,m); + } @@ -469,6 +506,11 @@ void anope_cmd_svsnoop(char *server, int set) send_cmd(NULL, "SVSNOOP %s %s", server, (set ? "+" : "-")); } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_remove_akill(char *user, char *host) { send_cmd(NULL, "RAKILL %s %s", host, user); @@ -563,6 +605,7 @@ void anope_pong(char *servname) void anope_cmd_connect(int servernum) { + anope_cmd_capab(); if (servernum == 1) anope_cmd_pass(RemotePassword); if (servernum == 2) @@ -578,6 +621,11 @@ void anope_cmd_pass(char *pass) send_cmd(NULL, "PASS :%s", pass); } +void anope_cmd_capab() +{ + send_cmd(NULL, "PROTOCTL NOQUIT"); +} + void anope_cmd_bot_chan_mode(char *nick, char *chan) { anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); @@ -1016,6 +1064,7 @@ void anope_cmd_211(const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *modes) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), ServiceUser, ServiceHost, ServerName, name); anope_cmd_mode(nick, nick, "%s", modes); @@ -1049,7 +1098,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1127,6 +1176,7 @@ void anope_cmd_pong(char *servname, char *who) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s 0 :%s", nick, time(NULL), user, host, ServerName, real); anope_cmd_mode(nick, "MODE %s %s", nick, modes); @@ -1245,4 +1295,44 @@ void anope_cmd_chg_nick(char *oldnick, char *newnick) send_cmd(oldnick, "NICK %s", newnick); } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_rehash(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_credits(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +void anope_cmd_eob() +{ + /* Not supported */ +} + #endif diff --git a/src/hostserv.c b/src/hostserv.c index 4c862e8b3..94e8354f8 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -33,9 +33,6 @@ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick, HostCore *deleteHostCore(HostCore * head, HostCore * prev); void delHostCore(char *nick); -char *getvIdent(char *nick); -char *getvHost(char *nick); - int is_host_setter(User * u); int is_host_remover(User * u); @@ -881,6 +878,10 @@ int do_set(User * u) tmp_time = time(NULL); if ((na = findnick(nick))) { + if (na->status & NS_VERBOTEN) { + notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick); + return MOD_CONT; + } alog("vHost for user \002%s\002 set to \002%s\002 by oper \002%s\002", nick, hostmask, u->nick); addHostCore(nick, vIdent, hostmask, u->nick, tmp_time); if (vIdent) { diff --git a/src/hybrid.c b/src/hybrid.c index b769d7a8e..1247af6ee 100644 --- a/src/hybrid.c +++ b/src/hybrid.c @@ -40,7 +40,7 @@ IRCDVar ircd[] = { "+io", /* Global alias mode */ "+", /* Used by BotServ Bots */ 3, /* Chan Max Symbols */ - "aiklmnpst", /* Modes to Remove */ + "-aiklmnpst", /* Modes to Remove */ "+o", /* Channel Umode used by Botserv bots */ 0, /* SVSNICK */ 0, /* Vhost */ @@ -89,6 +89,10 @@ IRCDVar ircd[] = { 0, /* On nick change check if they could be identified */ 0, /* No Knock requires +i */ NULL, /* CAPAB Chan Modes */ + 0, /* We support TOKENS */ + 1, /* TOKENS are CASE inSensitive */ + 0, /* TIME STAMPS are BASE64 */ + 0, /* +I support */ } , {NULL} @@ -96,7 +100,7 @@ IRCDVar ircd[] = { IRCDCAPAB ircdcap[] = { { - 0, /* NOQUIT */ + CAPAB_NOQUIT, /* NOQUIT */ 0, /* TSMODE */ 0, /* UNCONNECT */ 0, /* NICKIP */ @@ -189,36 +193,65 @@ void anope_set_umode(User * user, int ac, char **av) } unsigned long umodes[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, UMODE_A, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, - 0, - 0, - 0, 0, 0, 0, 0, 0, 0, - 0, - 0, 0, 0, 0, 0, - 0, UMODE_a, 0, 0, 0, 0, 0, - 0, - UMODE_h, UMODE_i, 0, 0, 0, 0, 0, UMODE_o, - 0, - 0, UMODE_r, 0, 0, 0, 0, UMODE_w, - 0, - 0, - 0, - 0, 0, 0, 0, 0 + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Horzontal Tab */ + 0, 0, 0, /* Line Feed, Unused, Unused */ + 0, 0, 0, /* Carriage Return, Unused, Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused */ + 0, 0, 0, /* Unused, Unused, Space */ + 0, 0, 0, /* ! " # */ + 0, 0, 0, /* $ % & */ + 0, 0, 0, /* ! ( ) */ + 0, 0, 0, /* * + , */ + 0, 0, 0, /* - . / */ + 0, 0, /* 0 1 */ + 0, 0, /* 2 3 */ + 0, 0, /* 4 5 */ + 0, 0, /* 6 7 */ + 0, 0, /* 8 9 */ + 0, 0, /* : ; */ + 0, 0, 0, /* < = > */ + 0, 0, /* ? @ */ + 0, 0, 0, /* A B C */ + 0, 0, 0, /* D E F */ + 0, 0, 0, /* G H I */ + 0, 0, 0, /* J K L */ + 0, 0, 0, /* M N O */ + 0, 0, 0, /* P Q R */ + 0, 0, 0, /* S T U */ + 0, 0, 0, /* V W X */ + 0, /* Y */ + 0, /* Z */ + 0, 0, 0, /* [ \ ] */ + 0, 0, 0, /* ^ _ ` */ + UMODE_a, UMODE_b, UMODE_c, /* a b c */ + UMODE_d, 0, UMODE_f, /* d e f */ + UMODE_g, 0, UMODE_i, /* g h i */ + 0, UMODE_k, UMODE_l, /* j k l */ + 0, UMODE_n, UMODE_o, /* m n o */ + 0, 0, UMODE_r, /* p q r */ + UMODE_s, 0, UMODE_u, /* s t u */ + 0, UMODE_w, UMODE_x, /* v w x */ + UMODE_y, /* y */ + UMODE_z, /* z */ + 0, 0, 0, /* { | } */ + 0, 0 /* ~ ‚ */ }; + char csmodes[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 'a', /* (33) ! Channel Admins */ + 'a', /* (33) ! */ 0, 0, 0, - 0, + 'h', 0, 0, 0, 0, 0, @@ -232,22 +265,44 @@ char csmodes[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - CMMode cmmodes[128] = { - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, - {NULL}, - {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, + {NULL}, {NULL}, {NULL}, /* BCD */ + {NULL}, {NULL}, {NULL}, /* EFG */ + {NULL}, /* H */ + {add_invite, del_invite}, + {NULL}, /* J */ + {NULL}, {NULL}, {NULL}, /* KLM */ + {NULL}, {NULL}, {NULL}, /* NOP */ + {NULL}, {NULL}, {NULL}, /* QRS */ + {NULL}, {NULL}, {NULL}, /* TUV */ + {NULL}, {NULL}, {NULL}, /* WXY */ + {NULL}, /* Z */ + {NULL}, {NULL}, /* (char 91 - 92) */ + {NULL}, {NULL}, {NULL}, /* (char 93 - 95) */ + {NULL}, /* ` (char 96) */ + {NULL}, /* a (char 97) */ {add_ban, del_ban}, {NULL}, {NULL}, @@ -465,7 +520,7 @@ void anope_cmd_global(char *source, const char *fmt, ...) return; } - send_cmd(source ? source : ServerName, "WALLOPS :%s", buf); + send_cmd(source ? source : ServerName, "OPERWALL :%s", buf); } @@ -538,14 +593,14 @@ void moduleAddIRCDMsgs(void) { m = createMessage("401", NULL); addCoreMessage(IRCD,m); m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("INVITE", NULL); addCoreMessage(IRCD,m); + m = createMessage("INVITE", anope_event_invite); addCoreMessage(IRCD,m); m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("NOTICE", NULL); addCoreMessage(IRCD,m); + m = createMessage("NOTICE", anope_event_notice); addCoreMessage(IRCD,m); m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); m = createMessage("PASS", anope_event_pass); addCoreMessage(IRCD,m); m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); @@ -553,8 +608,6 @@ void moduleAddIRCDMsgs(void) { m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); - m = createMessage("STATS", m_stats); addCoreMessage(IRCD,m); - m = createMessage("TIME", m_time); addCoreMessage(IRCD,m); m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); m = createMessage("USER", NULL); addCoreMessage(IRCD,m); m = createMessage("WALLOPS", NULL); addCoreMessage(IRCD,m); @@ -575,8 +628,9 @@ void moduleAddIRCDMsgs(void) { m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); m = createMessage("SJOIN", anope_event_sjoin); addCoreMessage(IRCD,m); m = createMessage("SVINFO", anope_event_svinfo); addCoreMessage(IRCD,m); - - + m = createMessage("EOB", anope_event_eob); addCoreMessage(IRCD,m); + m = createMessage("ADMIN", anope_event_admin); addCoreMessage(IRCD,m); + m = createMessage("ERROR", anope_event_error); addCoreMessage(IRCD,m); } /* *INDENT-ON* */ @@ -605,6 +659,11 @@ void anope_cmd_svsnoop(char *server, int set) /* does not support */ } +void anope_cmd_svsadmin(char *server, int set) +{ + anope_cmd_svsnoop(server, set); +} + void anope_cmd_sgline(char *mask, char *reason) { /* does not support */ @@ -718,9 +777,30 @@ void anope_cmd_svinfo() } /* CAPAB */ +/* + QS - Can handle quit storm removal + EX - Can do channel +e exemptions + CHW - Can do channel wall @# + LL - Can do lazy links + IE - Can do invite exceptions + EOB - Can do EOB message + KLN - Can do KLINE message + GLN - Can do GLINE message + HOPS - can do half ops (+h) + HUB - This server is a HUB + AOPS - Can do anon ops (+a) + UID - Can do UIDs + ZIP - Can do ZIPlinks + ENC - Can do ENCrypted links + KNOCK - supports KNOCK + TBURST - supports TBURST + PARA - supports invite broadcasting for +p + ENCAP - ? +*/ void anope_cmd_capab() { - send_cmd(NULL, "CAPAB TS5 EX IE HOPS HUB AOPS"); + send_cmd(NULL, + "CAPAB :QS EX CHW IE EOB KLN GLN HOPS HUB AOPS KNOCK TBURST PARA"); } /* PASS */ @@ -738,6 +818,7 @@ void anope_cmd_server(char *servname, int hop, char *descript) void anope_cmd_bot_nick(char *nick, char *user, char *host, char *real, char *modes) { + EnforceQlinedNick(nick, s_BotServ); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, time(NULL), modes, user, host, ServerName, real); @@ -799,6 +880,21 @@ int anope_event_kick(char *source, int ac, char **av) return MOD_CONT; } +int anope_event_eob(char *source, int ac, char **av) +{ + Server *s; + s = findserver(servlist, source); + if (s) { + s->sync = 1; + } + return MOD_CONT; +} + +void anope_cmd_eob() +{ + send_cmd(ServerName, "EOB"); +} + int anope_event_join(char *source, int ac, char **av) { @@ -849,7 +945,7 @@ int anope_event_server(char *source, int ac, char **av) if (!stricmp(av[1], "1")) uplink = sstrdup(av[0]); - do_server(source, ac, av); + do_server(source, av[0], av[1], av[2], NULL); return MOD_CONT; } @@ -1106,6 +1202,7 @@ void anope_cmd_mode(char *source, char *dest, const char *fmt, ...) void anope_cmd_nick(char *nick, char *name, char *mode) { + EnforceQlinedNick(nick, NULL); send_cmd(NULL, "NICK %s 1 %ld %s %s %s %s :%s", nick, time(NULL), mode, ServiceUser, ServiceHost, ServerName, (name)); } @@ -1150,7 +1247,7 @@ void anope_cmd_notice_ops(char *source, char *dest, const char *fmt, ...) void anope_cmd_bot_chan_mode(char *nick, char *chan) { - anope_cmd_mode(nick, chan, "%s %s %s", ircd->botchanumode, nick, nick); + anope_cmd_mode(nick, chan, "%s %s", ircd->botchanumode, nick); } /* QUIT */ @@ -1317,4 +1414,51 @@ int anope_event_pass(char *source, int ac, char **av) return MOD_CONT; } +void anope_cmd_svsjoin(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_svspart(char *source, char *nick, char *chan) +{ + /* Not Supported by this IRCD */ +} + +void anope_cmd_swhois(char *source, char *who, char *mask) +{ + /* not supported */ +} + +int anope_event_notice(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_admin(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_event_invite(char *source, int ac, char **av) +{ + return MOD_CONT; +} + +int anope_flood_mode_check(char *value) +{ + return 0; +} + +int anope_event_error(char *source, int ac, char **av) +{ + if (ac >= 1) { + if (debug) { + alog("ERROR: %s", av[0]); + } + } + return MOD_CONT; +} + + + #endif diff --git a/src/init.c b/src/init.c index 2ff23d437..486c54e82 100644 --- a/src/init.c +++ b/src/init.c @@ -34,103 +34,85 @@ void introduce_user(const char *user) /* NickServ */ if (!user || stricmp(user, s_NickServ) == 0) { - EnforceQlinedNick(s_NickServ, NULL); anope_cmd_nick(s_NickServ, desc_NickServ, ircd->nickservmode); } /* ChanServ */ if (!user || stricmp(user, s_ChanServ) == 0) { - EnforceQlinedNick(s_ChanServ, NULL); anope_cmd_nick(s_ChanServ, desc_ChanServ, ircd->chanservmode); } if (s_HostServ && ircd->vhost && (!user || stricmp(user, s_HostServ) == 0)) { - EnforceQlinedNick(s_HostServ, NULL); anope_cmd_nick(s_HostServ, desc_HostServ, ircd->hostservmode); } if (!user || stricmp(user, s_MemoServ) == 0) { - EnforceQlinedNick(s_MemoServ, NULL); anope_cmd_nick(s_MemoServ, desc_MemoServ, ircd->memoservmode); } if (s_BotServ && (!user || stricmp(user, s_BotServ) == 0)) { - EnforceQlinedNick(s_BotServ, NULL); anope_cmd_nick(s_BotServ, desc_BotServ, ircd->botservmode); } if (!user || stricmp(user, s_HelpServ) == 0) { - EnforceQlinedNick(s_HelpServ, NULL); anope_cmd_nick(s_HelpServ, desc_HelpServ, ircd->helpservmode); } if (!user || stricmp(user, s_OperServ) == 0) { - EnforceQlinedNick(s_OperServ, NULL); anope_cmd_nick(s_OperServ, desc_OperServ, ircd->operservmode); } if (s_DevNull && (!user || stricmp(user, s_DevNull) == 0)) { - EnforceQlinedNick(s_DevNull, NULL); anope_cmd_nick(s_DevNull, desc_DevNull, ircd->devnullmode); } if (!user || stricmp(user, s_GlobalNoticer) == 0) { - EnforceQlinedNick(s_GlobalNoticer, NULL); anope_cmd_nick(s_GlobalNoticer, desc_GlobalNoticer, ircd->globalmode); } /* We make aliases go online */ if (s_NickServAlias && (!user || stricmp(user, s_NickServAlias) == 0)) { - EnforceQlinedNick(s_NickServAlias, NULL); anope_cmd_nick(s_NickServAlias, desc_NickServAlias, ircd->nickservaliasmode); } if (s_ChanServAlias && (!user || stricmp(user, s_ChanServAlias) == 0)) { - EnforceQlinedNick(s_ChanServAlias, NULL); anope_cmd_nick(s_ChanServAlias, desc_ChanServAlias, ircd->chanservaliasmode); } if (s_MemoServAlias && (!user || stricmp(user, s_MemoServAlias) == 0)) { - EnforceQlinedNick(s_MemoServAlias, NULL); anope_cmd_nick(s_MemoServAlias, desc_MemoServAlias, ircd->memoservaliasmode); } if (s_BotServAlias && (!user || stricmp(user, s_BotServAlias) == 0)) { - EnforceQlinedNick(s_BotServAlias, NULL); anope_cmd_nick(s_BotServAlias, desc_BotServAlias, ircd->botservaliasmode); } if (s_HelpServAlias && (!user || stricmp(user, s_HelpServAlias) == 0)) { - EnforceQlinedNick(s_HelpServAlias, NULL); anope_cmd_nick(s_HelpServAlias, desc_HelpServAlias, ircd->helpservaliasmode); } if (s_OperServAlias && (!user || stricmp(user, s_OperServAlias) == 0)) { - EnforceQlinedNick(s_OperServAlias, NULL); anope_cmd_nick(s_OperServAlias, desc_OperServAlias, ircd->operservaliasmode); } if (s_DevNullAlias && (!user || stricmp(user, s_DevNullAlias) == 0)) { - EnforceQlinedNick(s_DevNullAlias, NULL); anope_cmd_nick(s_DevNullAlias, desc_DevNullAlias, ircd->devnullvaliasmode); } if (s_HostServAlias && ircd->vhost && (!user || stricmp(user, s_HostServAlias) == 0)) { - EnforceQlinedNick(s_HostServAlias, NULL); anope_cmd_nic