]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame - glinereasons
nickgline: include nick! bit in gline loggin
[irc/quakenet/snircd-patchqueue.git] / glinereasons
CommitLineData
edb26b39 1# HG changeset patch
d9614f85 2# Parent 6b7e62a448071eeb7ffaf9edb7ade22308c5fb8c
edb26b39 3
d9614f85
P
4diff -r 6b7e62a44807 include/s_conf.h
5--- a/include/s_conf.h Sat Jul 20 11:28:33 2013 +0100
6+++ b/include/s_conf.h Sat Jul 20 11:28:41 2013 +0100
edb26b39
P
7@@ -196,7 +196,7 @@
8 extern enum AuthorizationCheckResult conf_check_client(struct Client *cptr);
9 extern int conf_check_server(struct Client *cptr);
10 extern int rehash(struct Client *cptr, int sig);
11-extern int find_kill(struct Client *cptr, int glinecheck);
12+extern int find_kill(struct Client *cptr, int glinecheck, char **reason);
13 extern const char *find_quarantine(const char* chname);
14 extern void lookup_confhost(struct ConfItem *aconf);
15 extern void conf_parse_userhost(struct ConfItem *aconf, char *host);
d9614f85
P
16diff -r 6b7e62a44807 ircd/channel.c
17--- a/ircd/channel.c Sat Jul 20 11:28:33 2013 +0100
18+++ b/ircd/channel.c Sat Jul 20 11:28:41 2013 +0100
19@@ -2933,7 +2933,16 @@
edb26b39
P
20 newban->flags = ((state->dir == MODE_ADD) ? BAN_ADD : BAN_DEL)
21 | (*flag_p == MODE_BAN ? 0 : BAN_EXCEPTION);
22 set_ban_mask(newban, collapse(pretty_mask(t_str)));
23- ircd_strncpy(newban->who, IsUser(state->sptr) ? cli_name(state->sptr) : "*", NICKLEN);
24+
25+ /* source not a user OR feat HIS_MODEWHO enabled and ban set with /OPMODE
26+ so hide the source in banlist - wiebe */
27+ if (!IsUser(state->sptr) ||
28+ (feature_bool(FEAT_HIS_MODEWHO) && state->mbuf != NULL && (state->mbuf->mb_dest & MODEBUF_DEST_OPMODE))) {
29+ ircd_strncpy(newban->who, "*", NICKLEN);
30+ } else {
31+ ircd_strncpy(newban->who, cli_name(state->sptr), NICKLEN);
32+ }
33+
34 newban->when = TStime();
35 apply_ban(&state->chptr->banlist, newban, 0);
36 }
d9614f85
P
37diff -r 6b7e62a44807 ircd/gline.c
38--- a/ircd/gline.c Sat Jul 20 11:28:33 2013 +0100
39+++ b/ircd/gline.c Sat Jul 20 11:28:41 2013 +0100
edb26b39
P
40@@ -282,6 +282,9 @@
41 get_client_name(acptr, SHOW_IP));
42
43 /* and get rid of him */
44+ /* WARNING: code in exit_client() relies on the quit message starting with
45+ * G-lined or K-lined for HIS purposes
46+ */
47 if ((tval = exit_client_msg(cptr, acptr, &me, "G-lined (%s)", gline->gl_reason)))
48 retval = tval; /* retain killed status */
49 }
d9614f85
P
50diff -r 6b7e62a44807 ircd/s_auth.c
51--- a/ircd/s_auth.c Sat Jul 20 11:28:33 2013 +0100
52+++ b/ircd/s_auth.c Sat Jul 20 11:28:41 2013 +0100
edb26b39
P
53@@ -233,6 +233,7 @@
54 short digitgroups = 0;
55 char ch;
56 char last;
57+ char *reason;
58
59 if (FlagHas(&auth->flags, AR_IAUTH_USERNAME))
60 {
d9614f85
P
61@@ -270,11 +271,14 @@
62 ircd_strncpy(user->realusername, user->username, USERLEN);
edb26b39
P
63
64 /* Check for K- or G-line. */
65- killreason = find_kill(sptr, 1);
66+ killreason = find_kill(sptr, 1, &reason);
67 if (killreason) {
68 ServerStats->is_ref++;
69- return exit_client(sptr, sptr, &me,
70- (killreason == -1 ? "K-lined" : "G-lined"));
71+ /* WARNING: code in exit_client() relies on the quit message starting with
72+ * G-lined or K-lined for HIS purposes
73+ */
74+ return exit_client_msg(sptr, sptr, &me, "%s (%s)",
75+ (killreason == -1 ? "K-lined" : "G-lined"), reason);
76 }
77
78 if (!FlagHas(&auth->flags, AR_IAUTH_FUSERNAME))
d9614f85
P
79diff -r 6b7e62a44807 ircd/s_conf.c
80--- a/ircd/s_conf.c Sat Jul 20 11:28:33 2013 +0100
81+++ b/ircd/s_conf.c Sat Jul 20 11:28:41 2013 +0100
edb26b39
P
82@@ -909,6 +909,7 @@
83 int i;
84 int ret = 0;
85 int found_g = 0;
86+ char *reason;
87
88 if (1 == sig)
89 sendto_opmask_butone(0, SNO_OLDSNO,
90@@ -986,14 +987,17 @@
91 * get past K/G's etc, we'll "fix" the bug by actually explaining
92 * whats going on.
93 */
94- if ((found_g = find_kill(acptr, 0))) {
95+ if ((found_g = find_kill(acptr, 0, &reason))) {
96 sendto_opmask_butone(0, found_g == -2 ? SNO_GLINE : SNO_OPERKILL,
97 found_g == -2 ? "G-line active for %s%s" :
98 "K-line active for %s%s",
99 IsUnknown(acptr) ? "Unregistered Client ":"",
100 get_client_name(acptr, SHOW_IP));
101- if (exit_client(cptr, acptr, &me, found_g == -2 ? "G-lined" :
102- "K-lined") == CPTR_KILLED)
103+ /* WARNING: code in exit_client() relies on the quit message starting with
104+ * G-lined or K-lined for HIS purposes
105+ */
106+ if (exit_client_msg(cptr, acptr, &me, "%s (%s)", found_g == -2 ? "G-lined" :
107+ "K-lined", reason) == CPTR_KILLED)
108 ret = CPTR_KILLED;
109 }
110 }
111@@ -1038,10 +1042,11 @@
112 * user and disconnect them.
113 * @param cptr Client to search for.
114 * @param glinecheck Whether we check for glines.
115+ * @param reason Where the reason is stored
116 * @return 0 if client is accepted; -1 if client was locally denied
117 * (K-line); -2 if client was globally denied (G-line).
118 */
119-int find_kill(struct Client *cptr, int glinecheck)
120+int find_kill(struct Client *cptr, int glinecheck, char **reason)
121 {
122 const char* host;
123 const char* name;
124@@ -1076,14 +1081,18 @@
125 } else if (deny->hostmask && match(deny->hostmask, host))
126 continue;
127
128- if (EmptyString(deny->message))
129+ if (EmptyString(deny->message)) {
130 send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP,
131 ":Connection from your host is refused on this server.");
132- else {
133- if (deny->flags & DENY_FLAGS_FILE)
134+ *reason = "Connection from your host is refused on this server.";
135+ } else {
136+ if (deny->flags & DENY_FLAGS_FILE) {
137 killcomment(cptr, deny->message);
138- else
139- send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", deny->message);
140+ *reason = "Connection from your host is refused on this server.";
141+ } else {
142+ send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s", deny->message);
143+ *reason = deny->message;
144+ }
145 }
146 return -1;
147 }
148@@ -1099,7 +1108,8 @@
149 * find active glines
150 * added a check against the user's IP address to find_gline() -Kev
151 */
152- send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", GlineReason(agline));
153+ send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s", GlineReason(agline));
154+ *reason = GlineReason(agline);
155 return -2;
156 }
157
d9614f85
P
158diff -r 6b7e62a44807 ircd/s_misc.c
159--- a/ircd/s_misc.c Sat Jul 20 11:28:33 2013 +0100
160+++ b/ircd/s_misc.c Sat Jul 20 11:28:41 2013 +0100
edb26b39
P
161@@ -495,18 +495,20 @@
162 if (IsServer(victim))
163 sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
164 cli_name(victim), cli_serv(victim)->timestamp, comment);
165- else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED))
166- sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
167+ else if (IsUser(victim) && !HasFlag(victim, FLAG_KILLED)) {
168+ /* do not show G-line or K-line reasons to other users, so remove them - wiebe */
169+ if (!strncmp(comment, "G-lined", 7))
170+ comment = "G-lined";
171+ else if (!strncmp(comment, "K-lined", 7))
172+ comment = "K-lined";
173+ sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
174+ }
175 }
176 }
177 /* Then remove the client structures */
178 if (IsServer(victim))
179 exit_downlinks(victim, killer, comment1);
180-
181- if (strncmp(comment, "G-lined", 7))
182- exit_one_client(victim, comment);
183- else
184- exit_one_client(victim, "G-lined");
185+ exit_one_client(victim, comment);
186
187 /*
188 * cptr can only have been killed if it was cptr itself that got killed here,