X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fgline.c;h=aa16dfa15c8388ae6f8e4bda0469c7077b0946b6;hb=ab92e415c2830825e90398a776313fb0a7ab1728;hp=5ae577e785423b82785191bf4f5fc4d0f001cbea;hpb=5dac8d5087c52b5d957e1cba78605dacf7f8efbd;p=ircu2.10.12-pk.git diff --git a/ircd/gline.c b/ircd/gline.c index 5ae577e..aa16dfa 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -375,7 +375,7 @@ gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline) gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "", gline->gl_expire - CurrentTime, gline->gl_lastmod, - gline->gl_lifetime - CurrentTime, gline->gl_reason); + gline->gl_lifetime, gline->gl_reason); return 0; } @@ -391,7 +391,7 @@ gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline) * @param[in] sptr Client that originated the G-line. * @param[in] userhost Text mask for the G-line. * @param[in] reason Reason for G-line. - * @param[in] expire Duration of G-line in seconds. + * @param[in] expire Expiration time of G-line. * @param[in] lastmod Last modification time of G-line. * @param[in] lifetime Lifetime of G-line. * @param[in] flags Bitwise combination of GLINE_* flags. @@ -464,18 +464,17 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, * 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 (!(flags & GLINE_FORCE) && + (expire <= CurrentTime || expire > CurrentTime + GLINE_MAX_EXPIRE)) { if (!IsServer(sptr) && MyConnect(sptr)) send_reply(sptr, ERR_BADEXPIRE, expire); return 0; } - expire += CurrentTime; /* convert from lifetime to timestamp */ - if (!lifetime) /* no lifetime set, use expiration time */ lifetime = expire; - else /* convert lifetime into timestamp */ - lifetime += CurrentTime; + + /* lifetime is already an absolute timestamp */ /* Inform ops... */ sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE : @@ -650,7 +649,7 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline, * @param[in] gline G-line being modified. * @param[in] action Resultant status of the G-line. * @param[in] reason Reason for G-line. - * @param[in] expire Duration of G-line in seconds. + * @param[in] expire Expiration time of G-line. * @param[in] lastmod Last modification time of G-line. * @param[in] lifetime Lifetime of G-line. * @param[in] flags Bitwise combination of GLINE_* flags. @@ -691,14 +690,12 @@ gline_modify(struct Client *cptr, struct Client *sptr, struct Gline *gline, /* All right, we know that there's a change of some sort. What is it? */ /* first, check out the expiration time... */ if ((flags & GLINE_EXPIRE) && expire) { - if (!(flags & GLINE_FORCE) && (expire <= 0 || expire > GLINE_MAX_EXPIRE)) { + if (!(flags & GLINE_FORCE) && + (expire <= CurrentTime || expire > CurrentTime + GLINE_MAX_EXPIRE)) { if (!IsServer(sptr) && MyConnect(sptr)) /* bad expiration time */ send_reply(sptr, ERR_BADEXPIRE, expire); return 0; } - - /* convert to a timestamp... */ - expire += CurrentTime; } else flags &= ~GLINE_EXPIRE; @@ -709,9 +706,7 @@ gline_modify(struct Client *cptr, struct Client *sptr, struct Gline *gline, } /* Next, check out lifetime--this one's a bit trickier... */ - if ((flags & GLINE_LIFETIME) && lifetime) - lifetime += CurrentTime; /* convert to a timestamp */ - else + if (!(flags & GLINE_LIFETIME) || !lifetime) lifetime = gline->gl_lifetime; /* use G-line lifetime */ lifetime = IRCD_MAX(lifetime, expire); /* set lifetime to the max */ @@ -843,7 +838,7 @@ gline_modify(struct Client *cptr, struct Client *sptr, struct Gline *gline, gline->gl_user, gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "", gline->gl_expire - CurrentTime, gline->gl_lastmod, - gline->gl_lifetime - CurrentTime, gline->gl_reason); + gline->gl_lifetime, gline->gl_reason); /* OK, let's do the G-line... */ return do_gline(cptr, sptr, gline); @@ -1021,7 +1016,7 @@ gline_burst(struct Client *cptr) gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "", gline->gl_expire - CurrentTime, gline->gl_lastmod, - gline->gl_lifetime - CurrentTime, gline->gl_reason); + gline->gl_lifetime, gline->gl_reason); } gliter(BadChanGlineList, gline, sgline) { @@ -1029,7 +1024,7 @@ gline_burst(struct Client *cptr) sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s %Tu %Tu %Tu :%s", GlineIsRemActive(gline) ? '+' : '-', gline->gl_user, gline->gl_expire - CurrentTime, gline->gl_lastmod, - gline->gl_lifetime - CurrentTime, gline->gl_reason); + gline->gl_lifetime, gline->gl_reason); } } @@ -1049,7 +1044,7 @@ gline_resend(struct Client *cptr, struct Gline *gline) gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "", gline->gl_expire - CurrentTime, gline->gl_lastmod, - gline->gl_lifetime - CurrentTime, gline->gl_reason); + gline->gl_lifetime, gline->gl_reason); return 0; }