]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - opername.patch
Some patches
[irc/quakenet/snircd-patchqueue.git] / opername.patch
1 Add opername to snomask, remote connect wallops, and logging
2
3 diff -r 897950943d34 include/client.h
4 --- a/include/client.h Mon Jan 12 18:45:19 2009 +0100
5 +++ b/include/client.h Mon Jan 12 19:23:07 2009 +0100
6 @@ -806,6 +806,7 @@
7 #define IPV6USERBITS 64
8
9 extern const char* get_client_name(const struct Client* sptr, int showip);
10 +extern const char* get_client_name_and_opername(const struct Client* sptr);
11 extern const char* client_get_default_umode(const struct Client* sptr);
12 extern int client_get_ping(const struct Client* local_client);
13 extern void client_drop_sendq(struct Connection* con);
14 diff -r 897950943d34 ircd/channel.c
15 --- a/ircd/channel.c Mon Jan 12 18:45:19 2009 +0100
16 +++ b/ircd/channel.c Mon Jan 12 19:23:07 2009 +0100
17 @@ -1850,8 +1850,8 @@
18 if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
19 sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
20 "[%Tu]",
21 - cli_name(feature_bool(FEAT_HIS_SNOTICES) ?
22 - mbuf->mb_source : app_source),
23 + feature_bool(FEAT_HIS_SNOTICES) ?
24 + get_client_name_and_opername(mbuf->mb_source) : cli_name(app_source),
25 mbuf->mb_channel->chname,
26 rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
27 addbuf, remstr, addstr,
28 @@ -1859,7 +1859,7 @@
29
30 if (mbuf->mb_dest & MODEBUF_DEST_LOG)
31 log_write(LS_OPERMODE, L_INFO, LOG_NOSNOTICE,
32 - "%#C OPMODE %H %s%s%s%s%s%s", mbuf->mb_source,
33 + "%s OPMODE %H %s%s%s%s%s%s", get_client_name_and_opername(mbuf->mb_source),
34 mbuf->mb_channel, rembuf_i ? "-" : "", rembuf,
35 addbuf_i ? "+" : "", addbuf, remstr, addstr);
36
37 diff -r 897950943d34 ircd/gline.c
38 --- a/ircd/gline.c Mon Jan 12 18:45:19 2009 +0100
39 +++ b/ircd/gline.c Mon Jan 12 19:23:07 2009 +0100
40 @@ -566,7 +566,7 @@
41 sendto_opmask_butone(0, snomask, "%s adding %s %s for %s%s%s%s%s, expiring at "
42 "%Tu: %s",
43 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
44 - cli_name(sptr) :
45 + get_client_name_and_opername(sptr) :
46 cli_name((cli_user(sptr))->server),
47 (flags & GLINE_LOCAL) ? "local" : "global",
48 (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE",
49 @@ -579,7 +579,7 @@
50
51 /* and log it */
52 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
53 - "%#C adding %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
54 + "%s adding %s %s for %s%s%s%s%s, expiring at %Tu: %s", get_client_name_and_opername(sptr),
55 flags & GLINE_LOCAL ? "local" : "global",
56 flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE",
57 flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : nick,
58 @@ -652,7 +652,7 @@
59 sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
60 "expiring at %Tu: %s",
61 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
62 - cli_name(sptr) :
63 + get_client_name_and_opername(sptr) :
64 cli_name((cli_user(sptr))->server),
65 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
66 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
67 @@ -662,7 +662,7 @@
68 gline->gl_expire + TSoffset, gline->gl_reason);
69
70 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
71 - "%#C activating global %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
72 + "%s activating global %s for %s%s%s%s%s, expiring at %Tu: %s", get_client_name_and_opername(sptr),
73 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
74 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
75 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
76 @@ -725,7 +725,7 @@
77 sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
78 "%s",
79 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
80 - cli_name(sptr) :
81 + get_client_name_and_opername(sptr) :
82 cli_name((cli_user(sptr))->server),
83 msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
84 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
85 @@ -735,7 +735,7 @@
86 gline->gl_expire + TSoffset, gline->gl_reason);
87
88 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
89 - "%#C %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr, msg,
90 + "%s %s %s for %s%s%s%s%s, expiring at %Tu: %s", get_client_name_and_opername(sptr), msg,
91 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
92 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
93 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
94 @@ -940,7 +940,7 @@
95 /* All right, inform ops... */
96 sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s",
97 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
98 - cli_name(sptr) : cli_name((cli_user(sptr))->server),
99 + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
100 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
101 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
102 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
103 @@ -949,7 +949,7 @@
104
105 /* and log the change */
106 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
107 - "%#C modifying global %s for %s%s%s:%s", sptr,
108 + "%s modifying global %s for %s%s%s:%s", get_client_name_and_opername(sptr),
109 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
110 gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "",
111 buf);
112 @@ -997,14 +997,14 @@
113 /* Inform ops and log it */
114 sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
115 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
116 - cli_name(sptr) : cli_name((cli_user(sptr))->server),
117 + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server),
118 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
119 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
120 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
121 gline->gl_user, gline->gl_host ? "@" : "",
122 gline->gl_host ? gline->gl_host : "");
123 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
124 - "%#C removing local %s for %s%s%s%s%s", sptr,
125 + "%s removing local %s for %s%s%s%s%s", get_client_name_and_opername(sptr),
126 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
127 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
128 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
129 diff -r 897950943d34 ircd/ircd_log.c
130 --- a/ircd/ircd_log.c Mon Jan 12 18:45:19 2009 +0100
131 +++ b/ircd/ircd_log.c Mon Jan 12 19:23:07 2009 +0100
132 @@ -469,11 +469,11 @@
133 {
134 if (MyUser(victim))
135 log_write(IsServer(killer) ? LS_SERVKILL : LS_OPERKILL, L_TRACE, 0,
136 - "A local client %#C KILLED by %#C Path: %s!%s %s",
137 - victim, killer, inpath, path, msg);
138 + "A local client %#C KILLED by %s Path: %s!%s %s",
139 + victim, get_client_name_and_opername(killer), inpath, path, msg);
140 else
141 log_write(IsServer(killer) ? LS_SERVKILL : LS_OPERKILL, L_TRACE, 0,
142 - "KILL from %C For %C Path: %s!%s %s", killer, victim, inpath,
143 + "KILL from %s For %C Path: %s!%s %s", get_client_name_and_opername(killer), victim, inpath,
144 path, msg);
145 }
146
147 diff -r 897950943d34 ircd/jupe.c
148 --- a/ircd/jupe.c Mon Jan 12 18:45:19 2009 +0100
149 +++ b/ircd/jupe.c Mon Jan 12 19:23:07 2009 +0100
150 @@ -156,13 +156,13 @@
151 sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
152 "%Tu: %s",
153 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
154 - cli_name(sptr) :
155 + get_client_name_and_opername(sptr) :
156 cli_name((cli_user(sptr))->server),
157 flags & JUPE_LOCAL ? "local " : "", server,
158 expire + TSoffset, reason);
159
160 log_write(LS_JUPE, L_INFO, LOG_NOSNOTICE,
161 - "%#C adding %sJUPE for %s, expiring at %Tu: %s", sptr,
162 + "%s adding %sJUPE for %s, expiring at %Tu: %s", get_client_name_and_opername(sptr),
163 flags & JUPE_LOCAL ? "local " : "", server, expire + TSoffset,
164 reason);
165
166 @@ -216,13 +216,13 @@
167 sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
168 "at %Tu: %s",
169 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
170 - cli_name(sptr) :
171 + get_client_name_and_opername(sptr) :
172 cli_name((cli_user(sptr))->server),
173 jupe->ju_server, jupe->ju_expire + TSoffset,
174 jupe->ju_reason);
175
176 log_write(LS_JUPE, L_INFO, LOG_NOSNOTICE,
177 - "%#C activating JUPE for %s, expiring at %Tu: %s",sptr,
178 + "%s activating JUPE for %s, expiring at %Tu: %s", get_client_name_and_opername(sptr),
179 jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
180
181 if (!(flags & JUPE_LOCAL)) /* don't propagate local changes */
182 @@ -269,14 +269,14 @@
183 sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
184 "%s",
185 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
186 - cli_name(sptr) :
187 + get_client_name_and_opername(sptr) :
188 cli_name((cli_user(sptr))->server),
189 JupeIsLocal(jupe) ? "removing local" : "deactivating",
190 jupe->ju_server, jupe->ju_expire + TSoffset,
191 jupe->ju_reason);
192
193 log_write(LS_JUPE, L_INFO, LOG_NOSNOTICE,
194 - "%#C %s JUPE for %s, expiring at %Tu: %s", sptr,
195 + "%s %s JUPE for %s, expiring at %Tu: %s", get_client_name_and_opername(sptr),
196 JupeIsLocal(jupe) ? "removing local" : "deactivating",
197 jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
198
199 diff -r 897950943d34 ircd/m_connect.c
200 --- a/ircd/m_connect.c Mon Jan 12 18:45:19 2009 +0100
201 +++ b/ircd/m_connect.c Mon Jan 12 19:23:07 2009 +0100
202 @@ -197,8 +197,9 @@
203 sendwallto_group_butone(&me, WALL_WALLOPS, 0,
204 "Remote CONNECT %s %s from %s", aconf->name,
205 parv[2] ? parv[2] : "",
206 - get_client_name(sptr, HIDE_IP));
207 - log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name,
208 + get_client_name_and_opername(sptr));
209 + log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %s : %s %s",
210 + get_client_name_and_opername(sptr), aconf->name,
211 parv[2] ? parv[2] : "");
212
213 if (connect_server(aconf, sptr)) {
214 diff -r 897950943d34 ircd/m_join.c
215 --- a/ircd/m_join.c Mon Jan 12 18:45:19 2009 +0100
216 +++ b/ircd/m_join.c Mon Jan 12 19:23:07 2009 +0100
217 @@ -242,8 +242,8 @@
218 }
219 /* send accountability notice */
220 if (err)
221 - sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %C JOIN %H "
222 - "(overriding +%c)", sptr, chptr, err);
223 + sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %s JOIN %H "
224 + "(overriding +%c)", get_client_name_and_opername(sptr), chptr, err);
225 err = 0;
226 }
227
228 diff -r 897950943d34 ircd/m_kill.c
229 --- a/ircd/m_kill.c Mon Jan 12 18:45:19 2009 +0100
230 +++ b/ircd/m_kill.c Mon Jan 12 19:23:07 2009 +0100
231 @@ -127,7 +127,7 @@
232 */
233 sendto_opmask_butone(0, snomask,
234 "Received KILL message for %s from %s Path: %s!%s %s",
235 - get_client_name(victim, SHOW_IP), cli_name(sptr),
236 + get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr),
237 inpath, path, msg);
238 log_write_kill(victim, sptr, inpath, path, msg);
239
240 diff -r 897950943d34 ircd/m_rehash.c
241 --- a/ircd/m_rehash.c Mon Jan 12 18:45:19 2009 +0100
242 +++ b/ircd/m_rehash.c Mon Jan 12 19:23:07 2009 +0100
243 @@ -121,10 +121,10 @@
244 }
245
246 send_reply(sptr, RPL_REHASHING, configfile);
247 - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file",
248 - sptr);
249 + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file",
250 + get_client_name_and_opername(sptr));
251
252 - log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr);
253 + log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %s", get_client_name_and_opername(sptr));
254
255 return rehash(cptr, flag);
256 }
257 diff -r 897950943d34 ircd/m_settime.c
258 --- a/ircd/m_settime.c Mon Jan 12 18:45:19 2009 +0100
259 +++ b/ircd/m_settime.c Mon Jan 12 19:23:07 2009 +0100
260 @@ -177,7 +177,7 @@
261 else /* tell opers about time change */
262 {
263 sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld "
264 - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt,
265 + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt,
266 (dt < 0) ? "forwards" : "backwards");
267 /* Apply time change... */
268 TSoffset -= dt;
269 @@ -252,7 +252,7 @@
270 else /* tell opers about time change */
271 {
272 sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld "
273 - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt,
274 + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt,
275 (dt < 0) ? "forwards" : "backwards");
276 TSoffset -= dt; /* apply time change */
277 if (IsUser(sptr)) /* let user know what we did */
278 diff -r 897950943d34 ircd/s_misc.c
279 --- a/ircd/s_misc.c Mon Jan 12 18:45:19 2009 +0100
280 +++ b/ircd/s_misc.c Mon Jan 12 19:23:07 2009 +0100
281 @@ -169,6 +169,20 @@
282 ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr),
283 IsIdented(sptr) ? cli_username(sptr) : "",
284 cli_sock_ip(sptr));
285 + return nbuf;
286 +}
287 +
288 +/** Return the name of the client and the opername for accountability purposes
289 + * in snomask and other places.
290 + * @param sptr Client to operate on.
291 + * @return Either cli_name(\a sptr) or a static buffer.
292 + */
293 +const char* get_client_name_and_opername(const struct Client* sptr) {
294 + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2];
295 +
296 + if (!IsUser(sptr) || !cli_user(sptr)->opername)
297 + return cli_name(sptr);
298 + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername);
299 return nbuf;
300 }
301
302 @@ -474,7 +488,7 @@
303 (cli_user(killer)->server == victim ||
304 cli_user(killer)->server == cli_serv(victim)->up) ?
305 "Local" : "Remote",
306 - get_client_name(killer, HIDE_IP),
307 + get_client_name_and_opername(killer),
308 cli_name(cli_user(killer)->server));
309 else if (killer != &me && cli_serv(victim)->up != killer)
310 sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :",