X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fgline.c;h=dfbf77d2394fdc38e946d9423fa68ba267edb20e;hb=e471b5cc12c5c0eb40422df1e755123e534f0934;hp=487dde94962d28779587bb39f5f7db5d69f4ff8d;hpb=2575d32764863d3d571794f433e407d21a06032a;p=ircu2.10.12-pk.git diff --git a/ircd/gline.c b/ircd/gline.c index 487dde9..dfbf77d 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -349,10 +349,11 @@ gline_propagate(struct Client *cptr, struct Client *sptr, struct Gline *gline) /** Count number of users who match \a mask. * @param[in] mask user\@host or user\@ip mask to check. + * @param[in] flags Bitmask possibly containing the value GLINE_LOCAL, to limit searches to this server. * @return Count of matching users. */ static int -count_users(char *mask) +count_users(char *mask, int flags) { struct irc_in_addr ipmask; struct Client *acptr; @@ -366,6 +367,8 @@ count_users(char *mask) for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { if (!IsUser(acptr)) continue; + if ((flags & GLINE_LOCAL) && !MyConnect(acptr)) + continue; ircd_snprintf(0, namebuf, sizeof(namebuf), "%s@%s", cli_user(acptr)->username, cli_user(acptr)->host); @@ -485,7 +488,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, break; } - if ((tmp = count_users(uhmask)) >= + if ((tmp = count_users(uhmask, flags)) >= feature_int(FEAT_GLINEMAXUSERCOUNT) && !(flags & GLINE_OPERFORCE)) return send_reply(sptr, ERR_TOOMANYUSERS, tmp); } @@ -500,6 +503,9 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, if (!IsServer(sptr) && MyConnect(sptr)) send_reply(sptr, ERR_BADEXPIRE, expire); return 0; + } else if (expire <= CurrentTime) { + /* This expired G-line was forced to be added, so mark it inactive. */ + flags &= ~GLINE_ACTIVE; } if (!lifetime) /* no lifetime set, use expiration time */ @@ -509,11 +515,12 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost, /* Inform ops... */ sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE : - SNO_AUTO, "%s adding %s %s for %s%s%s, expiring at " + SNO_AUTO, "%s adding %s%s %s for %s%s%s, expiring at " "%Tu: %s", (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? cli_name(sptr) : cli_name((cli_user(sptr))->server), + (flags & GLINE_ACTIVE) ? "" : "deactivated ", (flags & GLINE_LOCAL) ? "local" : "global", (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE", user, (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : "@", @@ -672,42 +679,6 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline, return 0; } -/** Send a deactivation request for a locally unknown G-line. - * @param[in] cptr Client that sent us the G-line modification. - * @param[in] sptr Client that originated the G-line modification. - * @param[in] userhost Text representation of G-line target. - * @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. - * @return Zero. - */ -int -gline_forward_deactivation(struct Client *cptr, struct Client *sptr, - char *userhost, time_t expire, time_t lastmod, - time_t lifetime, unsigned int flags) -{ - char *msg = "deactivating unknown global"; - - if (!lifetime) - lifetime = expire; - - /* Inform ops and log it */ - sendto_opmask_butone(0, SNO_GLINE, "%s %s GLINE for %s, expiring at %Tu", - (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? - cli_name(sptr) : cli_name((cli_user(sptr))->server), - msg, userhost, expire + TSoffset); - - log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE, - "%#C %s GLINE for %s, expiring at %Tu", sptr, msg, userhost, - expire); - - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* -%s %Tu %Tu %Tu", - userhost, expire, lastmod, lifetime); - - return 0; -} - /** Modify a global G-line. * @param[in] cptr Client that sent us the G-line modification. * @param[in] sptr Client that originated the G-line modification.