From 8988448b03e29ce5f7f5febc73def54913212fda Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Sat, 17 Mar 2007 03:48:49 +0000 Subject: [PATCH] Author: Kev Log message: Initial work to update the command syntax and capabilities of G-lines. *NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE*NOTE* While ircu will compile and run, GLINES WILL NOT FUNCTION AS EXPECTED! This commit inserts debugging code that will wallops what actions would be taken to implement a particular G-line received from a remote server, but will not actually take those actions as of yet. DO NOT RUN THIS CODE ON A PRODUCTION NETWORK! Thank you :) git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1774 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 25 ++++ include/gline.h | 9 ++ include/ircd_features.h | 1 + ircd/gline.c | 132 ++++++++--------- ircd/ircd_features.c | 1 + ircd/m_gline.c | 306 +++++++++++++++++++++++++++++++--------- ircd/s_conf.c | 2 +- 7 files changed, 338 insertions(+), 138 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ceca21..4fdaff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2007-03-16 Kevin L. Mitchell + + * ircd/s_conf.c (find_kill): check FEAT_DISABLE_GLINES prior to + checking for a G-line matching a new user + + * ircd/m_gline.c (ms_gline): rework ms_gline() to handle new + command syntax--although it can parse the new syntax, it doesn't + yet perform the actions demanded by that syntax + + * ircd/ircd_features.c: trap-door feature FEAT_DISABLE_GLINES to + disable G-lines + + * ircd/gline.c: create gliter() macro which performs an iteration + over all G-lines in a specified G-line list; initialize record + expire in make_gline() (to be redone); check FEAT_DISABLE_GLINES + in do_gline(); add and document what happens if GLINE_LOCAL is + passed to gline_find() + + * include/ircd_features.h: trap-door feature FEAT_DISABLE_GLINES + to disable G-lines; intended use: accidental G-line of *@* + + * include/gline.h: add rexpire (record expiration time) field to + gline description structure; add GlineAction enumeration (still + undocumented) to describe actions that may be performed on G-lines + 2007-03-09 Michael Poole * include/patchlevel.h (PATCHLEVEL): Bump for .pre11 development. diff --git a/include/gline.h b/include/gline.h index fdbc1b8..0fa3aba 100644 --- a/include/gline.h +++ b/include/gline.h @@ -47,11 +47,20 @@ struct Gline { char *gl_reason; /**< Reason for G-line. */ time_t gl_expire; /**< Expiration timestamp. */ time_t gl_lastmod; /**< Last modification timestamp. */ + time_t gl_rexpire; /**< Record expiration timestamp. */ struct irc_in_addr gl_addr; /**< IP address (for IP-based G-lines). */ unsigned char gl_bits; /**< Usable bits in gl_addr. */ unsigned int gl_flags; /**< G-line status flags. */ }; +enum GlineAction { + GLINE_ACTIVATE, + GLINE_DEACTIVATE, + GLINE_LOCAL_ACTIVATE, + GLINE_LOCAL_DEACTIVATE, + GLINE_MODIFY +}; + #define GLINE_ACTIVE 0x0001 /**< G-line is active. */ #define GLINE_IPMASK 0x0002 /**< gl_addr and gl_bits fields are valid. */ #define GLINE_BADCHAN 0x0004 /**< G-line prohibits users from joining a channel. */ diff --git a/include/ircd_features.h b/include/ircd_features.h index f4b3330..42c54ac 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -59,6 +59,7 @@ enum Feature { FEAT_ZANNELS, FEAT_LOCAL_CHANNELS, FEAT_TOPIC_BURST, + FEAT_DISABLE_GLINES, /* features that probably should not be touched */ FEAT_KILLCHASETIMELIMIT, diff --git a/ircd/gline.c b/ircd/gline.c index 89f79f0..f7cb619 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -68,6 +68,29 @@ struct Gline* GlobalGlineList = 0; /** List of BadChan G-lines. */ struct Gline* BadChanGlineList = 0; +/** Iterate through \a list of G-lines. Use this like a for loop, + * i.e., follow it with braces and use whatever you passed as \a gl + * as a single G-line to be acted upon. + * + * @param[in] list List of G-lines to iterate over. + * @param[in] gl Name of a struct Gline pointer variable that will be made to point to the G-lines in sequence. + * @param[in] next Name of a scratch struct Gline pointer variable. + */ +#define gliter(list, gl, next) \ + /* Iterate through the G-lines in the list */ \ + for ((gl) = (list); (gl); (gl) = (next)) \ + /* Figure out the next pointer in list... */ \ + if ((((next) = (gl)->gl_next) || 1) && \ + /* Then see if it's expired */ \ + (gl)->gl_rexpire <= CurrentTime) \ + /* Record has expired, so free the G-line */ \ + gline_free((gl)); \ + /* See if we need to expire the G-line */ \ + else if (((gl)->gl_expire > CurrentTime || \ + ((gl)->gl_flags &= ~GLINE_ACTIVE)) && 0) \ + ; /* empty statement */ \ + else + /** Find canonical user and host for a string. * If \a userhost starts with '$', assign \a userhost to *user_p and NULL to *host_p. * Otherwise, if \a userhost contains '@', assign the earlier part of it to *user_p and the rest to *host_p. @@ -142,6 +165,7 @@ make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod, DupString(gline->gl_reason, reason); /* initialize gline... */ gline->gl_expire = expire; + gline->gl_rexpire = expire; gline->gl_lastmod = lastmod; gline->gl_flags = flags & GLINE_MASK; @@ -196,6 +220,9 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline) struct Client *acptr; int fd, retval = 0, tval; + if (feature_bool(FEAT_DISABLE_GLINES)) + return 0; /* G-lines are disabled */ + if (GlineIsBadChan(gline)) /* no action taken on badchan glines */ return 0; if (!GlineIsActive(gline)) /* no action taken on inactive glines */ @@ -605,6 +632,7 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline, *
GLINE_ANY
Search both BadChans and user G-lines.
*
GLINE_BADCHAN
Search BadChans.
*
GLINE_GLOBAL
Only match global G-lines.
+ *
GLINE_LOCAL
Only match local G-lines.
*
GLINE_LASTMOD
Only match G-lines with a last modification time.
*
GLINE_EXACT
Require an exact match of G-line mask.
*
anything else
Search user G-lines.
@@ -616,18 +644,15 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline, struct Gline * gline_find(char *userhost, unsigned int flags) { - struct Gline *gline; + struct Gline *gline = 0; 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 <= CurrentTime) - gline_free(gline); - else if ((flags & GLINE_GLOBAL && gline->gl_flags & GLINE_LOCAL) || - (flags & GLINE_LASTMOD && !gline->gl_lastmod)) + gliter(BadChanGlineList, gline, sgline) { + if ((flags & GLINE_GLOBAL && gline->gl_flags & GLINE_LOCAL) || + (flags & GLINE_LOCAL && gline->gl_flags & GLINE_GLOBAL) || + (flags & GLINE_LASTMOD && !gline->gl_lastmod)) continue; else if ((flags & GLINE_EXACT ? ircd_strcmp(gline->gl_user, userhost) : match(gline->gl_user, userhost)) == 0) @@ -642,13 +667,10 @@ gline_find(char *userhost, unsigned int flags) DupString(t_uh, userhost); canon_userhost(t_uh, &user, &host, "*"); - for (gline = GlobalGlineList; gline; gline = sgline) { - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) - gline_free(gline); - else if ((flags & GLINE_GLOBAL && gline->gl_flags & GLINE_LOCAL) || - (flags & GLINE_LASTMOD && !gline->gl_lastmod)) + gliter(GlobalGlineList, gline, sgline) { + if ((flags & GLINE_GLOBAL && gline->gl_flags & GLINE_LOCAL) || + (flags & GLINE_LOCAL && gline->gl_flags & GLINE_GLOBAL) || + (flags & GLINE_LASTMOD && !gline->gl_lastmod)) continue; else if (flags & GLINE_EXACT) { if (((gline->gl_host && host && ircd_strcmp(gline->gl_host, host) == 0) @@ -659,7 +681,7 @@ gline_find(char *userhost, unsigned int flags) if (((gline->gl_host && host && match(gline->gl_host, host) == 0) || (!gline->gl_host && !host)) && (match(gline->gl_user, user) == 0)) - break; + break; } } @@ -680,14 +702,7 @@ gline_lookup(struct Client *cptr, unsigned int flags) struct Gline *gline; struct Gline *sgline; - for (gline = GlobalGlineList; gline; gline = sgline) { - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) { - gline_free(gline); - continue; - } - + gliter(GlobalGlineList, gline, sgline) { if ((flags & GLINE_GLOBAL && gline->gl_flags & GLINE_LOCAL) || (flags & GLINE_LASTMOD && !gline->gl_lastmod)) continue; @@ -747,12 +762,8 @@ 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 <= CurrentTime) /* expire any that need expiring */ - gline_free(gline); - else if (!GlineIsLocal(gline) && gline->gl_lastmod) + gliter(GlobalGlineList, gline, sgline) { + if (!GlineIsLocal(gline) && gline->gl_lastmod) sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s", GlineIsRemActive(gline) ? '+' : '-', gline->gl_user, gline->gl_host ? "@" : "", @@ -761,12 +772,8 @@ gline_burst(struct Client *cptr) gline->gl_reason); } - for (gline = BadChanGlineList; gline; gline = sgline) { /* all glines */ - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) /* expire any that need expiring */ - gline_free(gline); - else if (!GlineIsLocal(gline) && gline->gl_lastmod) + gliter(BadChanGlineList, gline, sgline) { + if (!GlineIsLocal(gline) && gline->gl_lastmod) sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s %Tu %Tu :%s", GlineIsRemActive(gline) ? '+' : '-', gline->gl_user, gline->gl_expire - CurrentTime, gline->gl_lastmod, @@ -820,30 +827,20 @@ gline_list(struct Client *sptr, char *userhost) GlineIsLocal(gline) ? cli_name(&me) : "*", GlineIsActive(gline) ? '+' : '-', gline->gl_reason); } else { - for (gline = GlobalGlineList; gline; gline = sgline) { - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) - gline_free(gline); - else - 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(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); } - for (gline = BadChanGlineList; gline; gline = sgline) { - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) - gline_free(gline); - else - send_reply(sptr, RPL_GLIST, gline->gl_user, "", "", - gline->gl_expire + TSoffset, - GlineIsLocal(gline) ? cli_name(&me) : "*", - GlineIsActive(gline) ? '+' : '-', gline->gl_reason); + gliter(BadChanGlineList, gline, sgline) { + send_reply(sptr, RPL_GLIST, gline->gl_user, "", "", + gline->gl_expire + TSoffset, + GlineIsLocal(gline) ? cli_name(&me) : "*", + GlineIsActive(gline) ? '+' : '-', gline->gl_reason); } } @@ -863,18 +860,13 @@ gline_stats(struct Client *sptr, const struct StatDesc *sd, struct Gline *gline; struct Gline *sgline; - for (gline = GlobalGlineList; gline; gline = sgline) { - sgline = gline->gl_next; - - if (gline->gl_expire <= CurrentTime) - gline_free(gline); - else - send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user, - gline->gl_host ? "@" : "", - gline->gl_host ? gline->gl_host : "", - gline->gl_expire + TSoffset, - GlineIsActive(gline) ? '+' : '-', - gline->gl_reason); + gliter(GlobalGlineList, gline, sgline) { + send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user, + gline->gl_host ? "@" : "", + gline->gl_host ? gline->gl_host : "", + gline->gl_expire + TSoffset, + GlineIsActive(gline) ? '+' : '-', + gline->gl_reason); } } diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index fad403a..fc327b8 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -312,6 +312,7 @@ static struct FeatureDesc { F_B(ZANNELS, 0, 1, 0), F_B(LOCAL_CHANNELS, 0, 1, 0), F_B(TOPIC_BURST, 0, 0, 0), + F_B(DISABLE_GLINES, 0, 0, 0), /* features that probably should not be touched */ F_I(KILLCHASETIMELIMIT, 0, 30, 0), diff --git a/ircd/m_gline.c b/ircd/m_gline.c index 1db879a..546c1b1 100644 --- a/ircd/m_gline.c +++ b/ircd/m_gline.c @@ -123,92 +123,264 @@ int ms_gline(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { struct Client *acptr = 0; - struct Gline *agline; + struct Gline *agline = 0; unsigned int flags = 0; - time_t expire_off, lastmod = 0; - char *mask = parv[2], *target = parv[1], *reason = "No reason"; + enum GlineAction action = GLINE_MODIFY; + time_t expire_off = 0, lastmod = 0, lifetime = 0; + char *mask = parv[2], *target = parv[1], *reason = "No reason", *tmp = 0; - if (*mask == '!') - { + if (parc < 3) + return need_more_params(sptr, "GLINE"); + + if (*mask == '!') { mask++; flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */ - } + } else if (IsServer(sptr)) + flags |= GLINE_FORCE; - if ((parc == 3 && *mask == '-') || parc == 5) - { - if (!find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) - return need_more_params(sptr, "GLINE"); + switch (*mask) { /* handle +, -, <, and > */ + case '+': /* activate the G-line */ + action = GLINE_ACTIVATE; + mask++; + break; - flags |= GLINE_FORCE; - } - else if (parc > 5) - lastmod = atoi(parv[4]); - else - return need_more_params(sptr, "GLINE"); + case '-': /* deactivate the G-line */ + action = GLINE_DEACTIVATE; + mask++; + break; - if (parc > 4) - reason = parv[parc - 1]; + case '>': /* locally activate the G-line */ + action = GLINE_LOCAL_ACTIVATE; + mask++; + break; - if (IsServer(sptr)) - flags |= GLINE_FORCE; + case '<': /* locally deactivate the G-line */ + action = GLINE_LOCAL_DEACTIVATE; + mask++; + break; + } - if (!(target[0] == '*' && target[1] == '\0')) { + /* Now, let's figure out if it's a local or global G-line */ + if (action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE || + (target[0] == '*' && target[1] == '\0')) + flags |= GLINE_GLOBAL; + else { if (!(acptr = FindNServer(target))) - return 0; /* no such server */ + return 0; /* no such server, jump out */ - if (!IsMe(acptr)) { /* manually propagate */ - if (!lastmod) - sendcmdto_one(sptr, CMD_GLINE, acptr, - (parc == 3) ? "%C %s" : "%C %s %s :%s", acptr, mask, - parv[3], reason); - else - sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s %s %s :%s", acptr, - flags & GLINE_OPERFORCE ? "!" : "", mask, parv[3], - parv[4], reason); + flags |= GLINE_LOCAL; + } - return 0; + /* Next, try to find the G-line... */ + if ((flags & GLINE_GLOBAL) || IsMe(acptr)) /* don't bother if it's not me! */ + agline = gline_find(mask, flags | GLINE_ANY | GLINE_EXACT); + + /* We now have all the pieces to tell us what we've got; let's + * put it all together and convert the rest of the arguments. + */ + + /* Handle the local G-lines first... */ + if (flags & GLINE_LOCAL) { + assert(acptr); + + /* normalize the action, first */ + if (action == GLINE_LOCAL_ACTIVATE || action == GLINE_MODIFY) + action = GLINE_ACTIVATE; + else if (action == GLINE_LOCAL_DEACTIVATE) + action = GLINE_DEACTIVATE; + + if (action == GLINE_ACTIVATE) { /* get expiration and reason */ + if (parc < 5) /* check parameter count... */ + return need_more_params(sptr, "GLINE"); + + expire_off = atoi(parv[3]); /* get expiration... */ + reason = parv[parc - 1]; /* and reason */ + + if (IsMe(acptr)) { + /* XXX and create the local G-line */ + sendwallto_group_butone(&me, WALL_DESYNCH, NULL, + "I would create a local G-line here; target " + "%s, mask %s, operforce %s, action %s, " + "expire %Tu, reason: %s", target, mask, + flags & GLINE_OPERFORCE ? "YES" : "NO", + action == GLINE_ACTIVATE ? "+" : "-", + expire_off, reason); + } + } else if (IsMe(acptr)) { /* destroying a local G-line */ + /* XXX destroy the G-line */; + sendwallto_group_butone(&me, WALL_DESYNCH, NULL, + "I would destroy a local G-line here; target " + "%s, mask %s, operforce %s, action %s", target, + mask, flags & GLINE_OPERFORCE ? "YES" : "NO", + action == GLINE_ACTIVATE ? "+" : "-"); } - flags |= GLINE_LOCAL; - } + /* OK, we've converted arguments; if it's not for us, forward */ + /* UPDATE NOTE: Once all servers are updated to u2.10.12.11, the + * format string in this sendcmdto_one() may be updated to omit + * for GLINE_ACTIVATE and to omit , , + * and for GLINE_DEACTIVATE. + */ + if (!IsMe(acptr)) { + sendwallto_group_butone(&me, WALL_DESYNCH, NULL, + "I am forwarding a local G-line to a remote " + "server; target %s, mask %s, operforce %s, " + "action %s, expire %Tu, lastmod %Tu, reason: %s", + target, mask, + flags & GLINE_OPERFORCE ? "YES" : "NO", + action == GLINE_ACTIVATE ? "+" : "-", + expire_off, CurrentTime, reason); + sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s", + acptr, flags & GLINE_OPERFORCE ? "!" : "", + action == GLINE_ACTIVATE ? '+' : '-', mask, expire_off, + CurrentTime, reason); + } - if (*mask == '-') - mask++; - else if (*mask == '+') { - flags |= GLINE_ACTIVE; - mask++; - } else - flags |= GLINE_ACTIVE; + return 0; /* all done */ + } - expire_off = parc < 5 ? 0 : atoi(parv[3]); + /* can't modify a G-line that doesn't exist, so remap to activate */ + if (!agline && action == GLINE_MODIFY) + action = GLINE_ACTIVATE; - agline = gline_find(mask, GLINE_ANY | GLINE_EXACT); + /* OK, let's figure out what other parameters we may have... */ + switch (action) { + case GLINE_LOCAL_ACTIVATE: /* locally activating a G-line */ + case GLINE_LOCAL_DEACTIVATE: /* locally deactivating a G-line */ + break; /* no additional parameters to manipulate */ - if (agline) { - if (GlineIsLocal(agline) && !(flags & GLINE_LOCAL)) /* global over local */ - gline_free(agline); - else if (!lastmod && ((flags & GLINE_ACTIVE) == GlineIsRemActive(agline))) - return gline_propagate(cptr, sptr, agline); - else if (!lastmod || GlineLastMod(agline) < lastmod) { /* new mod */ - if (flags & GLINE_ACTIVE) - return gline_activate(cptr, sptr, agline, lastmod, flags); - else - return gline_deactivate(cptr, sptr, agline, lastmod, flags); - } else if (GlineLastMod(agline) == lastmod || IsBurstOrBurstAck(cptr)) - return 0; - else - return gline_resend(cptr, agline); /* other server desynched WRT gline */ - } else if (parc == 3 && !(flags & GLINE_ACTIVE)) { - /* U-lined server removing a G-line we don't have; propagate the removal - * anyway. - */ - if (!(flags & GLINE_LOCAL)) - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* -%s", mask); - return 0; - } else if (parc < 5) - return need_more_params(sptr, "GLINE"); + case GLINE_ACTIVATE: /* activating a G-line */ + case GLINE_DEACTIVATE: /* deactivating a G-line */ + /* in either of these cases, we have at least a lastmod parameter */ + if (parc < 4) + return need_more_params(sptr, "GLINE"); + else if (parc == 4) /* lastmod only form... */ + lastmod = atoi(parv[3]); + /*FALLTHROUGH*/ + case GLINE_MODIFY: /* modifying a G-line */ + /* convert expire and lastmod, look for lifetime and reason */ + if (parc > 4) { /* protect against fall-through from 4-param form */ + if (parc < 5) + return need_more_params(sptr, "GLINE"); + + expire_off = atoi(parv[3]); /* convert expiration and lastmod */ + lastmod = atoi(parv[4]); + + if (parc > 6) { /* no question, have a lifetime and reason */ + lifetime = atoi(parv[5]); + reason = parv[parc - 1]; + } else if (parc == 6) { /* either a lifetime or a reason */ + if (!agline || /* gline creation, has to be the reason */ + /* trial-convert as lifetime, and if it doesn't fully convert, + * it must be the reason */ + ((lifetime = strtoul(parv[5], &tmp, 10)) && !*tmp)) { + lifetime = 0; + reason = parv[5]; + } + } + } + } - return gline_add(cptr, sptr, mask, reason, expire_off, lastmod, flags); + sendwallto_group_butone(&me, WALL_DESYNCH, NULL, + "I have a global G-line I would act upon now; " + "target %s, mask %s, operforce %s, action %s, " + "expire %Tu, lastmod %Tu, lifetime %Tu, " + "reason: %s; gline %s!", + target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO", + action == GLINE_ACTIVATE ? "+" : + (action == GLINE_DEACTIVATE ? "-" : + (action == GLINE_LOCAL_ACTIVATE ? ">" : + (action == GLINE_LOCAL_DEACTIVATE ? "<" : + "(MODIFY)"))), expire_off, lastmod, lifetime, + reason, agline ? "EXISTS" : "does not exist"); + + /* OK, at this point, we have converted all available parameters. + * Let's actually do the action! + */ + if (agline) + /* XXX modify the G-line */; + + /* XXX create the G-line */return 0; + + + + + +/* if ((parc == 3 && *mask == '-') || parc == 5) */ +/* { */ +/* if (!find_conf_byhost(cli_confs(cptr), cli_name(sptr), CONF_UWORLD)) */ +/* return need_more_params(sptr, "GLINE"); */ + +/* flags |= GLINE_FORCE; */ +/* } */ +/* else if (parc > 5) */ +/* lastmod = atoi(parv[4]); */ +/* else */ +/* return need_more_params(sptr, "GLINE"); */ + +/* if (parc > 4) */ +/* reason = parv[parc - 1]; */ + +/* if (IsServer(sptr)) */ +/* flags |= GLINE_FORCE; */ + +/* if (!(target[0] == '*' && target[1] == '\0')) { */ +/* if (!(acptr = FindNServer(target))) */ +/* return 0; /\* no such server *\/ */ + +/* if (!IsMe(acptr)) { /\* manually propagate *\/ */ +/* if (!lastmod) */ +/* sendcmdto_one(sptr, CMD_GLINE, acptr, */ +/* (parc == 3) ? "%C %s" : "%C %s %s :%s", acptr, mask, */ +/* parv[3], reason); */ +/* else */ +/* sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s %s %s :%s", acptr, */ +/* flags & GLINE_OPERFORCE ? "!" : "", mask, parv[3], */ +/* parv[4], reason); */ + +/* return 0; */ +/* } */ + +/* flags |= GLINE_LOCAL; */ +/* } */ + +/* if (*mask == '-') */ +/* mask++; */ +/* else if (*mask == '+') { */ +/* flags |= GLINE_ACTIVE; */ +/* mask++; */ +/* } else */ +/* flags |= GLINE_ACTIVE; */ + +/* expire_off = parc < 5 ? 0 : atoi(parv[3]); */ + +/* agline = gline_find(mask, GLINE_ANY | GLINE_EXACT); */ + +/* if (agline) { */ +/* if (GlineIsLocal(agline) && !(flags & GLINE_LOCAL)) /\* global over local *\/ */ +/* gline_free(agline); */ +/* else if (!lastmod && ((flags & GLINE_ACTIVE) == GlineIsRemActive(agline))) */ +/* return gline_propagate(cptr, sptr, agline); */ +/* else if (!lastmod || GlineLastMod(agline) < lastmod) { /\* new mod *\/ */ +/* if (flags & GLINE_ACTIVE) */ +/* return gline_activate(cptr, sptr, agline, lastmod, flags); */ +/* else */ +/* return gline_deactivate(cptr, sptr, agline, lastmod, flags); */ +/* } else if (GlineLastMod(agline) == lastmod || IsBurstOrBurstAck(cptr)) */ +/* return 0; */ +/* else */ +/* return gline_resend(cptr, agline); /\* other server desynched WRT gline *\/ */ +/* } else if (parc == 3 && !(flags & GLINE_ACTIVE)) { */ +/* /\* U-lined server removing a G-line we don't have; propagate the removal */ +/* * anyway. */ +/* *\/ */ +/* if (!(flags & GLINE_LOCAL)) */ +/* sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* -%s", mask); */ +/* return 0; */ +/* } else if (parc < 5) */ +/* return need_more_params(sptr, "GLINE"); */ + +/* return gline_add(cptr, sptr, mask, reason, expire_off, lastmod, flags); */ } /* diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 9b37dc2..539a114 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1085,7 +1085,7 @@ int find_kill(struct Client *cptr) return -1; } - if ((agline = gline_lookup(cptr, 0))) { + if (!feature_bool(FEAT_DISABLE_GLINES) && (agline = gline_lookup(cptr, 0))) { /* * find active glines * added a check against the user's IP address to find_gline() -Kev -- 2.20.1