]>
Commit | Line | Data |
---|---|---|
1 | Add opername to snomask and remote connect wallops | |
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 a1e13a4f150b include/client.h | |
8 | --- a/include/client.h Wed Mar 17 14:52:11 2010 +0100 | |
9 | +++ b/include/client.h Wed Mar 17 15:44:04 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 a1e13a4f150b ircd/channel.c | |
19 | --- a/ircd/channel.c Wed Mar 17 14:52:11 2010 +0100 | |
20 | +++ b/ircd/channel.c Wed Mar 17 15:44:04 2010 +0100 | |
21 | @@ -1848,8 +1848,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 a1e13a4f150b ircd/gline.c | |
33 | --- a/ircd/gline.c Wed Mar 17 14:52:11 2010 +0100 | |
34 | +++ b/ircd/gline.c Wed Mar 17 15:44:04 2010 +0100 | |
35 | @@ -563,7 +563,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 | @@ -638,7 +638,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 | @@ -711,7 +711,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 | @@ -915,7 +915,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 | @@ -962,7 +962,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 a1e13a4f150b ircd/jupe.c | |
81 | --- a/ircd/jupe.c Wed Mar 17 14:52:11 2010 +0100 | |
82 | +++ b/ircd/jupe.c Wed Mar 17 15:44:04 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 a1e13a4f150b ircd/m_connect.c | |
111 | --- a/ircd/m_connect.c Wed Mar 17 14:52:11 2010 +0100 | |
112 | +++ b/ircd/m_connect.c Wed Mar 17 15:44:04 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 a1e13a4f150b ircd/m_join.c | |
123 | --- a/ircd/m_join.c Wed Mar 17 14:52:11 2010 +0100 | |
124 | +++ b/ircd/m_join.c Wed Mar 17 15:44:04 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 a1e13a4f150b ircd/m_kill.c | |
137 | --- a/ircd/m_kill.c Wed Mar 17 14:52:11 2010 +0100 | |
138 | +++ b/ircd/m_kill.c Wed Mar 17 15:44:04 2010 +0100 | |
139 | @@ -127,7 +127,7 @@ | |
140 | */ | |
141 | sendto_opmask_butone(0, snomask, | |
142 | "Received KILL message for %s from %s Path: %s!%s %s", | |
143 | - get_client_name(victim, SHOW_IP), cli_name(sptr), | |
144 | + get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr), | |
145 | inpath, path, msg); | |
146 | log_write_kill(victim, sptr, inpath, path, msg); | |
147 | ||
148 | diff -r a1e13a4f150b ircd/m_oper.c | |
149 | --- a/ircd/m_oper.c Wed Mar 17 14:52:11 2010 +0100 | |
150 | +++ b/ircd/m_oper.c Wed Mar 17 15:44:04 2010 +0100 | |
151 | @@ -192,9 +192,9 @@ | |
152 | send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE)); | |
153 | send_reply(sptr, RPL_YOUREOPER); | |
154 | ||
155 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c) as %s", | |
156 | - parv[0], cli_user(sptr)->realusername, cli_sockhost(sptr), | |
157 | - IsOper(sptr) ? 'O' : 'o', cli_user(sptr)->opername); | |
158 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)", | |
159 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), | |
160 | + IsOper(sptr) ? 'O' : 'o'); | |
161 | ||
162 | log_write(LS_OPER, L_INFO, 0, "OPER (%s) by (%#R)", name, sptr); | |
163 | } | |
164 | diff -r a1e13a4f150b ircd/m_rehash.c | |
165 | --- a/ircd/m_rehash.c Wed Mar 17 14:52:11 2010 +0100 | |
166 | +++ b/ircd/m_rehash.c Wed Mar 17 15:44:04 2010 +0100 | |
167 | @@ -121,8 +121,8 @@ | |
168 | } | |
169 | ||
170 | send_reply(sptr, RPL_REHASHING, configfile); | |
171 | - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file", | |
172 | - sptr); | |
173 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file", | |
174 | + get_client_name_and_opername(sptr)); | |
175 | ||
176 | log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); | |
177 | ||
178 | diff -r a1e13a4f150b ircd/m_settime.c | |
179 | --- a/ircd/m_settime.c Wed Mar 17 14:52:11 2010 +0100 | |
180 | +++ b/ircd/m_settime.c Wed Mar 17 15:44:04 2010 +0100 | |
181 | @@ -177,7 +177,7 @@ | |
182 | else /* tell opers about time change */ | |
183 | { | |
184 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
185 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
186 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
187 | (dt < 0) ? "forwards" : "backwards"); | |
188 | /* Apply time change... */ | |
189 | TSoffset -= dt; | |
190 | @@ -252,7 +252,7 @@ | |
191 | else /* tell opers about time change */ | |
192 | { | |
193 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
194 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
195 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
196 | (dt < 0) ? "forwards" : "backwards"); | |
197 | TSoffset -= dt; /* apply time change */ | |
198 | if (IsUser(sptr)) /* let user know what we did */ | |
199 | diff -r a1e13a4f150b ircd/s_misc.c | |
200 | --- a/ircd/s_misc.c Wed Mar 17 14:52:11 2010 +0100 | |
201 | +++ b/ircd/s_misc.c Wed Mar 17 15:44:04 2010 +0100 | |
202 | @@ -172,6 +172,20 @@ | |
203 | return nbuf; | |
204 | } | |
205 | ||
206 | +/** Return the name of the client and the opername for accountability purposes | |
207 | + * in snomask and other places. | |
208 | + * @param sptr Client to operate on. | |
209 | + * @return Either cli_name(\a sptr) or a static buffer. | |
210 | + */ | |
211 | +const char* get_client_name_and_opername(const struct Client* sptr) { | |
212 | + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2]; | |
213 | + | |
214 | + if (!IsUser(sptr) || !cli_user(sptr)->opername) | |
215 | + return cli_name(sptr); | |
216 | + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername); | |
217 | + return nbuf; | |
218 | +} | |
219 | + | |
220 | /** | |
221 | * Exit one client, local or remote. Assuming for local client that | |
222 | * all dependents already have been removed, and socket is closed. | |
223 | @@ -474,7 +488,7 @@ | |
224 | (cli_user(killer)->server == victim || | |
225 | cli_user(killer)->server == cli_serv(victim)->up) ? | |
226 | "Local" : "Remote", | |
227 | - get_client_name(killer, HIDE_IP), | |
228 | + get_client_name_and_opername(killer), | |
229 | cli_name(cli_user(killer)->server)); | |
230 | else if (killer != &me && cli_serv(victim)->up != killer) | |
231 | sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :", | |
232 | diff -r a1e13a4f150b ircd/s_user.c | |
233 | --- a/ircd/s_user.c Wed Mar 17 14:52:11 2010 +0100 | |
234 | +++ b/ircd/s_user.c Wed Mar 17 15:44:04 2010 +0100 | |
235 | @@ -1342,9 +1342,8 @@ | |
236 | cli_handler(sptr) = CLIENT_HANDLER; | |
237 | ||
238 | /* notify my operators a local operator has deOPERed - wiebe */ | |
239 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s", | |
240 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
241 | - cli_user(sptr)->opername); | |
242 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o)", | |
243 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost); | |
244 | ||
245 | } | |
246 | } | |
247 | @@ -1546,9 +1545,9 @@ | |
248 | ||
249 | /* notify my operators a user has OPERed on a remote server - wiebe */ | |
250 | if (!MyConnect(sptr)) { | |
251 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) as %s on %s", | |
252 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
253 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
254 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) on %s", | |
255 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
256 | + cli_name(cli_user(sptr)->server)); | |
257 | } | |
258 | ||
259 | } | |
260 | @@ -1563,13 +1562,12 @@ | |
261 | ||
262 | /* notify my operators an operator has deOPERed on the network - wiebe */ | |
263 | if (MyConnect(sptr)) { | |
264 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", | |
265 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
266 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>"); | |
267 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O)", | |
268 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost); | |
269 | } else { | |
270 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", | |
271 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
272 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
273 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) on %s", | |
274 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
275 | + cli_name(cli_user(sptr)->server)); | |
276 | } | |
277 | ||
278 | client_set_privs(sptr, NULL); /* will clear propagate privilege */ |