]>
Commit | Line | Data |
---|---|---|
1 | Add opername to snomask, remote connect wallops, and as prefix to server jupes | |
2 | ||
3 | in form of nick(opername) | |
4 | new function get_client_name_and_opername() add in s_misc.c | |
5 | mirrored after get_client_name() which can return either nick/server or nick[ident@ip] | |
6 | ||
7 | diff -r 7f6ed442e24f include/client.h | |
8 | --- a/include/client.h Tue Mar 23 23:58:24 2010 +0100 | |
9 | +++ b/include/client.h Wed Mar 24 00:18:22 2010 +0100 | |
10 | @@ -810,6 +810,7 @@ | |
11 | #define IPV6USERBITS 64 | |
12 | ||
13 | extern const char* get_client_name(const struct Client* sptr, int showip); | |
14 | +extern const char* get_client_name_and_opername(const struct Client* sptr); | |
15 | extern const char* client_get_default_umode(const struct Client* sptr); | |
16 | extern int client_get_ping(const struct Client* local_client); | |
17 | extern void client_drop_sendq(struct Connection* con); | |
18 | diff -r 7f6ed442e24f ircd/channel.c | |
19 | --- a/ircd/channel.c Tue Mar 23 23:58:24 2010 +0100 | |
20 | +++ b/ircd/channel.c Wed Mar 24 00:18:22 2010 +0100 | |
21 | @@ -1905,8 +1905,8 @@ | |
22 | if (mbuf->mb_dest & MODEBUF_DEST_HACK4) | |
23 | sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s " | |
24 | "[%Tu]", | |
25 | - cli_name(feature_bool(FEAT_HIS_SNOTICES) ? | |
26 | - mbuf->mb_source : app_source), | |
27 | + feature_bool(FEAT_HIS_SNOTICES) ? | |
28 | + get_client_name_and_opername(mbuf->mb_source) : cli_name(app_source), | |
29 | mbuf->mb_channel->chname, | |
30 | rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", | |
31 | addbuf, remstr, addstr, | |
32 | diff -r 7f6ed442e24f ircd/gline.c | |
33 | --- a/ircd/gline.c Tue Mar 23 23:58:24 2010 +0100 | |
34 | +++ b/ircd/gline.c Wed Mar 24 00:18:22 2010 +0100 | |
35 | @@ -567,7 +567,7 @@ | |
36 | SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at " | |
37 | "%Tu: %s", | |
38 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
39 | - cli_name(sptr) : | |
40 | + get_client_name_and_opername(sptr) : | |
41 | cli_name((cli_user(sptr))->server), | |
42 | (flags & GLINE_ACTIVE) ? "" : "deactivated ", | |
43 | (flags & GLINE_LOCAL) ? "local" : "global", | |
44 | @@ -642,7 +642,7 @@ | |
45 | sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, " | |
46 | "expiring at %Tu: %s", | |
47 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
48 | - cli_name(sptr) : | |
49 | + get_client_name_and_opername(sptr) : | |
50 | cli_name((cli_user(sptr))->server), | |
51 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
52 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
53 | @@ -715,7 +715,7 @@ | |
54 | sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: " | |
55 | "%s", | |
56 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
57 | - cli_name(sptr) : | |
58 | + get_client_name_and_opername(sptr) : | |
59 | cli_name((cli_user(sptr))->server), | |
60 | msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
61 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
62 | @@ -919,7 +919,7 @@ | |
63 | /* All right, inform ops... */ | |
64 | sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s", | |
65 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
66 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
67 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
68 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
69 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
70 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
71 | @@ -966,7 +966,7 @@ | |
72 | /* Inform ops and log it */ | |
73 | sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s", | |
74 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
75 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
76 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
77 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
78 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
79 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
80 | diff -r 7f6ed442e24f ircd/jupe.c | |
81 | --- a/ircd/jupe.c Tue Mar 23 23:58:24 2010 +0100 | |
82 | +++ b/ircd/jupe.c Wed Mar 24 00:18:22 2010 +0100 | |
83 | @@ -156,7 +156,7 @@ | |
84 | sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at " | |
85 | "%Tu: %s", | |
86 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
87 | - cli_name(sptr) : | |
88 | + get_client_name_and_opername(sptr) : | |
89 | cli_name((cli_user(sptr))->server), | |
90 | flags & JUPE_LOCAL ? "local " : "", server, | |
91 | expire + TSoffset, reason); | |
92 | @@ -211,7 +211,7 @@ | |
93 | sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring " | |
94 | "at %Tu: %s", | |
95 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
96 | - cli_name(sptr) : | |
97 | + get_client_name_and_opername(sptr) : | |
98 | cli_name((cli_user(sptr))->server), | |
99 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
100 | jupe->ju_reason); | |
101 | @@ -264,7 +264,7 @@ | |
102 | sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: " | |
103 | "%s", | |
104 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
105 | - cli_name(sptr) : | |
106 | + get_client_name_and_opername(sptr) : | |
107 | cli_name((cli_user(sptr))->server), | |
108 | JupeIsLocal(jupe) ? "removing local" : "deactivating", | |
109 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
110 | diff -r 7f6ed442e24f ircd/m_connect.c | |
111 | --- a/ircd/m_connect.c Tue Mar 23 23:58:24 2010 +0100 | |
112 | +++ b/ircd/m_connect.c Wed Mar 24 00:18:22 2010 +0100 | |
113 | @@ -197,7 +197,7 @@ | |
114 | sendwallto_group_butone(&me, WALL_WALLOPS, 0, | |
115 | "Remote CONNECT %s %s from %s", aconf->name, | |
116 | parv[2] ? parv[2] : "", | |
117 | - get_client_name(sptr, HIDE_IP)); | |
118 | + get_client_name_and_opername(sptr)); | |
119 | log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name, | |
120 | parv[2] ? parv[2] : ""); | |
121 | ||
122 | diff -r 7f6ed442e24f ircd/m_join.c | |
123 | --- a/ircd/m_join.c Tue Mar 23 23:58:24 2010 +0100 | |
124 | +++ b/ircd/m_join.c Wed Mar 24 00:18:22 2010 +0100 | |
125 | @@ -242,8 +242,8 @@ | |
126 | } | |
127 | /* send accountability notice */ | |
128 | if (err) | |
129 | - sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %C JOIN %H " | |
130 | - "(overriding +%c)", sptr, chptr, err); | |
131 | + sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %s JOIN %H " | |
132 | + "(overriding +%c)", get_client_name_and_opername(sptr), chptr, err); | |
133 | err = 0; | |
134 | } | |
135 | ||
136 | diff -r 7f6ed442e24f ircd/m_jupe.c | |
137 | --- a/ircd/m_jupe.c Tue Mar 23 23:58:24 2010 +0100 | |
138 | +++ b/ircd/m_jupe.c Wed Mar 24 00:18:22 2010 +0100 | |
139 | @@ -193,7 +193,7 @@ | |
140 | struct Jupe *ajupe; | |
141 | unsigned int flags = 0; | |
142 | time_t expire_off; | |
143 | - char *server = parv[1], *target = 0, *reason; | |
144 | + char *server = parv[1], *target = 0, reason[BUFSIZE]; | |
145 | ||
146 | if (parc < 2) { | |
147 | if (!HasPriv(sptr, PRIV_ROUTEINFO)) | |
148 | @@ -214,12 +214,12 @@ | |
149 | ||
150 | if (parc == 4) { | |
151 | expire_off = atoi(parv[2]); | |
152 | - reason = parv[3]; | |
153 | + ircd_snprintf(0, reason, sizeof(reason), "%s: %s", cli_user(sptr)->opername, parv[3]); | |
154 | flags |= JUPE_LOCAL; | |
155 | } else if (parc > 4) { | |
156 | target = parv[2]; | |
157 | expire_off = atoi(parv[3]); | |
158 | - reason = parv[4]; | |
159 | + ircd_snprintf(0, reason, sizeof(reason), "%s: %s", cli_user(sptr)->opername, parv[4]); | |
160 | } else | |
161 | return need_more_params(sptr, "JUPE"); | |
162 | ||
163 | diff -r 7f6ed442e24f ircd/m_kill.c | |
164 | --- a/ircd/m_kill.c Tue Mar 23 23:58:24 2010 +0100 | |
165 | +++ b/ircd/m_kill.c Wed Mar 24 00:18:22 2010 +0100 | |
166 | @@ -127,7 +127,7 @@ | |
167 | */ | |
168 | sendto_opmask_butone(0, snomask, | |
169 | "Received KILL message for %s from %s Path: %s!%s %s", | |
170 | - get_client_name(victim, SHOW_IP), cli_name(sptr), | |
171 | + get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr), | |
172 | inpath, path, msg); | |
173 | log_write_kill(victim, sptr, inpath, path, msg); | |
174 | ||
175 | diff -r 7f6ed442e24f ircd/m_oper.c | |
176 | --- a/ircd/m_oper.c Tue Mar 23 23:58:24 2010 +0100 | |
177 | +++ b/ircd/m_oper.c Wed Mar 24 00:18:22 2010 +0100 | |
178 | @@ -192,9 +192,9 @@ | |
179 | send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE)); | |
180 | send_reply(sptr, RPL_YOUREOPER); | |
181 | ||
182 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c) as %s", | |
183 | - parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr), | |
184 | - IsOper(sptr) ? 'O' : 'o', cli_user(sptr)->opername); | |
185 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)", | |
186 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), | |
187 | + IsOper(sptr) ? 'O' : 'o'); | |
188 | ||
189 | log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#R)", name, sptr); | |
190 | } | |
191 | diff -r 7f6ed442e24f ircd/m_rehash.c | |
192 | --- a/ircd/m_rehash.c Tue Mar 23 23:58:24 2010 +0100 | |
193 | +++ b/ircd/m_rehash.c Wed Mar 24 00:18:22 2010 +0100 | |
194 | @@ -121,8 +121,8 @@ | |
195 | } | |
196 | ||
197 | send_reply(sptr, RPL_REHASHING, configfile); | |
198 | - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file", | |
199 | - sptr); | |
200 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file", | |
201 | + get_client_name_and_opername(sptr)); | |
202 | ||
203 | log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); | |
204 | ||
205 | diff -r 7f6ed442e24f ircd/m_settime.c | |
206 | --- a/ircd/m_settime.c Tue Mar 23 23:58:24 2010 +0100 | |
207 | +++ b/ircd/m_settime.c Wed Mar 24 00:18:22 2010 +0100 | |
208 | @@ -177,7 +177,7 @@ | |
209 | else /* tell opers about time change */ | |
210 | { | |
211 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
212 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
213 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
214 | (dt < 0) ? "forwards" : "backwards"); | |
215 | /* Apply time change... */ | |
216 | TSoffset -= dt; | |
217 | @@ -252,7 +252,7 @@ | |
218 | else /* tell opers about time change */ | |
219 | { | |
220 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
221 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
222 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
223 | (dt < 0) ? "forwards" : "backwards"); | |
224 | TSoffset -= dt; /* apply time change */ | |
225 | if (IsUser(sptr)) /* let user know what we did */ | |
226 | diff -r 7f6ed442e24f ircd/s_misc.c | |
227 | --- a/ircd/s_misc.c Tue Mar 23 23:58:24 2010 +0100 | |
228 | +++ b/ircd/s_misc.c Wed Mar 24 00:18:22 2010 +0100 | |
229 | @@ -172,6 +172,20 @@ | |
230 | return nbuf; | |
231 | } | |
232 | ||
233 | +/** Return the name of the client and the opername for accountability purposes | |
234 | + * in snomask and other places. | |
235 | + * @param sptr Client to operate on. | |
236 | + * @return Either cli_name(\a sptr) or a static buffer. | |
237 | + */ | |
238 | +const char* get_client_name_and_opername(const struct Client* sptr) { | |
239 | + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2]; | |
240 | + | |
241 | + if (!IsUser(sptr) || !cli_user(sptr)->opername) | |
242 | + return cli_name(sptr); | |
243 | + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername); | |
244 | + return nbuf; | |
245 | +} | |
246 | + | |
247 | /** | |
248 | * Exit one client, local or remote. Assuming for local client that | |
249 | * all dependents already have been removed, and socket is closed. | |
250 | @@ -474,7 +488,7 @@ | |
251 | (cli_user(killer)->server == victim || | |
252 | cli_user(killer)->server == cli_serv(victim)->up) ? | |
253 | "Local" : "Remote", | |
254 | - get_client_name(killer, HIDE_IP), | |
255 | + get_client_name_and_opername(killer), | |
256 | cli_name(cli_user(killer)->server)); | |
257 | else if (killer != &me && cli_serv(victim)->up != killer) | |
258 | sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :", | |
259 | diff -r 7f6ed442e24f ircd/s_user.c | |
260 | --- a/ircd/s_user.c Tue Mar 23 23:58:24 2010 +0100 | |
261 | +++ b/ircd/s_user.c Wed Mar 24 00:18:22 2010 +0100 | |
262 | @@ -1324,9 +1324,8 @@ | |
263 | cli_handler(sptr) = CLIENT_HANDLER; | |
264 | ||
265 | /* notify my operators a local operator has deOPERed - wiebe */ | |
266 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s", | |
267 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
268 | - cli_user(sptr)->opername); | |
269 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o)", | |
270 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost); | |
271 | ||
272 | } | |
273 | } | |
274 | @@ -1528,9 +1527,9 @@ | |
275 | ||
276 | /* notify my operators a user has OPERed on a remote server - wiebe */ | |
277 | if (!MyConnect(sptr)) { | |
278 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) as %s on %s", | |
279 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
280 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
281 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) on %s", | |
282 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
283 | + cli_name(cli_user(sptr)->server)); | |
284 | } | |
285 | ||
286 | } | |
287 | @@ -1545,13 +1544,12 @@ | |
288 | ||
289 | /* notify my operators an operator has deOPERed on the network - wiebe */ | |
290 | if (MyConnect(sptr)) { | |
291 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", | |
292 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
293 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>"); | |
294 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O)", | |
295 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost); | |
296 | } else { | |
297 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", | |
298 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
299 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
300 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) on %s", | |
301 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
302 | + cli_name(cli_user(sptr)->server)); | |
303 | } | |
304 | ||
305 | client_set_privs(sptr, NULL); /* will clear propagate privilege */ |