]>
Commit | Line | Data |
---|---|---|
88a737db | 1 | Add opername to snomask, remote connect wallops, and logging |
2 | ||
12e82c05 | 3 | diff -r dffb1fdabb12 include/client.h |
4 | --- a/include/client.h Wed Jan 14 14:19:42 2009 +0100 | |
5 | +++ b/include/client.h Wed Jan 14 15:27:42 2009 +0100 | |
88a737db | 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); | |
12e82c05 | 14 | diff -r dffb1fdabb12 ircd/channel.c |
15 | --- a/ircd/channel.c Wed Jan 14 14:19:42 2009 +0100 | |
16 | +++ b/ircd/channel.c Wed Jan 14 15:27:43 2009 +0100 | |
17 | @@ -1848,8 +1848,8 @@ | |
88a737db | 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, | |
12e82c05 | 28 | diff -r dffb1fdabb12 ircd/gline.c |
29 | --- a/ircd/gline.c Wed Jan 14 14:19:42 2009 +0100 | |
30 | +++ b/ircd/gline.c Wed Jan 14 15:27:43 2009 +0100 | |
31 | @@ -577,7 +577,7 @@ | |
88a737db | 32 | sendto_opmask_butone(0, snomask, "%s adding %s %s for %s%s%s%s%s, expiring at " |
33 | "%Tu: %s", | |
34 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
35 | - cli_name(sptr) : | |
36 | + get_client_name_and_opername(sptr) : | |
37 | cli_name((cli_user(sptr))->server), | |
38 | (flags & GLINE_LOCAL) ? "local" : "global", | |
39 | (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE", | |
12e82c05 | 40 | @@ -663,7 +663,7 @@ |
88a737db | 41 | sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, " |
42 | "expiring at %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 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
48 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
12e82c05 | 49 | @@ -736,7 +736,7 @@ |
88a737db | 50 | sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: " |
51 | "%s", | |
52 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
53 | - cli_name(sptr) : | |
54 | + get_client_name_and_opername(sptr) : | |
55 | cli_name((cli_user(sptr))->server), | |
56 | msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
57 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
12e82c05 | 58 | @@ -987,7 +987,7 @@ |
88a737db | 59 | /* All right, inform ops... */ |
60 | sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s", | |
61 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
62 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
63 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
64 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
65 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
66 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
12e82c05 | 67 | @@ -1044,7 +1044,7 @@ |
88a737db | 68 | /* Inform ops and log it */ |
69 | sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s", | |
70 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
71 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
72 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
73 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
74 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
75 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
12e82c05 | 76 | diff -r dffb1fdabb12 ircd/jupe.c |
77 | --- a/ircd/jupe.c Wed Jan 14 14:19:42 2009 +0100 | |
78 | +++ b/ircd/jupe.c Wed Jan 14 15:27:43 2009 +0100 | |
79 | @@ -156,7 +156,7 @@ | |
88a737db | 80 | sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at " |
81 | "%Tu: %s", | |
82 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
83 | - cli_name(sptr) : | |
84 | + get_client_name_and_opername(sptr) : | |
85 | cli_name((cli_user(sptr))->server), | |
86 | flags & JUPE_LOCAL ? "local " : "", server, | |
87 | expire + TSoffset, reason); | |
12e82c05 | 88 | @@ -216,7 +216,7 @@ |
88a737db | 89 | sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring " |
90 | "at %Tu: %s", | |
91 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
92 | - cli_name(sptr) : | |
93 | + get_client_name_and_opername(sptr) : | |
94 | cli_name((cli_user(sptr))->server), | |
95 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
96 | jupe->ju_reason); | |
12e82c05 | 97 | @@ -269,7 +269,7 @@ |
88a737db | 98 | sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: " |
99 | "%s", | |
100 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
101 | - cli_name(sptr) : | |
102 | + get_client_name_and_opername(sptr) : | |
103 | cli_name((cli_user(sptr))->server), | |
104 | JupeIsLocal(jupe) ? "removing local" : "deactivating", | |
105 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
12e82c05 | 106 | diff -r dffb1fdabb12 ircd/m_connect.c |
107 | --- a/ircd/m_connect.c Wed Jan 14 14:19:42 2009 +0100 | |
108 | +++ b/ircd/m_connect.c Wed Jan 14 15:27:43 2009 +0100 | |
109 | @@ -197,7 +197,7 @@ | |
88a737db | 110 | sendwallto_group_butone(&me, WALL_WALLOPS, 0, |
111 | "Remote CONNECT %s %s from %s", aconf->name, | |
112 | parv[2] ? parv[2] : "", | |
113 | - get_client_name(sptr, HIDE_IP)); | |
88a737db | 114 | + get_client_name_and_opername(sptr)); |
12e82c05 | 115 | log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name, |
88a737db | 116 | parv[2] ? parv[2] : ""); |
117 | ||
12e82c05 | 118 | diff -r dffb1fdabb12 ircd/m_join.c |
119 | --- a/ircd/m_join.c Wed Jan 14 14:19:42 2009 +0100 | |
120 | +++ b/ircd/m_join.c Wed Jan 14 15:27:43 2009 +0100 | |
88a737db | 121 | @@ -242,8 +242,8 @@ |
122 | } | |
123 | /* send accountability notice */ | |
124 | if (err) | |
125 | - sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %C JOIN %H " | |
126 | - "(overriding +%c)", sptr, chptr, err); | |
127 | + sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %s JOIN %H " | |
128 | + "(overriding +%c)", get_client_name_and_opername(sptr), chptr, err); | |
129 | err = 0; | |
130 | } | |
131 | ||
12e82c05 | 132 | diff -r dffb1fdabb12 ircd/m_kill.c |
133 | --- a/ircd/m_kill.c Wed Jan 14 14:19:42 2009 +0100 | |
134 | +++ b/ircd/m_kill.c Wed Jan 14 15:27:43 2009 +0100 | |
88a737db | 135 | @@ -127,7 +127,7 @@ |
136 | */ | |
137 | sendto_opmask_butone(0, snomask, | |
138 | "Received KILL message for %s from %s Path: %s!%s %s", | |
139 | - get_client_name(victim, SHOW_IP), cli_name(sptr), | |
140 | + get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr), | |
141 | inpath, path, msg); | |
142 | log_write_kill(victim, sptr, inpath, path, msg); | |
143 | ||
12e82c05 | 144 | diff -r dffb1fdabb12 ircd/m_rehash.c |
145 | --- a/ircd/m_rehash.c Wed Jan 14 14:19:42 2009 +0100 | |
146 | +++ b/ircd/m_rehash.c Wed Jan 14 15:27:43 2009 +0100 | |
147 | @@ -121,8 +121,8 @@ | |
88a737db | 148 | } |
149 | ||
150 | send_reply(sptr, RPL_REHASHING, configfile); | |
151 | - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file", | |
152 | - sptr); | |
153 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file", | |
154 | + get_client_name_and_opername(sptr)); | |
155 | ||
12e82c05 | 156 | log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); |
88a737db | 157 | |
12e82c05 | 158 | diff -r dffb1fdabb12 ircd/m_settime.c |
159 | --- a/ircd/m_settime.c Wed Jan 14 14:19:42 2009 +0100 | |
160 | +++ b/ircd/m_settime.c Wed Jan 14 15:27:43 2009 +0100 | |
88a737db | 161 | @@ -177,7 +177,7 @@ |
162 | else /* tell opers about time change */ | |
163 | { | |
164 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
165 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
166 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
167 | (dt < 0) ? "forwards" : "backwards"); | |
168 | /* Apply time change... */ | |
169 | TSoffset -= dt; | |
170 | @@ -252,7 +252,7 @@ | |
171 | else /* tell opers about time change */ | |
172 | { | |
173 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
174 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
175 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
176 | (dt < 0) ? "forwards" : "backwards"); | |
177 | TSoffset -= dt; /* apply time change */ | |
178 | if (IsUser(sptr)) /* let user know what we did */ | |
12e82c05 | 179 | diff -r dffb1fdabb12 ircd/s_misc.c |
180 | --- a/ircd/s_misc.c Wed Jan 14 14:19:42 2009 +0100 | |
181 | +++ b/ircd/s_misc.c Wed Jan 14 15:27:43 2009 +0100 | |
88a737db | 182 | @@ -169,6 +169,20 @@ |
183 | ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr), | |
184 | IsIdented(sptr) ? cli_username(sptr) : "", | |
185 | cli_sock_ip(sptr)); | |
186 | + return nbuf; | |
187 | +} | |
188 | + | |
189 | +/** Return the name of the client and the opername for accountability purposes | |
190 | + * in snomask and other places. | |
191 | + * @param sptr Client to operate on. | |
192 | + * @return Either cli_name(\a sptr) or a static buffer. | |
193 | + */ | |
194 | +const char* get_client_name_and_opername(const struct Client* sptr) { | |
195 | + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2]; | |
196 | + | |
197 | + if (!IsUser(sptr) || !cli_user(sptr)->opername) | |
198 | + return cli_name(sptr); | |
199 | + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername); | |
200 | return nbuf; | |
201 | } | |
202 | ||
203 | @@ -474,7 +488,7 @@ | |
204 | (cli_user(killer)->server == victim || | |
205 | cli_user(killer)->server == cli_serv(victim)->up) ? | |
206 | "Local" : "Remote", | |
207 | - get_client_name(killer, HIDE_IP), | |
208 | + get_client_name_and_opername(killer), | |
209 | cli_name(cli_user(killer)->server)); | |
210 | else if (killer != &me && cli_serv(victim)->up != killer) | |
211 | sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :", |