X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/ce11a20097fbc74f15f7180a00014083852bd988..d1b8e20047cf917eb9d56fdb17c195e5f896099f:/glines/glines.c diff --git a/glines/glines.c b/glines/glines.c index c728be5a..a07a0165 100644 --- a/glines/glines.c +++ b/glines/glines.c @@ -45,7 +45,7 @@ int gline_match_nick(gline *gl, nick *np) { return 0; if (gl->flags & GLINE_IPMASK) { - if (!ipmask_check(&gl->ip, &np->p_ipaddr, gl->bits)) + if (!ipmask_check(&gl->ip, &np->ipaddress, gl->bits)) return 0; } else { if (gl->host && match(gl->host->content, np->host->name->content) != 0) @@ -169,50 +169,32 @@ void gline_propagate(gline *agline) { if (agline->flags & GLINE_DESTROYED) { #if SNIRCD_VERSION < 135 - controlwall(NO_OPER, NL_GLINES, "Tried to destroy G-Line on '%s' however SNIRCD_VERSION is too old.", glinetostring(agline)); + controlwall(NO_OPER, NL_GLINES_AUTO, "Tried to destroy G-Line on '%s' however SNIRCD_VERSION is too old.", glinetostring(agline)); #else - controlwall(NO_OPER, NL_GLINES, "Destroying G-Line on '%s' lasting %s with reason '%s', created by: %s", + controlwall(NO_OPER, NL_GLINES_AUTO, "Destroying G-Line on '%s' lasting %s with reason '%s', created by: %s", glinetostring(agline), longtoduration(agline->expire-getnettime(), 0), - agline->reason->content, agline->creator->content); + agline->reason ? agline->reason->content : "", agline->creator->content); -#if 1 irc_send("%s GL * %%-%s %lu %lu :%s\r\n", mynumeric->content, glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#else - controlwall(NO_OPER, NL_GLINES, "%s GL * %%-%s %lu %lu :%s\r\n", mynumeric->content, - glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#endif + agline->lastmod, agline->reason ? agline->reason->content : ""); #endif /* SNIRCD_VERSION */ } else if (agline->flags & GLINE_ACTIVE) { - controlwall(NO_OPER, NL_GLINES, "Activating G-Line on '%s' lasting %s created by %s with reason '%s'", + controlwall(NO_OPER, NL_GLINES_AUTO, "Activating G-Line on '%s' lasting %s created by %s with reason '%s'", glinetostring(agline), longtoduration(agline->expire-getnettime(), 0), - agline->creator->content, agline->reason->content); + agline->creator->content, agline->reason ? agline->reason->content : ""); -#if 1 irc_send("%s GL * +%s %lu %lu :%s\r\n", mynumeric->content, glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#else - controlwall(NO_OPER, NL_GLINES, "%s GL * +%s %lu %lu :%s\r\n", mynumeric->content, - glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#endif + agline->lastmod, agline->reason ? agline->reason->content : ""); } else { - controlwall(NO_OPER, NL_GLINES, "Deactivating G-Line on '%s' lasting %s created by %s with reason '%s'", + controlwall(NO_OPER, NL_GLINES_AUTO, "Deactivating G-Line on '%s' lasting %s created by %s with reason '%s'", glinetostring(agline), longtoduration(agline->expire-getnettime(), 0), - agline->creator->content, agline->reason->content); + agline->creator->content, agline->reason ? agline->reason->content : ""); -#if 1 irc_send("%s GL * -%s %lu %lu :%s\r\n", mynumeric->content, glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#else - controlwall(NO_OPER, NL_GLINES, "%s GL * -%s %lu %lu :%s\r\n", mynumeric->content, - glinetostring(agline), agline->expire - getnettime(), - agline->lastmod, agline->reason->content); -#endif + agline->lastmod, agline->reason ? agline->reason->content : ""); } } @@ -264,9 +246,6 @@ int gline_match_mask(gline *gla, gline *glb) { if ((gla->flags & GLINE_REALNAME) != (glb->flags & GLINE_REALNAME)) return 0; - if ((gla->flags & GLINE_IPMASK) != (glb->flags & GLINE_IPMASK)) - return 0; - if (gla->nick && !glb->nick) return 0; @@ -279,7 +258,7 @@ int gline_match_mask(gline *gla, gline *glb) { if (gla->user && glb->user && match(gla->user->content, glb->user->content) != 0) return 0; - if (gla->flags & GLINE_IPMASK) { + if (gla->flags & GLINE_IPMASK && glb->flags & GLINE_IPMASK) { if (gla->bits > glb->bits) return 0; @@ -302,7 +281,7 @@ int isglinesane(gline *gl, const char **hint) { trusthost *th; /* Reason is too short */ - if (strlen(gl->reason->content) < MINGLINEREASONLEN) { + if (!gl->reason || strlen(gl->reason->content) < MINGLINEREASONLEN) { *hint = "G-Line reason is too short."; return 0; } @@ -414,7 +393,7 @@ gline *glinedup(gline *gl) { if (gl->host) sgl->host = getsstring(gl->host->content, 512); - sgl->reason = getsstring(gl->reason->content, 512); + sgl->reason = gl->reason ? getsstring(gl->reason->content, 512) : NULL; sgl->creator = getsstring(gl->creator->content, 512); memcpy(&sgl->ip, &gl->ip, sizeof(gl->ip));