]>
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 | |
a1c569ef | 7 | diff -r 4b82a90ed8b3 include/client.h |
432f093d | 8 | --- a/include/client.h |
9 | +++ b/include/client.h | |
10 | @@ -809,6 +809,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); | |
a1c569ef | 18 | diff -r 4b82a90ed8b3 ircd/channel.c |
432f093d | 19 | --- a/ircd/channel.c |
20 | +++ b/ircd/channel.c | |
21 | @@ -1910,8 +1910,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, | |
a1c569ef | 32 | diff -r 4b82a90ed8b3 ircd/gline.c |
432f093d | 33 | --- a/ircd/gline.c |
34 | +++ b/ircd/gline.c | |
18be00cb | 35 | @@ -567,7 +567,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", |
18be00cb | 44 | @@ -642,7 +642,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, | |
18be00cb | 53 | @@ -715,7 +715,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, | |
18be00cb | 62 | @@ -919,7 +919,7 @@ |
c7910156 | 63 | /* All right, inform ops... */ |
64 | sendto_opmask_butone(0, SNO_GLINE, "%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) ? "" : "!", | |
18be00cb | 71 | @@ -966,7 +966,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) ? "" : "!", | |
a1c569ef | 80 | diff -r 4b82a90ed8b3 ircd/jupe.c |
432f093d | 81 | --- a/ircd/jupe.c |
82 | +++ b/ircd/jupe.c | |
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, | |
a1c569ef | 110 | diff -r 4b82a90ed8b3 ircd/m_connect.c |
432f093d | 111 | --- a/ircd/m_connect.c |
112 | +++ b/ircd/m_connect.c | |
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 | ||
a1c569ef | 122 | diff -r 4b82a90ed8b3 ircd/m_join.c |
432f093d | 123 | --- a/ircd/m_join.c |
124 | +++ b/ircd/m_join.c | |
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 | ||
a1c569ef | 136 | diff -r 4b82a90ed8b3 ircd/m_jupe.c |
432f093d | 137 | --- a/ircd/m_jupe.c |
138 | +++ b/ircd/m_jupe.c | |
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 | ||
a1c569ef | 163 | diff -r 4b82a90ed8b3 ircd/m_kill.c |
432f093d | 164 | --- a/ircd/m_kill.c |
165 | +++ b/ircd/m_kill.c | |
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 | ||
a1c569ef | 175 | diff -r 4b82a90ed8b3 ircd/m_oper.c |
432f093d | 176 | --- a/ircd/m_oper.c |
177 | +++ b/ircd/m_oper.c | |
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 | } | |
a1c569ef | 191 | diff -r 4b82a90ed8b3 ircd/m_rehash.c |
432f093d | 192 | --- a/ircd/m_rehash.c |
193 | +++ b/ircd/m_rehash.c | |
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 | |
a1c569ef | 205 | diff -r 4b82a90ed8b3 ircd/m_settime.c |
432f093d | 206 | --- a/ircd/m_settime.c |
207 | +++ b/ircd/m_settime.c | |
88a737db | 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 */ | |
a1c569ef | 226 | diff -r 4b82a90ed8b3 ircd/s_misc.c |
432f093d | 227 | --- a/ircd/s_misc.c |
228 | +++ b/ircd/s_misc.c | |
82957caf | 229 | @@ -172,6 +172,20 @@ |
230 | return nbuf; | |
231 | } | |
232 | ||
88a737db | 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); | |
82957caf | 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. | |
88a737db | 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 :", | |
a1c569ef | 259 | diff -r 4b82a90ed8b3 ircd/s_user.c |
432f093d | 260 | --- a/ircd/s_user.c |
261 | +++ b/ircd/s_user.c | |
a1c569ef | 262 | @@ -1471,9 +1471,9 @@ |
c7910156 | 263 | |
432f093d | 264 | /* notify my operators a user has OPERed on a remote server */ |
c7910156 | 265 | if (!MyConnect(sptr)) { |
266 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) as %s on %s", | |
267 | - cli_name(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
268 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>", cli_name(cli_user(sptr)->server)); | |
269 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (O) on %s", | |
270 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, | |
271 | + cli_name(cli_user(sptr)->server)); | |
272 | } | |
273 | ||
274 | } | |
a1c569ef | 275 | @@ -1486,9 +1486,8 @@ |
432f093d | 276 | if (FlagHas(&setflags, FLAG_LOCOP) && !IsLocOp(sptr)) { |
277 | ||
278 | /* notify my operators a local operator has deOPERed */ | |
279 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o) as %s", | |
280 | - cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), | |
281 | - cli_user(sptr)->opername); | |
282 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (o)", | |
283 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr)); | |
284 | } | |
285 | ||
286 | if (FlagHas(&setflags, FLAG_OPER) && !IsOper(sptr)) { | |
a1c569ef | 287 | @@ -1498,13 +1497,12 @@ |
c7910156 | 288 | |
432f093d | 289 | /* notify my operators an operator has deOPERed on the network */ |
c7910156 | 290 | if (MyConnect(sptr)) { |
291 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s", | |
432f093d | 292 | - cli_name(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr), |
293 | - cli_user(sptr)->opername ? cli_user(sptr)->opername : "<unknown>"); | |
c7910156 | 294 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O)", |
432f093d | 295 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_sockhost(sptr)); |
c7910156 | 296 | } else { |
297 | - sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) as %s on %s", | |
432f093d | 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)); | |
c7910156 | 300 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is no longer operator (O) on %s", |
432f093d | 301 | + get_client_name_and_opername(sptr), cli_user(sptr)->realusername, cli_user(sptr)->realhost, |
302 | + cli_name(cli_user(sptr)->server)); | |
c7910156 | 303 | } |
304 | ||
305 | client_set_privs(sptr, NULL); /* will clear propagate privilege */ |