static int glines_cmdblock(void *source, int cargc, char **cargv) {
nick *sender = source;
- nick *target;
+ nick *target, *wnp;
whowas *ww;
int hits, duration, id;
int coff, overridesanity, overridelimit, simulate, chase;
controlreply(sender, "Found matching whowas record:");
controlreply(sender, "%s", whowas_format(ww));
} else {
- ww = whowas_fromnick(target);
+ ww = whowas_fromnick(target, 1);
ownww = 1;
}
+ wnp = &ww->nick;
+
+ if (sender != target && (IsService(wnp) || IsOper(wnp) || NickOnServiceServer(wnp))) {
+ controlreply(sender, "Target user '%s' is an oper or a service. Not setting G-Lines.", wnp->nick);
+ return CMD_ERROR;
+ }
+
rejoinline(cargv[coff + 2], cargc - coff - 2);
reason = cargv[coff + 2];
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "BLOCK", cargc + coff - 1, cargv);
glinebufcounthits(&gbuf, &hits, NULL);
id = glinebufcommit(&gbuf, 1);
- controlwall(NO_OPER, NL_GLINES, "%s BLOCK'ed user '%s!%s@%s' for %s with reason '%s' (%d hits)", controlid(sender), ww->nick->nick, ww->nick->ident, ww->nick->host->name->content, longtoduration(duration, 0), reason, hits);
+ controlwall(NO_OPER, NL_GLINES, "%s BLOCK'ed user '%s!%s@%s' for %s with reason '%s' (%d hits)", controlid(sender),
+ wnp->nick, wnp->ident, wnp->host->name->content,
+ longtoduration(duration, 0), reason, hits);
if (ownww)
whowas_free(ww);
}
#endif /* SNIRCD_VERSION */
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "GLINE", cargc + coff - 1, cargv);
return CMD_ERROR;
}
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "SMARTGLINE", cargc + coff - 1, cargv);
(((nick **)victims.content)[slot]) = np;
}
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "CLEARCHAN", cargc + coff - 1, cargv);
rejoinline(cargv[coff + 3], cargc - coff - 3);
reason = cargv[coff + 3];
- if (sender->auth)
- snprintf(creator, sizeof(creator), "#%s", sender->authname);
- else
- strncpy(creator, controlid(sender), sizeof(creator));
+ snprintf(creator, sizeof(creator), "#%s", sender->authname);
glinebufinit(&gbuf, 0);
glinebufcommentv(&gbuf, "TRUSTGLINE", cargc + coff - 1, cargv);