mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
whowas: Use the normal rules for IP visibility.
Add the flags (auth{} spoof, dynamic spoof) to struct Whowas and add a show_ip_whowas(). Normal users now see IPs of unspoofed users, and remote opers can see IPs behind dynamic spoofs. Also, general::hide_spoof_ips is now applied when the IP is shown, not when the client exits.
This commit is contained in:
parent
2635cc8089
commit
364e59f82a
6 changed files with 24 additions and 7 deletions
|
@ -940,8 +940,6 @@ general {
|
|||
* If disabled, local opers can see them.
|
||||
* Dynamic spoofs (e.g. set by services) are unaffected by this;
|
||||
* any oper (local and remote) can see the real ip.
|
||||
* Warning: for whowas, this is checked when the client exits,
|
||||
* not when the IP is shown.
|
||||
*/
|
||||
hide_spoof_ips = yes;
|
||||
|
||||
|
|
|
@ -597,6 +597,7 @@ extern void del_all_accepts(struct Client *client_p);
|
|||
extern void dead_link(struct Client *client_p, int sendqex);
|
||||
extern int show_ip(struct Client *source_p, struct Client *target_p);
|
||||
extern int show_ip_conf(struct ConfItem *aconf, struct Client *source_p);
|
||||
extern int show_ip_whowas(struct Whowas *whowas, struct Client *source_p);
|
||||
|
||||
extern void initUser(void);
|
||||
extern void free_user(struct User *, struct Client *);
|
||||
|
|
|
@ -55,6 +55,7 @@ struct Whowas
|
|||
char sockhost[HOSTIPLEN + 1];
|
||||
char realname[REALLEN + 1];
|
||||
char suser[NICKLEN + 1];
|
||||
unsigned char flags;
|
||||
const char *servername;
|
||||
time_t logoff;
|
||||
struct Client *online; /* Pointer to new nickname for chasing or NULL */
|
||||
|
@ -64,6 +65,10 @@ struct Whowas
|
|||
struct Whowas *cprev; /* for client struct linked list */
|
||||
};
|
||||
|
||||
/* Flags */
|
||||
#define WHOWAS_IP_SPOOFING 0x1
|
||||
#define WHOWAS_DYNSPOOF 0x2
|
||||
|
||||
/*
|
||||
** initwhowas
|
||||
*/
|
||||
|
|
|
@ -117,7 +117,9 @@ m_whowas(struct Client *client_p, struct Client *source_p, int parc, const char
|
|||
sendto_one(source_p, form_str(RPL_WHOWASUSER),
|
||||
me.name, source_p->name, temp->name,
|
||||
temp->username, temp->hostname, temp->realname);
|
||||
if (MyOper(source_p) && !EmptyString(temp->sockhost))
|
||||
if (!EmptyString(temp->sockhost) &&
|
||||
strcmp(temp->sockhost, "0") &&
|
||||
show_ip_whowas(temp, source_p))
|
||||
#if 0
|
||||
sendto_one(source_p, form_str(RPL_WHOWASREAL),
|
||||
me.name, source_p->name, temp->name,
|
||||
|
|
12
src/client.c
12
src/client.c
|
@ -1690,6 +1690,18 @@ show_ip_conf(struct ConfItem *aconf, struct Client *source_p)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
show_ip_whowas(struct Whowas *whowas, struct Client *source_p)
|
||||
{
|
||||
if(whowas->flags & WHOWAS_IP_SPOOFING)
|
||||
if(ConfigFileEntry.hide_spoof_ips || !MyOper(source_p))
|
||||
return 0;
|
||||
if(whowas->flags & WHOWAS_DYNSPOOF)
|
||||
if(!IsOper(source_p))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* make_user
|
||||
*
|
||||
|
|
|
@ -83,10 +83,9 @@ void add_history(struct Client *client_p, int online)
|
|||
strcpy(who->hostname, client_p->host);
|
||||
strcpy(who->realname, client_p->info);
|
||||
strcpy(who->suser, client_p->user->suser);
|
||||
if (!EmptyString(client_p->sockhost) && strcmp(client_p->sockhost, "0") && show_ip(NULL, client_p))
|
||||
strcpy(who->sockhost, client_p->sockhost);
|
||||
else
|
||||
who->sockhost[0] = '\0';
|
||||
strcpy(who->sockhost, client_p->sockhost);
|
||||
who->flags = (IsIPSpoof(client_p) ? WHOWAS_IP_SPOOFING : 0) |
|
||||
(IsDynSpoof(client_p) ? WHOWAS_DYNSPOOF : 0);
|
||||
|
||||
who->servername = scache_get_name(client_p->servptr->serv->nameinfo);
|
||||
|
||||
|
|
Loading…
Reference in a new issue