-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopername.patch
314 lines (293 loc) · 14.4 KB
/
opername.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
Add opername to snomask, remote connect wallops, and as prefix to server jupes
in form of nick(opername)
new function get_client_name_and_opername() add in s_misc.c
mirrored after get_client_name() which can return either nick/server or nick[ident@ip]
diff -r dc2bab3d00a5 include/client.h
--- a/include/client.h Thu Jul 25 18:59:27 2013 +0100
+++ b/include/client.h Thu Jul 25 19:00:52 2013 +0100
@@ -819,6 +819,7 @@
#define IPV6USERBITS 64
extern const char* get_client_name(const struct Client* sptr, int showip);
+extern const char* get_client_name_and_opername(const struct Client* sptr);
extern const char* client_get_default_umode(const struct Client* sptr);
extern int client_get_ping(const struct Client* local_client);
extern void client_drop_sendq(struct Connection* con);
diff -r dc2bab3d00a5 ircd/channel.c
--- a/ircd/channel.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/channel.c Thu Jul 25 19:00:52 2013 +0100
@@ -1917,8 +1917,8 @@
if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
"[%Tu]",
- cli_name(feature_bool(FEAT_HIS_SNOTICES) ?
- mbuf->mb_source : app_source),
+ feature_bool(FEAT_HIS_SNOTICES) ?
+ get_client_name_and_opername(mbuf->mb_source) : cli_name(app_source),
mbuf->mb_channel->chname,
rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
addbuf, remstr, addstr,
diff -r dc2bab3d00a5 ircd/gline.c
--- a/ircd/gline.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/gline.c Thu Jul 25 19:00:52 2013 +0100
@@ -576,7 +576,7 @@
SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at "
"%Tu: %s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
(flags & GLINE_ACTIVE) ? "" : "deactivated ",
(flags & GLINE_LOCAL) ? "local" : "global",
@@ -651,7 +651,7 @@
sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
"expiring at %Tu: %s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
@@ -724,7 +724,7 @@
sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
"%s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
@@ -931,7 +931,7 @@
sendto_opmask_butone(0, non_auto ? SNO_GLINE : SNO_AUTO,
"%s modifying global %s for %s%s%s%s%s:%s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) : cli_name((cli_user(sptr))->server),
+ get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
@@ -981,7 +981,7 @@
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) : cli_name((cli_user(sptr))->server),
+ get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
diff -r dc2bab3d00a5 ircd/jupe.c
--- a/ircd/jupe.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/jupe.c Thu Jul 25 19:00:52 2013 +0100
@@ -156,7 +156,7 @@
sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
"%Tu: %s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
flags & JUPE_LOCAL ? "local " : "", server,
expire + TSoffset, reason);
@@ -211,7 +211,7 @@
sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
"at %Tu: %s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
jupe->ju_server, jupe->ju_expire + TSoffset,
jupe->ju_reason);
@@ -264,7 +264,7 @@
sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
"%s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
- cli_name(sptr) :
+ get_client_name_and_opername(sptr) :
cli_name((cli_user(sptr))->server),
JupeIsLocal(jupe) ? "removing local" : "deactivating",
jupe->ju_server, jupe->ju_expire + TSoffset,
diff -r dc2bab3d00a5 ircd/m_connect.c
--- a/ircd/m_connect.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_connect.c Thu Jul 25 19:00:52 2013 +0100
@@ -197,7 +197,7 @@
sendwallto_group_butone(&me, WALL_WALLOPS, 0,
"Remote CONNECT %s %s from %s", aconf->name,
parv[2] ? parv[2] : "",
- get_client_name(sptr, HIDE_IP));
+ get_client_name_and_opername(sptr));
log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name,
parv[2] ? parv[2] : "");
diff -r dc2bab3d00a5 ircd/m_join.c
--- a/ircd/m_join.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_join.c Thu Jul 25 19:00:52 2013 +0100
@@ -242,8 +242,8 @@
}
/* send accountability notice */
if (err)
- sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %C JOIN %H "
- "(overriding +%c)", sptr, chptr, err);
+ sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %s JOIN %H "
+ "(overriding +%c)", get_client_name_and_opername(sptr), chptr, err);
err = 0;
}
diff -r dc2bab3d00a5 ircd/m_jupe.c
--- a/ircd/m_jupe.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_jupe.c Thu Jul 25 19:00:52 2013 +0100
@@ -193,7 +193,7 @@
struct Jupe *ajupe;
unsigned int flags = 0;
time_t expire_off;
- char *server = parv[1], *target = 0, *reason;
+ char *server = parv[1], *target = 0, reason[BUFSIZE];
if (parc < 2) {
if (!HasPriv(sptr, PRIV_ROUTEINFO))
@@ -214,12 +214,12 @@
if (parc == 4) {
expire_off = atoi(parv[2]);
- reason = parv[3];
+ ircd_snprintf(0, reason, sizeof(reason), "%s: %s", cli_user(sptr)->opername, parv[3]);
flags |= JUPE_LOCAL;
} else if (parc > 4) {
target = parv[2];
expire_off = atoi(parv[3]);
- reason = parv[4];
+ ircd_snprintf(0, reason, sizeof(reason), "%s: %s", cli_user(sptr)->opername, parv[4]);
} else
return need_more_params(sptr, "JUPE");
diff -r dc2bab3d00a5 ircd/m_kill.c
--- a/ircd/m_kill.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_kill.c Thu Jul 25 19:00:52 2013 +0100
@@ -127,7 +127,7 @@
*/
sendto_opmask_butone(0, snomask,
"Received KILL message for %s from %s Path: %s!%s %s",
- get_client_name(victim, SHOW_IP), cli_name(sptr),
+ get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr),
inpath, path, msg);
log_write_kill(victim, sptr, inpath, path, msg);
diff -r dc2bab3d00a5 ircd/m_oper.c
--- a/ircd/m_oper.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_oper.c Thu Jul 25 19:00:52 2013 +0100
@@ -192,9 +192,9 @@
send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE), 0);
send_reply(sptr, RPL_YOUREOPER);
- sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c) as %s",
- parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr),
- IsOper(sptr) ? 'O' : 'o', cli_user(sptr)->opername);
+ sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)",
+ get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr),
+ IsOper(sptr) ? 'O' : 'o');
log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#R)", name, sptr);
}
diff -r dc2bab3d00a5 ircd/m_rehash.c
--- a/ircd/m_rehash.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_rehash.c Thu Jul 25 19:00:52 2013 +0100
@@ -121,8 +121,8 @@
}
send_reply(sptr, RPL_REHASHING, configfile);
- sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file",
- sptr);
+ sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file",
+ get_client_name_and_opername(sptr));
log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr);
diff -r dc2bab3d00a5 ircd/m_sethost.c
--- a/ircd/m_sethost.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_sethost.c Thu Jul 25 19:00:52 2013 +0100
@@ -196,7 +196,7 @@
if (freeform) {
sendto_opmask_butone(0, SNO_OLDSNO,
- "%C SETHOST %s%s%s (freeform)", sptr,
+ "%s SETHOST %s%s%s (freeform)", get_client_name_and_opername(sptr),
user ? user : "", user ? "@" : "", host);
log_write(LS_SETHOST, L_NOTICE, LOG_NOSNOTICE,
diff -r dc2bab3d00a5 ircd/m_settime.c
--- a/ircd/m_settime.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/m_settime.c Thu Jul 25 19:00:52 2013 +0100
@@ -177,7 +177,7 @@
else /* tell opers about time change */
{
sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld "
- "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt,
+ "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt,
(dt < 0) ? "forwards" : "backwards");
/* Apply time change... */
TSoffset -= dt;
@@ -252,7 +252,7 @@
else /* tell opers about time change */
{
sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld "
- "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt,
+ "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt,
(dt < 0) ? "forwards" : "backwards");
TSoffset -= dt; /* apply time change */
if (IsUser(sptr)) /* let user know what we did */
diff -r dc2bab3d00a5 ircd/s_misc.c
--- a/ircd/s_misc.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/s_misc.c Thu Jul 25 19:00:52 2013 +0100
@@ -172,6 +172,20 @@
return nbuf;
}
+/** Return the name of the client and the opername for accountability purposes
+ * in snomask and other places.
+ * @param sptr Client to operate on.
+ * @return Either cli_name(\a sptr) or a static buffer.
+ */
+const char* get_client_name_and_opername(const struct Client* sptr) {
+ static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2];
+
+ if (!IsUser(sptr) || !cli_user(sptr)->opername)
+ return cli_name(sptr);
+ ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername);
+ return nbuf;
+}
+
/**
* Exit one client, local or remote. Assuming for local client that
* all dependents already have been removed, and socket is closed.
@@ -474,7 +488,7 @@
(cli_user(killer)->server == victim ||
cli_user(killer)->server == cli_serv(victim)->up) ?
"Local" : "Remote",
- get_client_name(killer, HIDE_IP),
+ get_client_name_and_opername(killer),
cli_name(cli_user(killer)->server));
else if (killer != &me && cli_serv(victim)->up != killer)
sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :",
diff -r dc2bab3d00a5 ircd/s_user.c
--- a/ircd/s_user.c Thu Jul 25 18:59:27 2013 +0100
+++ b/ircd/s_user.c Thu Jul 25 19:00:52 2013 +0100
@@ -1491,9 +1491,9 @@
/* notify my operators a user has OPERed on a remote server */
if (!MyConnect(sptr)) {
- sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) as %s on %s",
- cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost,
- cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server));
+ sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) on %s",
+ get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost,
+ cli_name(cli_user(sptr)->server));
}
}
@@ -1506,9 +1506,8 @@
if (FlagHas(&setflags, FLAG_LOCOP) && !IsLocOp(sptr)) {
/* notify my operators a local operator has deOPERed */
- sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s",
- cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr),
- cli_user(sptr)->opername);
+ sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o)",
+ get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr));
}
if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) {
/* user no longer oper */
@@ -1518,12 +1517,11 @@
/* notify my operators an operator has deOPERed on the network */
if (MyConnect(sptr)) {
sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O)",
- cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr),
- cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>");
+ get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr));
} else {
sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) on %s",
- cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost,
- cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server));
+ get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost,
+ cli_name(cli_user(sptr)->server));
}
client_set_privs(sptr, NULL); /* will clear propagate privilege */