From b1c866a376fd2f65418ce3b3b43bddd4196fa13f Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Thu, 13 Apr 2000 02:29:53 +0000 Subject: [PATCH] Author: Kev Log message: First pass in Uworld integration with respect to G-lines--reimplementation of the base routines for handling gline lists. NOTE THAT ALPHA WILL NOT BE COMPILABLE UNTIL M_GLINE.C IN REWRITTEN! Hopefully I'll get to that tomorrow... git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@156 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 21 ++- include/gline.h | 72 +++++--- ircd/channel.c | 1 - ircd/gline.c | 483 ++++++++++++++++++++++++++++++++++++++++++++++++ ircd/m_join.c | 10 +- ircd/s_conf.c | 4 +- ircd/s_err.c | 4 +- 7 files changed, 565 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1b3bf8..f10aee7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2000-04-12 Kevin L. Mitchell + * ircd/s_conf.c (find_kill): replaced call to find_gline() with a + call to gline_find(); also used GlineReason() instead of direct + reference to structure member + + * ircd/m_join.c (m_join): replace bad_channel() calls with calls + to gline_find(name, GLINE_BADCHAN), and also check to see if gline + is active + + * ircd/channel.c: nothing seems to be called anywhere... + + * ircd/s_err.c: update a couple of replies to dovetail with new + semantics + + * ircd/gline.c: begin complete re-implementation of gline.c along + the lines of the final design of jupe.c + + * include/gline.h: begin complete re-implementation of gline.c + along the lines of the final design of jupe.c + * ircd/channel.c (mode_process_clients): fix "Deop of +k user on %s by %s" message... @@ -370,7 +389,7 @@ # # ChangeLog for ircu2.10.11 # -# $Id: ChangeLog,v 1.73 2000-04-12 20:53:22 kev Exp $ +# $Id: ChangeLog,v 1.74 2000-04-13 02:29:53 kev Exp $ # # Insert new changes at beginning of the change list. # diff --git a/include/gline.h b/include/gline.h index 3e709a1..50b9519 100644 --- a/include/gline.h +++ b/include/gline.h @@ -33,32 +33,59 @@ struct Client; -/* - * gflags - */ -#define GLINE_ACTIVE 1 -#define GLINE_IPMASK 2 -#define GLINE_LOCAL 4 - -#define GlineIsActive(g) ((g)->gflags & GLINE_ACTIVE) -#define GlineIsIpMask(g) ((g)->gflags & GLINE_IPMASK) -#define GlineIsLocal(g) ((g)->gflags & GLINE_LOCAL) - -#define SetActive(g) ((g)->gflags |= GLINE_ACTIVE) -#define ClearActive(g) ((g)->gflags &= ~GLINE_ACTIVE) -#define SetGlineIsIpMask(g) ((g)->gflags |= GLINE_IPMASK) -#define SetGlineIsLocal(g) ((g)->gflags |= GLINE_LOCAL) +#define GLINE_MAX_EXPIRE 604800 /* max expire: 7 days */ struct Gline { - struct Gline* next; - struct Gline* prev; - char* host; - char* reason; - char* name; - time_t expire; - unsigned int gflags; + struct Gline *gl_next; + struct Gline**gl_prev_p; + char *gl_user; + char *gl_host; + char *gl_reason; + time_t gl_expire; + time_t gl_lastmod; + unsigned int gl_flags; }; +#define GLINE_ACTIVE 0x0001 +#define GLINE_IPMASK 0x0002 +#define GLINE_BADCHAN 0x0004 +#define GLINE_LOCAL 0x0008 +#define GLINE_ANY 0x0010 +#define GLINE_FORCE 0x0020 + +#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL) + +#define GlineIsActive(g) ((g)->gl_flags & GLINE_ACTIVE) +#define GlineIsIpMask(g) ((g)->gl_flags & GLINE_IPMASK) +#define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN) +#define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL) + +#define GlineUser(g) ((g)->gl_user) +#define GlineHost(g) ((g)->gl_host) +#define GlineReason(g) ((g)->gl_reason) +#define GlineLastMod(g) ((g)->gl_lastmod) + +extern int gline_add(struct Client *cptr, struct Client *sptr, char *userhost, + char *reason, time_t expire, time_t lastmod, + unsigned int flags); +extern int gline_activate(struct Client *cptr, struct Client *sptr, + struct Gline *gline, time_t lastmod); +extern int gline_deactivate(struct Client *cptr, struct Client *sptr, + struct Gline *gline, time_t lastmod); +extern struct Gline *gline_find(char *userhost); +extern struct Gline *gline_lookup(struct Client *cptr); +extern void gline_free(struct Gline *gline); +extern void gline_burst(struct Client *cptr); +extern int gline_resend(struct Client *cptr, struct Gline *gline); +extern int gline_list(struct Client *sptr, char *userhost); +extern void gline_stats(struct Client *sptr); + +#ifdef 0 /* forget it! */ +#define SetActive(g) ((g)->gl_flags |= GLINE_ACTIVE) +#define ClearActive(g) ((g)->gl_flags &= ~GLINE_ACTIVE) +#define SetGlineIsIpMask(g) ((g)->gl_flags |= GLINE_IPMASK) +#define SetGlineIsLocal(g) ((g)->gl_flags |= GLINE_LOCAL) + extern struct Gline* GlobalGlineList; extern struct Gline* BadChanGlineList; @@ -76,5 +103,6 @@ extern void free_gline(struct Gline *gline, struct Gline *prev); extern int bad_channel(const char* name); extern void bad_channel_remove_expired(time_t now); #endif +#endif /* 0 */ #endif /* INCLUDED_gline_h */ diff --git a/ircd/channel.c b/ircd/channel.c index 231834d..2dd8cba 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -21,7 +21,6 @@ */ #include "channel.h" #include "client.h" -#include "gline.h" /* bad_channel */ #include "hash.h" #include "ircd.h" #include "ircd_alloc.h" diff --git a/ircd/gline.c b/ircd/gline.c index b7ffdd9..911fa26 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -37,7 +37,489 @@ struct Gline* GlobalGlineList = 0; struct Gline* BadChanGlineList = 0; +static void +canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user) +{ + char *tmp; + + if (!(tmp = strchr(userhost, '@'))) { + *user_p = def_user; + *host_p = userhost; + } else { + *user_p = userhost; + *(tmp++) = '\0'; + *host_p = tmp; + } +} + +static struct Gline * +make_gline(char *userhost, char *reason, time_t expire, time_t lastmod, + unsigned int flags) +{ + struct Gline *agline; + char *user, *host; + + agline = (struct Gline *)MyMalloc(sizeof(struct Gline)); /* alloc memory */ + assert(0 != agline); + + gline->gl_expire = expire; /* initialize gline... */ + gline->gl_lastmod = lastmod; + gline->gl_flags = flags & GLINE_MASK; + + if (flags & GLINE_BADCHAN) { /* set a BADCHAN gline */ + DupString(gline->gl_user, userhost); /* first, remember channel */ + gline->gl_host = 0; + + gline->gl_next = BadChanGlineList; /* then link it into list */ + gline->gl_prev_p = &BadChanGlineList; + if (BadChanGlineList) + BadChanGlineList->gl_prev_p = &agline->gl_next; + BadChanGlineList = agline; + } else { + canon_userhost(userhost, &user, &host, "*"); /* find user and host */ + + DupString(gline->gl_user, user); /* remember them... */ + DupString(gline->gl_host, host); + + if (check_if_ipmask(host)) /* mark if it's an IP mask */ + gline->gl_flags |= GLINE_IPMASK; + + gline->gl_next = GlobalGlineList; /* then link it into list */ + gline->gl_prev_p = &GlobalGlineList; + if (GlobalGlineList) + GlobalGlineList->gl_prev_p = &agline->gl_next; + GlobalGlineList = agline; + } + + return agline; +} + +static int +do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) +{ + struct Client *acptr; + int fd, retval = 0, tval; + + if (!GlineIsActive(gline)) /* no action taken on inactive glines */ + return 0; + + for (fd = HighestFd; fd >= 0; --fd) { + /* + * get the users! + */ + if ((acptr = LocalClientArray[fd])) { + if (!acptr->user) + continue; + + if ((GlineIsIpMask(gline) ? match(gline->host, acptr->sock_ip) : + match(gline->host, acptr->sockhost)) == 0 && + (!acptr->user->username || + match(gline->name, acptr->user->username) == 0)) { + /* ok, here's one that got G-lined */ + sendto_one(acptr, ":%s %d %s :*** %s.", me.name, ERR_YOUREBANNEDCREEP, + acptr->name, gline->reason); + + /* let the ops know about it */ + sendto_op_mask(SNO_GLINE, "G-line active for %s", + get_client_name(acptr, FALSE)); + + /* and get rid of him */ + if ((tval = exit_client_msg(cptr, acptr, &me, "G-lined (%s)", + gline->reason))) + retval = tval; /* retain killed status */ + } + } + } + + return retval; +} + +static void +propagate_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) +{ + if (GlineIsLocal(gline)) /* don't propagate local glines */ + return; + + if (IsUser(sptr)) { /* select appropriate source */ + assert(0 != gline->gl_lastmod); + sendto_serv_butone(cptr, "%s%s " TOK_GLINE " * %c%s%s%s " TIME_T_FMT " " + TIME_T_FMT " :%s", NumNick(sptr), + GlineIsActive(gline) ? '+' : '-', gline->gl_user, + GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, + gline->gl_expire, gline->gl_lastmod, gline->gl_reason); + } else { + if (gline->gl_lastmod) + sendto_serv_butone(cptr, "%s " TOK_GLINE " * %c%s%s%s " TIME_T_FMT " " + TIME_T_FMT " :%s", NumServ(sptr), + GlineIsActive(gline) ? '+' : '-', gline->gl_user, + GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, + gline->gl_expire, gline->gl_lastmod, + gline->gl_reason); + else + sendto_serv_butone(cptr, "%s " TOK_GLINE " * %c%s%s%s " TIME_T_FMT + " :%s", NumServ(sptr), + GlineIsActive(gline) ? '+' : '-', gline->gl_user, + GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, + gline->gl_expire, gline->gl_reason); + } +} + +int +gline_add(struct Client *cptr, struct Client *sptr, char *userhost, + char *reason, time_t expire, time_t lastmod, unsigned int flags) +{ + struct Gline *agline; + + assert(0 != userhost); + assert(0 != reason); + + /* + * You cannot set a negative (or zero) expire time, nor can you set an + * expiration time for greater than GLINE_MAX_EXPIRE. + */ + if (!(flags & GLINE_FORCE) && (expire <= 0 || expire > GLINE_MAX_EXPIRE)) { + if (!IsServer(sptr) && MyConnect(sptr)) + send_error_to_client(sptr, ERR_BADEXPIRE, expire); + return 0; + } + + expire += TStime(); /* convert from lifetime to timestamp */ + +#ifdef BADCHAN + if (*userhost == '#' || *userhost == '&' || *userhost == '+') + flags |= GLINE_BADCHAN; +#endif + + /* Inform ops... */ + sendto_op_mask(SNO_GLINE, "%s adding %s %s for %s, expiring at " + TIME_T_FMT ": %s", + IsServer(sptr) ? sptr->name : sptr->user->server->name, + flags & GLINE_LOCAL ? "local" : "global", + flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost, + expire, reason); + +#ifdef GPATH + /* and log it */ + if (IsServer(sptr)) + write_log(GPATH, "# " TIME_T_FMT " %s adding %s %s for %s, expiring at " + TIME_T_FMT ": %s\n", TStime(), sptr->name, + flags & GLINE_LOCAL ? "local" : "global", + flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost, expire, + reason); + else + write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s adding %s %s for %s, " + "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name, + sptr->user->username, sptr->user->host, + flags & GLINE_LOCAL ? "local" : "global", + flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost, expire, + reason); +#endif /* GPATH */ + + /* make the gline */ + agline = make_gline(userhost, reason, expire, lastmod, flags); + + propagate_gline(cptr, sptr, agline); + + if (GlineIsBadChan(agline)) + return 0; + +#ifdef GPATH + /* this can be inserted into the conf */ + write_log(GPATH, "%c:%s:%s:%s\n", GlineIsIpMask(agline) ? 'k' : 'K', + GlineHost(agline), GlineReason(agline), GlineUser(agline)); +#endif /* GPATH */ + + return do_gline(cptr, sptr, agline); /* knock off users if necessary */ +} + +int +gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline, + time_t lastmod) +{ + assert(0 != gline); + + gline->gl_flags |= GLINE_ACTIVE; + gline->gl_lastmod = lastmod; + + /* Inform ops and log it */ + sendto_op_mask(SNO_GLINE, "%s activating %s %s for %s%s%s, expiring at " + TIME_T_FMT ": %s", + IsServer(sptr) ? sptr->name : sptr->user->server->name, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); + +#ifdef GPATH + if (IsServer(sptr)) + write_log(GPATH, "# " TIME_T_FMT " %s activating %s %s for %s%s%s, " + "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); + else + write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s activating %s %s for " + "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name, + sptr->user->username, sptr->user->host, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); +#endif /* GPATH */ + + propagate_gline(cptr, sptr, gline); + + return GlineIsBadChan(gline) ? 0 : do_gline(cptr, sptr, gline); +} + +int +gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline, + time_t lastmod) +{ + assert(0 != gline); + + gline->gl_flags &= ~GLINE_ACTIVE; + gline->gl_lastmod = lastmod; + + /* Inform ops and log it */ + sendto_op_mask(SNO_GLINE, "%s deactivating %s %s for %s%s%s, expiring at " + TIME_T_FMT ": %s", + IsServer(sptr) ? sptr->name : sptr->user->server->name, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); + +#ifdef GPATH + if (IsServer(sptr)) + write_log(GPATH, "# " TIME_T_FMT " %s deactivating %s %s for %s%s%s, " + "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); + else + write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s deactivating %s %s for " + "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name, + sptr->user->username, sptr->user->host, + GlineIsLocal(gline) ? "local" : "global", + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", + gline->gl_user, GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + gline->gl_reason); +#endif /* GPATH */ + + propagate_gline(cptr, sptr, gline); + + return 0; +} + +struct Gline * +gline_find(char *userhost, unsigned int flags) +{ + struct Gline *gline; + struct Gline *sgline; + char *user, *host, *t_uh; + + if (flags & (GLINE_BADCHAN | GLINE_ANY)) { + for (gline = BadChanGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else if (match(gline->gl_user, userhost) == 0) + return gline; + } + } + + if ((flags & (GLINE_BADCHAN | GLINE_ANY)) == GLINE_BADCHAN) + return 0; + + DupString(t_uh, userhost); + canon_userhost(t_uh, &user, &host, 0); + + for (gline = GlobalGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else if (match(gline->host, host) == 0 && + ((!user && ircd_strcmp(gline->user, "*") == 0) || + match(gline->user, user) == 0)) + break; + } + + MyFree(t_uh); + + return gline; +} + +struct Gline * +gline_lookup(struct Client *cptr) +{ + struct Gline *gline; + struct Gline *sgline; + + for (gline = GlobalGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else if ((GlineIsIpMask(gline) ? + match(gline->gl_host, cptr->sock_ip) : + match(gline->gl_host, cptr->sockhost)) == 0 && + match(gline->gl_user, cptr->user->username) == 0) + return gline; + } + + return 0; +} + +void +gline_free(struct Gline *gline) +{ + assert(0 != gline); + + *gline->gl_prev_p = gline->gl_next; /* squeeze this gline out */ + if (gline->gl_next) + gline->gl_next->gl_prev_p = gline->gl_prev_p; + + MyFree(gline->gl_user); /* free up the memory */ + if (gline->gl_host) + MyFree(gline->gl_host); + MyFree(gline->gl_reason); + MyFree(gline); +} + +void +gline_burst(struct Client *cptr) +{ + struct Gline *gline; + struct Gline *sgline; + + for (gline = GlobalGlineList; gline; gline = sgline) { /* all glines */ + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) /* expire any that need expiring */ + gline_free(gline); + else if (!GlineIsLocal(gline) && gline->gl_lastmod) + sendto_one(cptr, "%s " TOK_GLINE " * %c%s@%s " TIME_T_FMT " " TIME_T_FMT + " :%s", NumServ(&me), GlineIsActive(gline) ? '+' : '-', + gline->gl_user, gline->gl_host, gline->gl_expire, + gline->gl_lastmod, gline->gl_reason); + } + + for (gline = BadChanGlineList; gline; gline = sgline) { /* all glines */ + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) /* expire any that need expiring */ + gline_free(gline); + else if (!GlineIsLocal(gline) && gline->gl_lastmod) + sendto_one(cptr, "%s " TOK_GLINE " * %c%s " TIME_T_FMT " " TIME_T_FMT + " :%s", NumServ(&me), GlineIsActive(gline) ? '+' : '-', + gline->gl_user, gline->gl_expire, gline->gl_lastmod, + gline->gl_reason); + } +} + +int +gline_resend(struct Client *cptr, struct Gline *gline) +{ + if (GlineIsLocal(gline) || !gline->gl_lastmod) + return 0; + + if (GlineIsBadChan(gline)) + sendto_one(cptr, "%s " TOK_GLINE " * %c%s " TIME_T_FMT " " TIME_T_FMT + " :%s", NumServ(&me), GlineIsActive(gline) ? '+' : '-', + gline->gl_user, gline->gl_expire, gline->gl_lastmod, + gline->gl_reason); + else + sendto_one(cptr, "%s " TOK_GLINE " * %c%s@%s " TIME_T_FMT " " TIME_T_FMT + " :%s", NumServ(&me), GlineIsActive(gline) ? '+' : '-', + gline->gl_user, gline->gl_host, gline->gl_expire, + gline->gl_lastmod, gline->gl_reason); + + return 0; +} + +int +gline_list(struct Client *sptr, char *userhost) +{ + struct Gline *gline; + struct Gline *sgline; + + if (userhost) { + if (!(gline = gline_find(userhost, GLINE_ANY))) { /* no such gline */ + send_error_to_client(sptr, ERR_NOSUCHGLINE, userhost); + return 0; + } + + /* send gline information along */ + sendto_one(sptr, rpl_str(GLIST), me.name, sptr->name, gline->gl_user, + GlineIsBadChan(gline) ? "" : "@", + GlineIsBadChan(gline) ? "" : gline->gl_host, gline->gl_expire, + GlineIsLocal(gline) ? me.name : "*", + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + } else { + for (gline = GlobalGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else + sendto_one(sptr, rpl_str(GLIST), me.name, sptr->name, gline->gl_user, + "@", gline->gl_host, gline->gl_expire, + GlineIsLocal(gline) ? me.name : "*", + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + } + + for (gline = BadChanGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else + sendto_one(sptr, rpl_str(GLIST), me.name, sptr->name, gline->gl_user, + "", "", gline->gl_expire, + GlineIsLocal(gline) ? me.name : "*", + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + } + } + + /* end of gline information */ + sendto_one(cptr, rpl_str(RPL_ENDOFGLIST), me.name, sptr->name); + return 0; +} + +void +gline_stats(struct Client *sptr) +{ + struct Gline *gline; + struct Gline *sgline; + + for (gline = GlobalGlineList; gline; gline = sgline) { + sgline = gline->gl_next; + + if (gline->gl_expire <= TStime()) + gline_free(gline); + else + sendto_one(sptr, rpl_str(RPL_STATSGLINE), me.name, sptr->name, 'G', + gline->gl_user, gline->gl_host, gline->gl_expire, + gline->gl_reason); + } +} + +#if 0 /* forget about it! */ struct Gline *make_gline(int is_ipmask, char *host, char *reason, char *name, time_t expire) { @@ -265,3 +747,4 @@ void add_gline(struct Client *sptr, int ip_mask, char *host, char *comment, } } +#endif /* 0 */ diff --git a/ircd/m_join.c b/ircd/m_join.c index 91d04d3..d1408d9 100644 --- a/ircd/m_join.c +++ b/ircd/m_join.c @@ -200,7 +200,10 @@ int m_join(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (MyConnect(sptr)) { #ifdef BADCHAN - if (bad_channel(name) && !IsAnOper(sptr)) + struct Gline *gline; + + if ((gline = gline_find(name, GLINE_BADCHAN)) && + GlineIsActive(gline) && !IsAnOper(sptr)) { sendto_one(sptr, err_str(ERR_BADCHANNAME), me.name, parv[0], name); continue; @@ -625,7 +628,10 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (MyConnect(sptr)) { #ifdef BADCHAN - if (bad_channel(name) && !IsAnOper(sptr)) + struct Gline *gline; + + if ((gline = gline_find(name, GLINE_BADCHAN)) && + GlineIsActive(gline) && !IsAnOper(sptr)) { sendto_one(sptr, err_str(ERR_BADCHANNAME), me.name, parv[0], name); continue; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index ab575d3..a7013eb 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1445,9 +1445,9 @@ int find_kill(struct Client *cptr) /* find active glines */ /* added a check against the user's IP address to find_gline() -Kev */ - else if ((agline = find_gline(cptr, NULL)) && GlineIsActive(agline)) + else if ((agline = gline_find(cptr, 0)) && GlineIsActive(agline)) sendto_one(cptr, ":%s %d %s :%s.", me.name, ERR_YOUREBANNEDCREEP, - cptr->name, agline->reason); + cptr->name, GlineReason(agline)); else agline = NULL; /* if a gline was found, it was inactive */ diff --git a/ircd/s_err.c b/ircd/s_err.c index aa1fa23..db98f4c 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -294,7 +294,7 @@ static Numeric numeric_errors[] = { /* 511 */ { ERR_SILELISTFULL, "%s :Your silence list is full", "511" }, /* 512 */ - { ERR_NOSUCHGLINE, "%s@%s :No such gline", "512" }, + { ERR_NOSUCHGLINE, "%s :No such gline", "512" }, /* 513 */ { ERR_BADPING, "", "513" }, /* 514 */ @@ -675,7 +675,7 @@ static Numeric numeric_replies[] = { /* 279 */ { 0 }, /* 280 */ - { RPL_GLIST, "%s@%s " TIME_T_FMT " %s%s", "280" }, + { RPL_GLIST, "%s%s%s " TIME_T_FMT " %s %c :%s", "280" }, /* 281 */ { RPL_ENDOFGLIST, ":End of G-line List", "281" }, /* 282 */ -- 2.20.1