From 7fa71a616dc47b7a83f67d5a266736280c7a040a Mon Sep 17 00:00:00 2001 From: un1c0rn Date: Thu, 20 Feb 2014 09:30:43 +0100 Subject: [PATCH] add ident to admin checking, and add hope --- main.c | 2 +- mod.c | 7 ++++--- shared.h | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 4eaa018..cabb1bd 100644 --- a/main.c +++ b/main.c @@ -95,7 +95,7 @@ static void handle_privmsg(struct bio *b, const char *prefix, const char *ident, if (!ident || !host) return; target = args[0][0] == '#' ? args[0] : prefix; - if (admin(host)) { + if (admin(ident, host)) { if (!strcmp(args[1], "crash")) { *(char *)0 = 0; return; diff --git a/mod.c b/mod.c index 47eb6fc..7aab155 100644 --- a/mod.c +++ b/mod.c @@ -1113,6 +1113,7 @@ static TDB_DATA get_mail_key(const char *nick) static void command_mail(struct bio *b, const char *nick, const char *host, const char *target, char *args) { + const char *ident = &nick[strlen(nick) + 1]; // HACK char *victim, *x; size_t len; int override = 0; @@ -1150,7 +1151,7 @@ static void command_mail(struct bio *b, const char *nick, const char *host, cons *(x++) = 0; last_seen = atoll(val.dptr); } - if (x && !admin(host) && (now - last_seen) < 300 && (!sstrncasecmp(x, "in ") || !sstrncasecmp(x, "joining "))) { + if (x && !admin(ident, host) && (now - last_seen) < 300 && (!sstrncasecmp(x, "in ") || !sstrncasecmp(x, "joining "))) { action(b, target, "would rather not store mail for someone active so recently"); goto out; } else if (last_seen && now - last_seen > 14 * 24 * 3600 && !override) { @@ -1851,7 +1852,7 @@ void privmsg_hook(struct bio *b, const char *prefix, const char *ident, const ch unsigned chan, nick_len; struct command_hash *c; int64_t t = get_time(b, target); - int is_admin = admin(host); + int is_admin = admin(ident, host); chan = args[0][0] == '#'; if (chan) { @@ -1988,7 +1989,7 @@ void command_hook(struct bio *b, const char *prefix, const char *ident, const ch if (!strcasecmp(command, "NOTICE")) { if (nargs < 2 || args[0][0] == '#') return; - if (admin(host)) + if (admin(ident, host)) b->writeline(b, "%s", args[1]); else fprintf(stderr, "%s: %s\n", prefix, args[1]); diff --git a/shared.h b/shared.h index 5155d3e..932abc9 100644 --- a/shared.h +++ b/shared.h @@ -17,7 +17,7 @@ #define ALARM_TIME 240 -static inline unsigned admin(const char *host) +static inline unsigned admin(const char *ident, const char *host) { if (!host) return 0; @@ -29,6 +29,7 @@ static inline unsigned admin(const char *host) !strcmp(host, "HaveConviction-WillTravel") || // Hope !strcmp(host, "unaffiliated/metool") || // Hope !strcmp(host, "Metool.user.gamesurge") || // Hope + (!strcmp(ident, "sid18823") && strstr(host, "gateway/web/irccloud.com/")) || // Hope !strcmp(host, "who.needs.pants.anyway") || // foxie !strcmp(host, "assassin.for.hire") || // foxie !strcmp(host, "bookworm.extraordinaire") || // foxie -- 2.11.4.GIT