Log message:
Fix G-line bugs reguarding U-lined servers that Maniac- pointed out; fix a
bug in /list
1) If a new server signed on and a U-lined server re-issued a G-line,
intermediate servers would not pass on that message. Logic has been
added to detect that it's a re-issued G-line, and the existing G-line is
repropagated. Note that the expire time used is the time we think the
G-line has left, not what the U-lined server tells us.
2) If a U-lined server attempted to revoke a G-line, and we didn't have
that G-line, not only would we ignore the message, we would fail to
propagate it and return a "not enough parameters" reply. Corrected by
manually repropagating the G-line removal.
3) If a U-lined server attempted to add (or update, or re-issue) a G-line
we knew about, that G-line's lastmod time would be updated, causing us
to no longer consider the G-line as having been issued by a U-lined
server. This causes promotions we don't want occuring. Corrected by
prohibiting lastmod updates when the existing lastmod is 0.
4) The /list command would not deal properly with "LIST #channel", but
would do the right thing if we did "LIST #channel <anything else>".
This was just a logic inversion problem--I said "parc != 2" when I meant
"parc == 2".
Testing:
The /list command now works correctly. G-lines issued by U-lined servers
are doing the right thing. I have not checked that G-lines issued by opers
are still working correctly, so this needs to be checked. Also, all forms
of local G-line need to be double-checked.
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@384
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
+2001-02-12 Kevin L. Mitchell <klmitch@mit.edu>
+
+ * ircd/m_gline.c (ms_gline): propagate a G-line that happened to
+ have been added by a U-lined server, rather than going through the
+ activate/deactivate logic; propagate G-line removals by U-lined
+ servers as well
+
+ * ircd/gline.c: rename propagate_gline() to gline_propagate();
+ make gline_propagate() return an int 0 (convenience return); only
+ update lastmod in gline_activate() and gline_deactivate() if the
+ current lastmod is non-zero, since 0 lastmod is our flag of a
+ U-lined server having added a G-line
+
+ * include/gline.h (gline_propagate): exporting the G-line
+ propagation function
+
+ * ircd/m_list.c (m_list): duh; permit explicit channel name
+ specification only when /list gets two arguments ("Kev
+ #wasteland") rather than when /list gets more than two
+ arguments--nice braino
+
2001-01-29 Thomas Helvey <twhelvey1@home.com>
* ircd/ircd_reply.c (need_more_params): fix bug that allowed
#define GlineReason(g) ((g)->gl_reason)
#define GlineLastMod(g) ((g)->gl_lastmod)
+extern int gline_propagate(struct Client *cptr, struct Client *sptr,
+ struct Gline *gline);
extern int gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
char *reason, time_t expire, time_t lastmod,
unsigned int flags);
return retval;
}
-static void
-propagate_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
+int
+gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline)
{
if (GlineIsLocal(gline) || (IsUser(sptr) && !gline->gl_lastmod))
- return;
+ return 0;
if (gline->gl_lastmod)
sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu :%s",
gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
GlineIsBadChan(gline) ? "" : gline->gl_host,
gline->gl_expire - CurrentTime, gline->gl_reason);
+
+ return 0;
}
int
if (!agline) /* if it overlapped, silently return */
return 0;
- propagate_gline(cptr, sptr, agline);
+ gline_propagate(cptr, sptr, agline);
if (GlineIsBadChan(agline))
return 0;
else {
gline->gl_flags |= GLINE_ACTIVE;
- if (gline->gl_lastmod >= lastmod) /* force lastmod to increase */
- gline->gl_lastmod++;
- else
- gline->gl_lastmod = lastmod;
+ if (gline->gl_lastmod) {
+ if (gline->gl_lastmod >= lastmod) /* force lastmod to increase */
+ gline->gl_lastmod++;
+ else
+ gline->gl_lastmod = lastmod;
+ }
}
if ((saveflags & GLINE_ACTMASK) == GLINE_ACTIVE)
gline->gl_expire + TSoffset, gline->gl_reason);
if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
- propagate_gline(cptr, sptr, gline);
+ gline_propagate(cptr, sptr, gline);
return GlineIsBadChan(gline) ? 0 : do_gline(cptr, sptr, gline);
}
else {
gline->gl_flags &= ~GLINE_ACTIVE;
- if (gline->gl_lastmod >= lastmod)
- gline->gl_lastmod++;
- else
- gline->gl_lastmod = lastmod;
+ if (gline->gl_lastmod) {
+ if (gline->gl_lastmod >= lastmod)
+ gline->gl_lastmod++;
+ else
+ gline->gl_lastmod = lastmod;
+ }
}
if ((saveflags & GLINE_ACTMASK) != GLINE_ACTIVE)
gline->gl_expire + TSoffset, gline->gl_reason);
if (!(flags & GLINE_LOCAL)) /* don't propagate local changes */
- propagate_gline(cptr, sptr, gline);
+ gline_propagate(cptr, sptr, gline);
/* if it's a local gline or a Uworld gline (and not locally deactivated).. */
if (GlineIsLocal(gline) || (!gline->gl_lastmod && !(flags & GLINE_LOCAL)))
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);
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");
args = la_init; /* initialize argument to blank slate */
for (param = 1; parv[param]; param++) { /* process each parameter */
- switch (param_parse(sptr, parv[param], &args, parc != 2)) {
+ switch (param_parse(sptr, parv[param], &args, parc == 2)) {
case LPARAM_ERROR: /* error encountered, usage already sent, return */
return 0;
break;