X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/5366977b4f3c7a50d170bf7a1e29b14c74944db7..c3fed903fd45d9f3bc68af170e6e3da2b9033432:/modules/m_gline.c diff --git a/modules/m_gline.c b/modules/m_gline.c index 5c315539..f2d08705 100644 --- a/modules/m_gline.c +++ b/modules/m_gline.c @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * - * $Id: m_gline.c 3161 2007-01-25 07:23:01Z nenolod $ + * $Id: m_gline.c 3225 2007-03-04 23:42:55Z jilles $ */ #include "stdinc.h" @@ -47,6 +47,7 @@ #include "parse.h" #include "modules.h" #include "s_log.h" +#include "reject.h" static int mo_gline(struct Client *, struct Client *, int, const char **); static int mc_gline(struct Client *, struct Client *, int, const char **); @@ -63,7 +64,7 @@ struct Message ungline_msgtab = { }; mapi_clist_av1 gline_clist[] = { &gline_msgtab, &ungline_msgtab, NULL }; -DECLARE_MODULE_AV1(gline, NULL, NULL, gline_clist, NULL, NULL, "$Revision: 3161 $"); +DECLARE_MODULE_AV1(gline, NULL, NULL, gline_clist, NULL, NULL, "$Revision: 3225 $"); static int majority_gline(struct Client *source_p, const char *user, const char *host, const char *reason); @@ -178,7 +179,7 @@ mo_gline(struct Client *client_p, struct Client *source_p, int parc, const char source_p->host, me.name, user, host, reason); ilog(L_GLINE, "R %s %s %s %s %s %s %s", source_p->name, source_p->username, source_p->host, - source_p->user->server, user, host, reason); + source_p->servptr->name, user, host, reason); /* If at least 3 opers agree this user should be G lined then do it */ majority_gline(source_p, user, host, reason); @@ -195,7 +196,7 @@ mo_gline(struct Client *client_p, struct Client *source_p, int parc, const char sendto_server(NULL, NULL, NOCAPS, CAP_GLN, ":%s GLINE %s %s %s %s %s %s :%s", me.name, source_p->name, source_p->username, - source_p->host, source_p->user->server, + source_p->host, source_p->servptr->name, user, host, reason); return 0; } @@ -233,9 +234,9 @@ mc_gline(struct Client *client_p, struct Client *source_p, acptr->name, user, host, reason); sendto_server(client_p, NULL, NOCAPS, CAP_GLN, ":%s GLINE %s %s %s %s %s %s :%s", - acptr->user->server, acptr->name, + acptr->servptr->name, acptr->name, acptr->username, acptr->host, - acptr->user->server, user, host, reason); + acptr->servptr->name, user, host, reason); if(!ConfigFileEntry.glines) return 0; @@ -247,7 +248,7 @@ mc_gline(struct Client *client_p, struct Client *source_p, "%s!%s@%s on %s is requesting a gline without " "%d non-wildcard characters for [%s@%s] [%s]", acptr->name, acptr->username, - acptr->host, acptr->user->server, + acptr->host, acptr->servptr->name, ConfigFileEntry.min_nonwildcard, user, host, reason); return 0; @@ -266,7 +267,7 @@ mc_gline(struct Client *client_p, struct Client *source_p, sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting a " "gline with a cidr mask < %d for [%s@%s] [%s]", acptr->name, acptr->username, acptr->host, - acptr->user->server, + acptr->servptr->name, ConfigFileEntry.gline_min_cidr, user, host, reason); return 0; @@ -278,7 +279,7 @@ mc_gline(struct Client *client_p, struct Client *source_p, sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting a " "gline with a cidr mask < %d for [%s@%s] [%s]", acptr->name, acptr->username, acptr->host, - acptr->user->server, + acptr->servptr->name, ConfigFileEntry.gline_min_cidr6, user, host, reason); return 0; @@ -289,11 +290,11 @@ mc_gline(struct Client *client_p, struct Client *source_p, sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting gline for [%s@%s] [%s]", acptr->name, acptr->username, acptr->host, - acptr->user->server, user, host, reason); + acptr->servptr->name, user, host, reason); ilog(L_GLINE, "R %s %s %s %s %s %s %s", source_p->name, source_p->username, source_p->host, - source_p->user->server, user, host, reason); + source_p->servptr->name, user, host, reason); /* If at least 3 opers agree this user should be G lined then do it */ majority_gline(acptr, user, host, reason); @@ -345,9 +346,9 @@ ms_gline(struct Client *client_p, struct Client *source_p, int parc, const char acptr->name, user, host, reason); sendto_server(client_p, NULL, NOCAPS, CAP_GLN, ":%s GLINE %s %s %s %s %s %s :%s", - acptr->user->server, acptr->name, + acptr->servptr->name, acptr->name, acptr->username, acptr->host, - acptr->user->server, user, host, reason); + acptr->servptr->name, user, host, reason); if(!ConfigFileEntry.glines) return 0; @@ -359,7 +360,7 @@ ms_gline(struct Client *client_p, struct Client *source_p, int parc, const char "%s!%s@%s on %s is requesting a gline without " "%d non-wildcard characters for [%s@%s] [%s]", acptr->name, acptr->username, - acptr->host, acptr->user->server, + acptr->host, acptr->servptr->name, ConfigFileEntry.min_nonwildcard, user, host, reason); return 0; @@ -368,11 +369,11 @@ ms_gline(struct Client *client_p, struct Client *source_p, int parc, const char sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting gline for [%s@%s] [%s]", acptr->name, acptr->username, acptr->host, - acptr->user->server, user, host, reason); + acptr->servptr->name, user, host, reason); ilog(L_GLINE, "R %s %s %s %s %s %s %s", acptr->name, acptr->username, acptr->host, - acptr->user->server, user, host, reason); + acptr->servptr->name, user, host, reason); /* If at least 3 opers agree this user should be G lined then do it */ majority_gline(acptr, user, host, reason); @@ -443,7 +444,7 @@ mo_ungline(struct Client *client_p, struct Client *source_p, int parc, const cha get_oper_name(source_p), user, host); ilog(L_GLINE, "U %s %s %s %s %s %s", source_p->name, source_p->username, source_p->host, - source_p->user->server, user, host); + source_p->servptr->name, user, host); } else { @@ -514,8 +515,8 @@ invalid_gline(struct Client *source_p, const char *luser, return 1; } - if(strlen(lreason) > REASONLEN) - lreason[REASONLEN] = '\0'; + if(strlen(lreason) > BANREASONLEN) + lreason[BANREASONLEN] = '\0'; return 0; } @@ -546,8 +547,8 @@ set_local_gline(struct Client *source_p, const char *user, aconf->status = CONF_GLINE; aconf->flags |= CONF_FLAGS_TEMPORARY; - if(strlen(my_reason) > REASONLEN) - my_reason[REASONLEN-1] = '\0'; + if(strlen(my_reason) > BANREASONLEN) + my_reason[BANREASONLEN-1] = '\0'; if((oper_reason = strchr(my_reason, '|')) != NULL) { @@ -569,11 +570,11 @@ set_local_gline(struct Client *source_p, const char *user, sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s has triggered gline for [%s@%s] [%s]", source_p->name, source_p->username, - source_p->host, source_p->user->server, + source_p->host, source_p->servptr->name, user, host, reason); ilog(L_GLINE, "T %s %s %s %s %s %s %s", source_p->name, source_p->username, source_p->host, - source_p->user->server, user, host, reason); + source_p->servptr->name, user, host, reason); check_glines(); } @@ -612,7 +613,7 @@ majority_gline(struct Client *source_p, const char *user, sendto_realops_snomask(SNO_GENERAL, L_ALL, "oper has already voted"); return NO; } - else if(irccmp(pending->oper_server1, source_p->user->server) == 0) + else if(irccmp(pending->oper_server1, source_p->servptr->name) == 0) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "server has already voted"); return NO; @@ -628,7 +629,7 @@ majority_gline(struct Client *source_p, const char *user, "oper has already voted"); return NO; } - else if(irccmp(pending->oper_server2, source_p->user->server) == 0) + else if(irccmp(pending->oper_server2, source_p->servptr->name) == 0) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "server has already voted"); @@ -651,7 +652,7 @@ majority_gline(struct Client *source_p, const char *user, strlcpy(pending->oper_host2, source_p->host, sizeof(pending->oper_host2)); DupString(pending->reason2, reason); - pending->oper_server2 = find_or_add(source_p->user->server); + pending->oper_server2 = scache_get_name(source_p->servptr->serv->nameinfo); pending->last_gline_time = CurrentTime; pending->time_request2 = CurrentTime; return NO; @@ -670,7 +671,7 @@ majority_gline(struct Client *source_p, const char *user, strlcpy(pending->oper_host1, source_p->host, sizeof(pending->oper_host1)); - pending->oper_server1 = find_or_add(source_p->user->server); + pending->oper_server1 = scache_get_name(source_p->servptr->serv->nameinfo); strlcpy(pending->user, user, sizeof(pending->user)); strlcpy(pending->host, host, sizeof(pending->host)); @@ -722,6 +723,7 @@ remove_temp_gline(const char *user, const char *host) continue; dlinkDestroy(ptr, &glines); + remove_reject_mask(aconf->user, aconf->host); delete_one_address_conf(aconf->host, aconf); return YES; }