Committer : klmitch CVSROOT : /cvsroot/undernet-ircu Module : ircu2.10 Branch tags: u2_10_12_branch Commit time: 2007-03-17 03:49:00 UTC
Modified files: Tag: u2_10_12_branch ChangeLog include/gline.h include/ircd_features.h ircd/gline.c ircd/ircd_features.c ircd/m_gline.c ircd/s_conf.c Log message: Author: Kev <[EMAIL PROTECTED]> 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 :) ---------------------- diff included ---------------------- Index: ircu2.10/ChangeLog diff -u ircu2.10/ChangeLog:1.710.2.154 ircu2.10/ChangeLog:1.710.2.155 --- ircu2.10/ChangeLog:1.710.2.154 Fri Mar 9 15:53:21 2007 +++ ircu2.10/ChangeLog Fri Mar 16 20:48:48 2007 @@ -1,3 +1,28 @@ +2007-03-16 Kevin L. Mitchell <[EMAIL PROTECTED]> + + * 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 [EMAIL PROTECTED] + + * 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 <[EMAIL PROTECTED]> * include/patchlevel.h (PATCHLEVEL): Bump for .pre11 development. Index: ircu2.10/include/gline.h diff -u ircu2.10/include/gline.h:1.17 ircu2.10/include/gline.h:1.17.2.1 --- ircu2.10/include/gline.h:1.17 Mon Oct 4 21:14:44 2004 +++ ircu2.10/include/gline.h Fri Mar 16 20:48:48 2007 @@ -22,7 +22,7 @@ */ /** @file * @brief Structures and APIs for G-line manipulation. - * @version $Id: gline.h,v 1.17 2004/10/05 04:14:44 entrope Exp $ + * @version $Id: gline.h,v 1.17.2.1 2007/03/17 03:48:48 klmitch Exp $ */ #ifndef INCLUDED_sys_types_h #include <sys/types.h> @@ -47,11 +47,20 @@ 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. */ Index: ircu2.10/include/ircd_features.h diff -u ircu2.10/include/ircd_features.h:1.38.2.6 ircu2.10/include/ircd_features.h:1.38.2.7 --- ircu2.10/include/ircd_features.h:1.38.2.6 Sun Feb 25 06:32:41 2007 +++ ircu2.10/include/ircd_features.h Fri Mar 16 20:48:48 2007 @@ -20,7 +20,7 @@ */ /** @file * @brief Public interfaces and declarations for dealing with configurable features. - * @version $Id: ircd_features.h,v 1.38.2.6 2007/02/25 14:32:41 entrope Exp $ + * @version $Id: ircd_features.h,v 1.38.2.7 2007/03/17 03:48:48 klmitch Exp $ */ struct Client; @@ -59,6 +59,7 @@ FEAT_ZANNELS, FEAT_LOCAL_CHANNELS, FEAT_TOPIC_BURST, + FEAT_DISABLE_GLINES, /* features that probably should not be touched */ FEAT_KILLCHASETIMELIMIT, Index: ircu2.10/ircd/gline.c diff -u ircu2.10/ircd/gline.c:1.61.2.1 ircu2.10/ircd/gline.c:1.61.2.2 --- ircu2.10/ircd/gline.c:1.61.2.1 Thu Jun 8 19:12:25 2006 +++ ircu2.10/ircd/gline.c Fri Mar 16 20:48:48 2007 @@ -19,7 +19,7 @@ */ /** @file * @brief Implementation of Gline manipulation functions. - * @version $Id: gline.c,v 1.61.2.1 2006/06/09 02:12:25 entrope Exp $ + * @version $Id: gline.c,v 1.61.2.2 2007/03/17 03:48:48 klmitch Exp $ */ #include "config.h" @@ -68,6 +68,29 @@ /** 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 @@ 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 @@ 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 @@ * <dt>GLINE_ANY</dt><dd>Search both BadChans and user G-lines.</dd> * <dt>GLINE_BADCHAN</dt><dd>Search BadChans.</dd> * <dt>GLINE_GLOBAL</dt><dd>Only match global G-lines.</dd> + * <dt>GLINE_LOCAL</dt><dd>Only match local G-lines.</dd> * <dt>GLINE_LASTMOD</dt><dd>Only match G-lines with a last modification time.</dd> * <dt>GLINE_EXACT</dt><dd>Require an exact match of G-line mask.</dd> * <dt>anything else</dt><dd>Search user G-lines.</dd> @@ -616,18 +644,15 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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->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 @@ 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 @@ 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); } } Index: ircu2.10/ircd/ircd_features.c diff -u ircu2.10/ircd/ircd_features.c:1.50.2.6 ircu2.10/ircd/ircd_features.c:1.50.2.7 --- ircu2.10/ircd/ircd_features.c:1.50.2.6 Sun Feb 25 06:32:41 2007 +++ ircu2.10/ircd/ircd_features.c Fri Mar 16 20:48:49 2007 @@ -18,7 +18,7 @@ */ /** @file * @brief Implementation of configurable feature support. - * @version $Id: ircd_features.c,v 1.50.2.6 2007/02/25 14:32:41 entrope Exp $ + * @version $Id: ircd_features.c,v 1.50.2.7 2007/03/17 03:48:49 klmitch Exp $ */ #include "config.h" @@ -312,6 +312,7 @@ 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), Index: ircu2.10/ircd/m_gline.c diff -u ircu2.10/ircd/m_gline.c:1.26.2.1 ircu2.10/ircd/m_gline.c:1.26.2.2 --- ircu2.10/ircd/m_gline.c:1.26.2.1 Thu Jun 8 19:13:51 2006 +++ ircu2.10/ircd/m_gline.c Fri Mar 16 20:48:49 2007 @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: m_gline.c,v 1.26.2.1 2006/06/09 02:13:51 entrope Exp $ + * $Id: m_gline.c,v 1.26.2.2 2007/03/17 03:48:49 klmitch Exp $ */ /* @@ -123,92 +123,264 @@ 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 + * <lastmod> for GLINE_ACTIVATE and to omit <expire>, <lastmod>, + * and <reason> 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); + } + + return 0; /* all done */ } - if (*mask == '-') - mask++; - else if (*mask == '+') { - flags |= GLINE_ACTIVE; - mask++; - } else - flags |= GLINE_ACTIVE; + /* can't modify a G-line that doesn't exist, so remap to activate */ + if (!agline && action == GLINE_MODIFY) + action = GLINE_ACTIVATE; + + /* 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 */ + + 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]; + } + } + } + } - expire_off = parc < 5 ? 0 : atoi(parv[3]); + 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; - 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); + + +/* 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); */ } /* Index: ircu2.10/ircd/s_conf.c diff -u ircu2.10/ircd/s_conf.c:1.81.2.4 ircu2.10/ircd/s_conf.c:1.81.2.5 --- ircu2.10/ircd/s_conf.c:1.81.2.4 Sun Feb 25 07:41:49 2007 +++ ircu2.10/ircd/s_conf.c Fri Mar 16 20:48:49 2007 @@ -19,7 +19,7 @@ */ /** @file * @brief ircd configuration file driver - * @version $Id: s_conf.c,v 1.81.2.4 2007/02/25 15:41:49 entrope Exp $ + * @version $Id: s_conf.c,v 1.81.2.5 2007/03/17 03:48:49 klmitch Exp $ */ #include "config.h" @@ -1085,7 +1085,7 @@ 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 ----------------------- End of diff ----------------------- _______________________________________________ Patches mailing list Patches@undernet.org http://undernet.sbg.org/mailman/listinfo/patches