-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashiddenhostorissethost.patch
135 lines (127 loc) · 5.9 KB
/
hashiddenhostorissethost.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
add HasHiddenHostOrIsSetHost() macro instead of having to test HasHiddenHost() and IsSetHost() in many places
diff -r e4e1d8d47a8e include/client.h
--- a/include/client.h
+++ b/include/client.h
@@ -637,6 +637,8 @@
#define IsSetHost(x) HasFlag(x, FLAG_SETHOST)
/** Return non-zero if the client is using a spoofhost that was set by a service */
#define IsRemoteSetHost(x) HasFlag(x, FLAG_REMOTESETHOST)
+/** Return non-zero if the client's host is hidden or is using a spoofhost */
+#define HasHiddenHostOrIsSetHost(x) (HasHiddenHost(x) || IsSetHost(x))
/** Mark a client as having an in-progress net.burst. */
#define SetBurst(x) SetFlag(x, FLAG_BURST)
diff -r e4e1d8d47a8e ircd/m_check.c
--- a/ircd/m_check.c
+++ b/ircd/m_check.c
@@ -489,7 +489,7 @@
send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": User/Hostmask:: %s@%s [%s] (Clients: %hu)",
cli_user(acptr)->username, cli_user(acptr)->host, ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr));
- if (IsSetHost(acptr) || HasHiddenHost(acptr))
+ if (HasHiddenHostOrIsSetHost(acptr))
send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost);
/* COLOR_OFF ? */
diff -r e4e1d8d47a8e ircd/m_userhost.c
--- a/ircd/m_userhost.c
+++ b/ircd/m_userhost.c
@@ -104,7 +104,7 @@
* of +x. If an oper wants the real host, he should go to
* /whois to get it.
*/
- (HasHiddenHost(cptr) || IsSetHost(cptr)) && (sptr != cptr) ?
+ HasHiddenHostOrIsSetHost(cptr) && (sptr != cptr) ?
cli_user(cptr)->host : cli_user(cptr)->realhost);
}
diff -r e4e1d8d47a8e ircd/m_userip.c
--- a/ircd/m_userip.c
+++ b/ircd/m_userip.c
@@ -106,7 +106,7 @@
* of +x. If an oper wants the real IP, he should go to
* /whois to get it.
*/
- ((HasHiddenHost(cptr) || IsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ?
+ ((HasHiddenHostOrIsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ?
feature_str(FEAT_HIDDEN_IP) :
ircd_ntoa(&cli_ip(cptr)));
}
diff -r e4e1d8d47a8e ircd/m_who.c
--- a/ircd/m_who.c
+++ b/ircd/m_who.c
@@ -402,14 +402,13 @@
&& ((!(matchsel & WHO_FIELD_HOS))
|| matchexec(cli_user(acptr)->host, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_HOS))
- || !IsSetHost(acptr)
- || !HasHiddenHost(acptr)
+ || !HasHiddenHostOrIsSetHost(acptr)
|| !IsAnOper(sptr)
|| matchexec(cli_user(acptr)->realhost, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_REN))
|| matchexec(cli_info(acptr), mymask, minlen))
&& ((!(matchsel & WHO_FIELD_NIP))
- || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr))
+ || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr))
|| !ipmask_check(&cli_ip(acptr), &imask, ibits))
&& ((!(matchsel & WHO_FIELD_ACC))
|| matchexec(cli_user(acptr)->account, mymask, minlen)))
@@ -445,14 +444,13 @@
&& ((!(matchsel & WHO_FIELD_HOS))
|| matchexec(cli_user(acptr)->host, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_HOS))
- || !IsSetHost(acptr)
- || !HasHiddenHost(acptr)
+ || !HasHiddenHostOrIsSetHost(acptr)
|| !IsAnOper(sptr)
|| matchexec(cli_user(acptr)->realhost, mymask, minlen))
&& ((!(matchsel & WHO_FIELD_REN))
|| matchexec(cli_info(acptr), mymask, minlen))
&& ((!(matchsel & WHO_FIELD_NIP))
- || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr))
+ || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr))
|| !ipmask_check(&cli_ip(acptr), &imask, ibits))
&& ((!(matchsel & WHO_FIELD_ACC))
|| matchexec(cli_user(acptr)->account, mymask, minlen)))
diff -r e4e1d8d47a8e ircd/m_whois.c
--- a/ircd/m_whois.c
+++ b/ircd/m_whois.c
@@ -214,7 +214,7 @@
if (IsAccount(acptr))
send_reply(sptr, RPL_WHOISACCOUNT, name, user->account);
- if ((HasHiddenHost(acptr) || IsSetHost(acptr)) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr))
+ if (HasHiddenHostOrIsSetHost(acptr) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr))
send_reply(sptr, RPL_WHOISACTUALLY, name, user->realusername,
user->realhost, ircd_ntoa(&cli_ip(acptr)));
diff -r e4e1d8d47a8e ircd/send.c
--- a/ircd/send.c
+++ b/ircd/send.c
@@ -281,7 +281,7 @@
{
case MATCH_HOST:
return (match(mask, cli_user(one)->host) == 0 ||
- ((HasHiddenHost(one) || IsSetHost(one)) && match(mask, cli_user(one)->realhost) == 0));
+ (HasHiddenHostOrIsSetHost(one) && match(mask, cli_user(one)->realhost) == 0));
case MATCH_SERVER:
default:
return (match(mask, cli_name(cli_user(one)->server)) == 0);
diff -r e4e1d8d47a8e ircd/whocmds.c
--- a/ircd/whocmds.c
+++ b/ircd/whocmds.c
@@ -134,7 +134,7 @@
if (fields & WHO_FIELD_NIP)
{
- const char* p2 = (HasHiddenHost(acptr) || IsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ?
+ const char* p2 = (HasHiddenHostOrIsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ?
feature_str(FEAT_HIDDEN_IP) :
ircd_ntoa(&cli_ip(acptr));
*(p1++) = ' ';
diff -r e4e1d8d47a8e ircd/whowas.c
--- a/ircd/whowas.c
+++ b/ircd/whowas.c
@@ -272,7 +272,7 @@
DupString(ww->name, cli_name(cptr));
DupString(ww->username, cli_user(cptr)->username);
DupString(ww->hostname, cli_user(cptr)->host);
- if (HasHiddenHost(cptr))
+ if (HasHiddenHostOrIsSetHost(cptr))
DupString(ww->realhost, cli_user(cptr)->realhost);
DupString(ww->servername, cli_name(cli_user(cptr)->server));
DupString(ww->realname, cli_info(cptr));