*/
#include "regexgline.h"
+#include "../lib/version.h"
+
+MODULE_VERSION("");
typedef struct rg_glinenode {
nick *np;
if (delay->reason->type == 5) {
usercount = delay->np->host->clonecount;
- snprintf(hostname, sizeof(hostname), "*@%s", IPtostr(delay->np->ipaddress));
+ snprintf(hostname, sizeof(hostname), "*@%s", IPtostr(delay->np->p_ipaddr));
}
if((delay->reason->type == 4) || (usercount > rg_max_per_gline)) {
if(!ircd_strcmp(delay->np->ident, tnp->ident))
usercount++;
- snprintf(hostname, sizeof(hostname), "%s@%s", delay->np->ident, IPtostr(delay->np->ipaddress));
+ snprintf(hostname, sizeof(hostname), "%s@%s", delay->np->ident, IPtostr(delay->np->p_ipaddr));
}
if ((delay->reason->type == 6) || (usercount > rg_max_per_gline)) {
}
}
- irc_send("%s GL * +%s %d :%s (ID: %08lx)\r\n", mynumeric->content, hostname, rg_expiry_time, delay->reason->reason->content, delay->reason->glineid);
+ irc_send("%s GL * +%s %d :AUTO: %s (ID: %08lx)\r\n", mynumeric->content, hostname, rg_expiry_time, delay->reason->reason->content, delay->reason->glineid);
rg_deletedelay(delay);
}
return NULL;
}
-void rg_dogline(struct rg_glinelist *gll, nick *np, struct rg_struct *rp, char *matched) { /* PPA: if multiple users match the same user@host or *@host it'll send multiple glines?! */
+int __rg_dogline(struct rg_glinelist *gll, nick *np, struct rg_struct *rp, char *matched) { /* PPA: if multiple users match the same user@host or *@host it'll send multiple glines?! */
char hostname[RG_MASKLEN];
int usercount = 0;
if (rp->type == 2) {
usercount = np->host->clonecount;
- snprintf(hostname, sizeof(hostname), "*@%s", IPtostr(np->ipaddress));
+ snprintf(hostname, sizeof(hostname), "*@%s", IPtostr(np->p_ipaddr));
}
if ((rp->type == 1) || (usercount > rg_max_per_gline)) {
if(!ircd_strcmp(np->ident, tnp->ident))
usercount++;
- snprintf(hostname, sizeof(hostname), "%s@%s", np->ident, IPtostr(np->ipaddress));
+ snprintf(hostname, sizeof(hostname), "%s@%s", np->ident, IPtostr(np->p_ipaddr));
}
if ((rp->type >= 3) || (usercount > rg_max_per_gline)) {
nn->punish = rp->type;
}
}
- return;
+ return usercount;
}
if ((rp->type <= 0) || (rp->type >= 3))
- return;
+ return 0;
if (rp->type == 1) {
if (IsAccount(np)) {
}
}
- irc_send("%s GL * +%s %d :%s (ID: %08lx)\r\n", mynumeric->content, hostname, rg_expiry_time, rp->reason->content, rp->glineid);
+ irc_send("%s GL * +%s %d :AUTO: %s (ID: %08lx)\r\n", mynumeric->content, hostname, rg_expiry_time, rp->reason->content, rp->glineid);
+ return usercount;
+}
+
+int floodprotection = 0;
+
+void rg_dogline(struct rg_glinelist *gll, nick *np, struct rg_struct *rp, char *matched) {
+ int t = time(NULL);
+
+ if(t > floodprotection) {
+ floodprotection = t;
+ } else if((floodprotection - t) / 8 > RG_NETWORK_WIDE_MAX_GLINES_PER_8_SEC) {
+ channel *cp = findchannel("#twilightzone");
+ if(cp)
+ controlchanmsg(cp, "WARNING! REGEXGLINE DISABLED FOR AN HOUR DUE TO NETWORK WIDE LOOKING GLINE!");
+ controlwall(NO_OPER, NL_MANAGEMENT, "WARNING! REGEXGLINE DISABLED FOR AN HOUR DUE TO NETWORK WIDE LOOKING GLINE!");
+ floodprotection = t + RG_NETWORK_WIDE_MAX_GLINES_PER_8_SEC * 3600 * 8;
+ }
+
+ floodprotection+=__rg_dogline(gll, np, rp, matched);
}
void rg_logevent(nick *np, char *event, char *details, ...) {
char eeevent[RG_QUERY_BUF_SIZE], eedetails[RG_QUERY_BUF_SIZE], eemask[RG_QUERY_BUF_SIZE], eeaccount[RG_QUERY_BUF_SIZE];
char buf[513], account[ACCOUNTLEN + 1], mask[RG_MASKLEN];
int masklen;
-
+
+ return;
va_list va;
va_start(va, details);
void rg_loggline(struct rg_struct *rg, nick *np) {
char eenick[RG_QUERY_BUF_SIZE], eeuser[RG_QUERY_BUF_SIZE], eehost[RG_QUERY_BUF_SIZE], eereal[RG_QUERY_BUF_SIZE];
+ return;
rg_sqlescape_string(eenick, np->nick, strlen(np->nick));
rg_sqlescape_string(eeuser, np->ident, strlen(np->ident));
rg_sqlescape_string(eehost, np->host->name->content, strlen(np->host->name->content));