/* log kills for fun and profit */
void
log_write_kill(const struct Client *victim, const struct Client *killer,
- const char *inpath, const char *path)
+ const char *inpath, const char *path, const char *msg)
{
if (MyUser(victim))
log_write(IsServer(killer) ? LS_SERVKILL : LS_OPERKILL, L_TRACE, 0,
- "A local client %#C KILLED by %#C Path: %s!%s",
- victim, killer, inpath, path);
+ "A local client %#C KILLED by %#C Path: %s!%s %s",
+ victim, killer, inpath, path, msg);
else
log_write(IsServer(killer) ? LS_SERVKILL : LS_OPERKILL, L_TRACE, 0,
- "KILL from %C For %C Path: %s!%s", killer, victim, inpath, path);
+ "KILL from %C For %C Path: %s!%s %s", killer, victim, inpath,
+ path, msg);
}
/* return a struct LogFile for a specific filename--reference counted */
*
*/
static int do_kill(struct Client* cptr, struct Client* sptr,
- struct Client* victim, char* inpath, char* path)
+ struct Client* victim, char* inpath, char* path, char *msg)
{
- char* comment;
- char buf[BUFSIZE];
-
assert(0 != cptr);
assert(0 != sptr);
assert(IsUser(victim));
- /* If we got this from a *local* oper, then path only contains the
- * kill comment. Remote oper or server kills will at least have
- * some kind of path preceding it. -GW
- */
- if (IsServer(cptr))
- {
- if (!(comment = strchr(path, ' ')))
- comment = "No reason supplied";
- else
- comment++; /* Remove first character (space) */
- }
- else
- comment = path;
-
-#ifdef HEAD_IN_SAND_KILLWHO
- ircd_snprintf(0, buf, sizeof(buf), "%s (%s)", HEAD_IN_SAND_SERVERNAME, comment);
-#else
- ircd_snprintf(0, buf, sizeof(buf), "%s (%s)", cli_name(sptr),
- comment);
-#endif
- comment = buf;
-
/*
* Notify all *local* opers about the KILL (this includes the one
* originating the kill, if from this server--the special numeric
* have changed the target because of the nickname change.
*/
sendto_opmask_butone(0, IsServer(sptr) ? SNO_SERVKILL : SNO_OPERKILL,
- "Received KILL message for %s. From %s Path: %s!%s",
+ "Received KILL message for %s. From %s Path: %s!%s %s",
get_client_name(victim, SHOW_IP), cli_name(sptr),
- inpath, comment);
- log_write_kill(victim, sptr, inpath, path);
+ inpath, path, msg);
+ log_write_kill(victim, sptr, inpath, path, msg);
/*
* And pass on the message to other servers. Note, that if KILL
* Client suicide kills are NOT passed on --SRB
*/
if (IsServer(cptr) || !MyConnect(victim)) {
- sendcmdto_serv_butone(sptr, CMD_KILL, cptr, "%C :%s!%s", victim,
- inpath, path);
+ sendcmdto_serv_butone(sptr, CMD_KILL, cptr, "%C :%s!%s %s", victim,
+ inpath, path, msg);
/*
* Set FLAGS_KILLED. This prevents exit_one_client from sending
* In accordance with the new hiding rules, the victim
* always sees the kill as coming from me.
*/
- if (MyConnect(victim)) {
-#ifdef HEAD_IN_SAND_KILLWHO
- sendcmdto_one(&me, CMD_KILL, victim, "%C :%s", victim,
- comment);
-#else
- sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s", victim,
- comment);
-#endif
- }
#ifdef HEAD_IN_SAND_KILLWHO
- return exit_client_msg(cptr, victim, &me, "Killed (%s)", comment);
+ if (MyConnect(victim))
+ sendcmdto_one(&me, CMD_KILL, victim, "%C :%s %s", victim,
+ HEAD_IN_SAND_SERVERNAME, msg);
+ return exit_client_msg(cptr, victim, &me, "Killed (%s %s)",
+ HEAD_IN_SAND_SERVERNAME, msg);
#else
- return exit_client_msg(cptr, victim, sptr, "Killed (%s)", comment);
+ if (MyConnect(victim))
+ sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s %s", victim,
+ cli_name(sptr), msg);
+ return exit_client_msg(cptr, victim, sptr, "Killed (%s %s)", cli_name(sptr),
+ msg);
#endif
}
{
struct Client* victim;
char* path;
+ char* msg;
assert(0 != cptr);
assert(0 != sptr);
path = parv[parc - 1]; /* Either defined or NULL (parc >= 3) */
+ if (!(msg = strchr(path, ' '))) /* Extract out the message */
+ msg = "(No reason supplied)";
+ else
+ *(msg++) = '\0'; /* Remove first character (space) and terminate path */
+
if (!(victim = findNUser(parv[1]))) {
if (IsUser(sptr))
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :KILL target disconnected "
sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (Ghost 5 Numeric Collided)",
victim, path);
}
- return do_kill(cptr, sptr, victim, cli_name(cptr), path);
+ return do_kill(cptr, sptr, victim, cli_name(cptr), path, msg);
}
/*
{
struct Client* victim;
char* user;
- char* path;
+ char msg[TOPICLEN + 3]; /* (, ), and \0 */
assert(0 != cptr);
assert(0 != sptr);
return need_more_params(sptr, "KILL");
user = parv[1];
- path = parv[parc - 1];
-
- if (strlen(path) > TOPICLEN)
- path[TOPICLEN] = '\0';
+ ircd_snprintf(0, msg, sizeof(msg), "(%.*s)", TOPICLEN, parv[parc - 1]);
if (!(victim = FindClient(user))) {
/*
sptr, cli_name(victim));
return 0;
}
- return do_kill(cptr, sptr, victim, cli_user(sptr)->host, path);
+ return do_kill(cptr, sptr, victim, cli_user(sptr)->host, cli_name(sptr),
+ msg);
}