]>
Commit | Line | Data |
---|---|---|
194ecdc4 | 1 | Add opername to snomask, remote connect wallops, and as prefix to server jupes |
7efbed3b | 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] | |
88a737db | 6 | |
6fe1b135 P |
7 | diff -r bba899468eaf include/client.h |
8 | --- a/include/client.h Sat Jul 20 14:58:09 2013 +0100 | |
9 | +++ b/include/client.h Sat Jul 20 14:58:13 2013 +0100 | |
10 | @@ -819,6 +819,7 @@ | |
88a737db | 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); | |
6fe1b135 P |
18 | diff -r bba899468eaf ircd/channel.c |
19 | --- a/ircd/channel.c Sat Jul 20 14:58:09 2013 +0100 | |
20 | +++ b/ircd/channel.c Sat Jul 20 14:58:13 2013 +0100 | |
5b47396d | 21 | @@ -1917,8 +1917,8 @@ |
88a737db | 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, | |
6fe1b135 P |
32 | diff -r bba899468eaf ircd/gline.c |
33 | --- a/ircd/gline.c Sat Jul 20 14:58:09 2013 +0100 | |
34 | +++ b/ircd/gline.c Sat Jul 20 14:58:13 2013 +0100 | |
35 | @@ -576,7 +576,7 @@ | |
c7910156 | 36 | SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at " |
37 | "%Tu: %s", | |
88a737db | 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), | |
82957caf | 42 | (flags & GLINE_ACTIVE) ? "" : "deactivated ", |
88a737db | 43 | (flags & GLINE_LOCAL) ? "local" : "global", |
6fe1b135 | 44 | @@ -651,7 +651,7 @@ |
c7910156 | 45 | sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, " |
88a737db | 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, | |
6fe1b135 | 53 | @@ -724,7 +724,7 @@ |
c7910156 | 54 | sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: " |
55 | "%s", | |
88a737db | 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, | |
6fe1b135 P |
62 | @@ -931,7 +931,7 @@ |
63 | sendto_opmask_butone(0, non_auto ? SNO_GLINE : SNO_AUTO, | |
64 | "%s modifying global %s for %s%s%s%s%s:%s", | |
88a737db | 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) ? "" : "!", | |
6fe1b135 | 71 | @@ -978,7 +978,7 @@ |
c7910156 | 72 | /* Inform ops and log it */ |
73 | sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s", | |
88a737db | 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) ? "" : "!", | |
6fe1b135 P |
80 | diff -r bba899468eaf ircd/jupe.c |
81 | --- a/ircd/jupe.c Sat Jul 20 14:58:09 2013 +0100 | |
82 | +++ b/ircd/jupe.c Sat Jul 20 14:58:13 2013 +0100 | |
12e82c05 | 83 | @@ -156,7 +156,7 @@ |
88a737db | 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); | |
c7910156 | 92 | @@ -211,7 +211,7 @@ |
88a737db | 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); | |
c7910156 | 101 | @@ -264,7 +264,7 @@ |
88a737db | 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, | |
6fe1b135 P |
110 | diff -r bba899468eaf ircd/m_connect.c |
111 | --- a/ircd/m_connect.c Sat Jul 20 14:58:09 2013 +0100 | |
112 | +++ b/ircd/m_connect.c Sat Jul 20 14:58:13 2013 +0100 | |
12e82c05 | 113 | @@ -197,7 +197,7 @@ |
88a737db | 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)); | |
88a737db | 118 | + get_client_name_and_opername(sptr)); |
12e82c05 | 119 | log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name, |
88a737db | 120 | parv[2] ? parv[2] : ""); |
121 | ||
6fe1b135 P |
122 | diff -r bba899468eaf ircd/m_join.c |
123 | --- a/ircd/m_join.c Sat Jul 20 14:58:09 2013 +0100 | |
124 | +++ b/ircd/m_join.c Sat Jul 20 14:58:13 2013 +0100 | |
88a737db | 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 | ||
6fe1b135 P |
136 | diff -r bba899468eaf ircd/m_jupe.c |
137 | --- a/ircd/m_jupe.c Sat Jul 20 14:58:09 2013 +0100 | |
138 | +++ b/ircd/m_jupe.c Sat Jul 20 14:58:13 2013 +0100 | |
18be00cb | 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; | |
8a8d0320 | 144 | + char *server = parv[1], *target = 0, reason[BUFSIZE]; |
18be00cb | 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 | ||
6fe1b135 P |
163 | diff -r bba899468eaf ircd/m_kill.c |
164 | --- a/ircd/m_kill.c Sat Jul 20 14:58:09 2013 +0100 | |
165 | +++ b/ircd/m_kill.c Sat Jul 20 14:58:13 2013 +0100 | |
88a737db | 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 | ||
6fe1b135 P |
175 | diff -r bba899468eaf ircd/m_oper.c |
176 | --- a/ircd/m_oper.c Sat Jul 20 14:58:09 2013 +0100 | |
177 | +++ b/ircd/m_oper.c Sat Jul 20 14:58:13 2013 +0100 | |
c7910156 | 178 | @@ -192,9 +192,9 @@ |
a1c569ef | 179 | send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE), 0); |
c7910156 | 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 | } | |
6fe1b135 P |
191 | diff -r bba899468eaf ircd/m_rehash.c |
192 | --- a/ircd/m_rehash.c Sat Jul 20 14:58:09 2013 +0100 | |
193 | +++ b/ircd/m_rehash.c Sat Jul 20 14:58:13 2013 +0100 | |
12e82c05 | 194 | @@ -121,8 +121,8 @@ |
88a737db | 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 | ||
12e82c05 | 203 | log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); |
88a737db | 204 | |
6fe1b135 P |
205 | diff -r bba899468eaf ircd/m_sethost.c |
206 | --- a/ircd/m_sethost.c Sat Jul 20 14:58:09 2013 +0100 | |
207 | +++ b/ircd/m_sethost.c Sat Jul 20 14:58:13 2013 +0100 | |
208 | @@ -196,7 +196,7 @@ | |
398751c7 | 209 | if (freeform) { |
210 | ||
211 | sendto_opmask_butone(0, SNO_OLDSNO, | |
5b47396d | 212 | - "%C SETHOST %s%s%s (freeform)", sptr, |
213 | + "%s SETHOST %s%s%s (freeform)", get_client_name_and_opername(sptr), | |
214 | user ? user : "", user ? "@" : "", host); | |
398751c7 | 215 | |
216 | log_write(LS_SETHOST, L_NOTICE, LOG_NOSNOTICE, | |
6fe1b135 P |
217 | diff -r bba899468eaf ircd/m_settime.c |
218 | --- a/ircd/m_settime.c Sat Jul 20 14:58:09 2013 +0100 | |
219 | +++ b/ircd/m_settime.c Sat Jul 20 14:58:13 2013 +0100 | |
88a737db | 220 | @@ -177,7 +177,7 @@ |
221 | else /* tell opers about time change */ | |
222 | { | |
223 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
224 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
225 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
226 | (dt < 0) ? "forwards" : "backwards"); | |
227 | /* Apply time change... */ | |
228 | TSoffset -= dt; | |
229 | @@ -252,7 +252,7 @@ | |
230 | else /* tell opers about time change */ | |
231 | { | |
232 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
233 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
234 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
235 | (dt < 0) ? "forwards" : "backwards"); | |
236 | TSoffset -= dt; /* apply time change */ | |
237 | if (IsUser(sptr)) /* let user know what we did */ | |
6fe1b135 P |
238 | diff -r bba899468eaf ircd/s_misc.c |
239 | --- a/ircd/s_misc.c Sat Jul 20 14:58:09 2013 +0100 | |
240 | +++ b/ircd/s_misc.c Sat Jul 20 14:58:13 2013 +0100 | |
82957caf | 241 | @@ -172,6 +172,20 @@ |
242 | return nbuf; | |
243 | } | |
244 | ||
88a737db | 245 | +/** Return the name of the client and the opername for accountability purposes |
246 | + * in snomask and other places. | |
247 | + * @param sptr Client to operate on. | |
248 | + * @return Either cli_name(\a sptr) or a static buffer. | |
249 | + */ | |
250 | +const char* get_client_name_and_opername(const struct Client* sptr) { | |
251 | + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2]; | |
252 | + | |
253 | + if (!IsUser(sptr) || !cli_user(sptr)->opername) | |
254 | + return cli_name(sptr); | |
255 | + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername); | |
82957caf | 256 | + return nbuf; |
257 | +} | |
258 | + | |
259 | /** | |
260 | * Exit one client, local or remote. Assuming for local client that | |
261 | * all dependents already have been removed, and socket is closed. | |
88a737db | 262 | @@ -474,7 +488,7 @@ |
263 | (cli_user(killer)->server == victim || | |
264 | cli_user(killer)->server == cli_serv(victim)->up) ? | |
265 | "Local" : "Remote", | |
266 | - get_client_name(killer, HIDE_IP), | |
267 | + get_client_name_and_opername(killer), | |
268 | cli_name(cli_user(killer)->server)); | |
269 | else if (killer != &me && cli_serv(victim)->up != killer) | |
270 | sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :", | |
6fe1b135 P |
271 | diff -r bba899468eaf ircd/s_user.c |
272 | --- a/ircd/s_user.c Sat Jul 20 14:58:09 2013 +0100 | |
273 | +++ b/ircd/s_user.c Sat Jul 20 14:58:13 2013 +0100 | |
274 | @@ -1491,9 +1491,9 @@ | |
c7910156 | 275 | |
432f093d | 276 | /* notify my operators a user has OPERed on a remote server */ |
c7910156 | 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 | } | |
6fe1b135 | 287 | @@ -1506,9 +1506,8 @@ |
432f093d | 288 | if (FlagHas(&setflags, FLAG_LOCOP) && !IsLocOp(sptr)) { |
289 | ||
290 | /* notify my operators a local operator has deOPERed */ | |
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_sockhost(sptr), | |
293 | - cli_user(sptr)->opername); | |
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_sockhost(sptr)); | |
296 | } | |
297 | ||
298 | if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) { | |
6fe1b135 | 299 | @@ -1518,13 +1517,12 @@ |
c7910156 | 300 | |
432f093d | 301 | /* notify my operators an operator has deOPERed on the network */ |
c7910156 | 302 | if (MyConnect(sptr)) { |
303 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", | |
432f093d | 304 | - cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), |
305 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>"); | |
c7910156 | 306 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O)", |
432f093d | 307 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr)); |
c7910156 | 308 | } else { |
309 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", | |
432f093d | 310 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, |
311 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
c7910156 | 312 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) on %s", |
432f093d | 313 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, |
314 | + cli_name(cli_user(sptr)->server)); | |
c7910156 | 315 | } |
316 | ||
317 | client_set_privs(sptr, NULL); /* will clear propagate privilege */ |