1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-01 18:46:38 +02:00

WHOWAS: Show IP address and account to IRCOps.

Thanks to Noisytoot for https://github.com/unrealircd/unrealircd/pull/227
who suggested displaying account and provided a partial patch, and
armyn in https://bugs.unrealircd.org/view.php?id=6153 suggesting IP.

I chose to use the existing RPL_WHOIS* numerics that we also use for
returning WHOIS data. We already use RPL_WHOISSERVER in WHOWAS for
ages and the use of it is mentioned in RFC1459, so seems like that
was the idea right from the beginning of times. The only change I did
was from "is" to "was" in like "was logged in" and "was connecting from"
in the text of the numerics.
This commit is contained in:
Bram Matthys
2023-03-17 18:02:32 +01:00
parent fcdb059883
commit cdb36e7e30
3 changed files with 19 additions and 0 deletions
+2
View File
@@ -850,8 +850,10 @@ typedef struct Whowas {
char *username;
char *hostname;
char *virthost;
char *ip;
char *servername;
char *realname;
char *account;
long umodes;
time_t logoff;
struct Client *online; /* Pointer to new nickname for chasing or NULL */
+13
View File
@@ -104,6 +104,19 @@ CMD_FUNC(cmd_whowas)
(*temp->virthost !=
'\0') ? temp->virthost : temp->hostname),
temp->realname);
if (!BadPtr(temp->ip) && ValidatePermissionsForPath("client:see:ip",client,NULL,NULL,NULL))
{
sendnumericfmt(client, RPL_WHOISHOST, "%s :was connecting from %s@%s %s",
temp->name,
temp->username, temp->hostname,
temp->ip ? temp->ip : "");
}
if (IsOper(client) && !BadPtr(temp->account))
{
sendnumericfmt(client, RPL_WHOISLOGGEDIN, "%s %s :was logged in as",
temp->name,
temp->account);
}
if (!((find_uline(temp->servername)) && !IsOper(client) && HIDE_ULINES))
{
sendnumeric(client, RPL_WHOISSERVER, temp->name, temp->servername,
+4
View File
@@ -47,6 +47,7 @@ void add_history(Client *client, int online)
safe_free(new->virthost);
safe_free(new->realname);
safe_free(new->username);
safe_free(new->account);
new->servername = NULL;
if (new->online)
@@ -59,12 +60,15 @@ void add_history(Client *client, int online)
safe_strdup(new->name, client->name);
safe_strdup(new->username, client->user->username);
safe_strdup(new->hostname, client->user->realhost);
safe_strdup(new->ip, client->ip);
if (client->user->virthost)
safe_strdup(new->virthost, client->user->virthost);
else
safe_strdup(new->virthost, "");
new->servername = client->user->server;
safe_strdup(new->realname, client->info);
if (strcmp(client->user->account, "0"))
safe_strdup(new->account, client->user->account);
/* Its not string copied, a pointer to the scache hash is copied
-Dianora