1 Add opername to snomask, remote connect wallops, and logging
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
7 #define IPV6USERBITS 64
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);
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
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 "
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,
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
32 sendto_opmask_butone(0, snomask, "%s adding %s %s for %s%s%s%s%s, expiring at "
34 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(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",
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)) ?
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,
50 sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
52 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(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,
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) ? "" : "!",
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) ? "" : "!",
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
80 sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
82 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(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);
89 sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
91 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
93 + get_client_name_and_opername(sptr) :
94 cli_name((cli_user(sptr))->server),
95 jupe->ju_server, jupe->ju_expire + TSoffset,
98 sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
100 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(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,
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
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));
114 + get_client_name_and_opername(sptr));
115 log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name,
116 parv[2] ? parv[2] : "");
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
123 /* send accountability notice */
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);
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
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),
142 log_write_kill(victim, sptr, inpath, path, msg);
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
150 send_reply(sptr, RPL_REHASHING, configfile);
151 - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file",
153 + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file",
154 + get_client_name_and_opername(sptr));
156 log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr);
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
162 else /* tell opers about time change */
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... */
171 else /* tell opers about time change */
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 */
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
183 ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr),
184 IsIdented(sptr) ? cli_username(sptr) : "",
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.
194 +const char* get_client_name_and_opername(const struct Client* sptr) {
195 + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2];
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);
204 (cli_user(killer)->server == victim ||
205 cli_user(killer)->server == cli_serv(victim)->up) ?
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 :",