3 Add = mask prefix to glines to be used by services
4 so their gline actions end up in SNO_AUTO,
5 freeing SNO_GLINE from spam
7 Services can do add this prefix before the mask for
8 automated hits, but not add them for glines manually
9 set by an oper on the service.
11 <source> GL <target> [=][!][+-<>]<mask> ..
13 Oper is not allowed to use = prefix in /GLINE,
14 as that would be cheating :-)
17 This prefix must not be used until the entire network
18 and services are upgraded to handle it!
20 diff -r 8dcf56ed67b9 include/gline.h
21 --- a/include/gline.h Sun Feb 15 15:31:50 2009 +0100
22 +++ b/include/gline.h Sun Feb 15 15:59:10 2009 +0100
24 #define GLINE_LIFETIME 0x2000 /**< Record lifetime update */
25 #define GLINE_REASON 0x4000 /**< Reason update */
27 +#define GLINE_AUTO 0x8000 /**< G-line set auto by service */
29 /** Controllable flags that can be set on an actual G-line. */
30 -#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME)
31 +#define GLINE_MASK (GLINE_ACTIVE | GLINE_BADCHAN | GLINE_LOCAL | GLINE_REALNAME | GLINE_AUTO)
32 /** Mask for G-line activity flags. */
33 #define GLINE_ACTMASK (GLINE_ACTIVE | GLINE_LDEACT)
36 #define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN)
37 /** Test whether \a g is local to this server. */
38 #define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
39 +/** Test whether \a g is auto set by service */
40 +#define GlineIsAuto(g) ((g)->gl_flags & GLINE_AUTO)
42 /** Return nick mask of a G-line. */
43 #define GlineNick(g) ((g)->gl_nick)
44 diff -r 8dcf56ed67b9 ircd/gline.c
45 --- a/ircd/gline.c Sun Feb 15 15:31:50 2009 +0100
46 +++ b/ircd/gline.c Sun Feb 15 15:59:10 2009 +0100
50 /* let the ops know about it */
51 - sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
52 + sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE, "G-line active for %s",
53 get_client_name(acptr, SHOW_IP));
55 /* and get rid of him */
59 assert(gline->gl_lastmod);
60 - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
61 + sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
62 + GlineIsAuto(gline) ? "=" : "",
63 GlineIsRemActive(gline) ? '+' : '-',
64 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
65 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
67 /* lifetime is already an absolute timestamp */
70 - sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
71 - SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at "
73 + sendto_opmask_butone(0, (flags & GLINE_AUTO) ? SNO_AUTO : SNO_GLINE,
74 + "%s adding %s%s %s for %s%s%s%s%s, expiring at %Tu: %s",
75 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
77 cli_name((cli_user(sptr))->server),
79 return 0; /* was active to begin with */
81 /* Inform ops and log it */
82 - sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
83 + sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
84 + "%s activating global %s for %s%s%s%s%s, "
85 "expiring at %Tu: %s",
86 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
91 /* Inform ops and log it */
92 - sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
94 + sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
95 + "%s %s %s for %s%s%s%s%s, expiring at %Tu: %s",
96 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
98 cli_name((cli_user(sptr))->server),
103 + /* Handle the change of auto or manual G-line */
104 + if ((flags & GLINE_AUTO) && !GlineIsAuto(gline))
105 + gline->gl_flags |= GLINE_AUTO; /* mark as auto */
106 + else if (!(flags & GLINE_AUTO) && GlineIsAuto(gline))
107 + gline->gl_flags &= ~GLINE_AUTO; /* mark as manual */
109 /* Handle expiration changes... */
110 if (flags & GLINE_EXPIRE) {
111 gline->gl_expire = expire; /* save new expiration time */
115 /* All right, inform ops... */
116 - sendto_opmask_butone(0, SNO_GLINE, "%s modifying global %s for %s%s%s%s%s:%s",
117 + sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
118 + "%s modifying global %s for %s%s%s%s%s:%s",
119 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
120 cli_name(sptr) : cli_name((cli_user(sptr))->server),
121 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
124 if (action != GLINE_LOCAL_ACTIVATE && action != GLINE_LOCAL_DEACTIVATE)
125 sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
126 - "* %s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
127 + "* %s%s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
128 + GlineIsAuto(gline) ? "=" : "",
129 flags & GLINE_OPERFORCE ? "!" : "", op,
130 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
131 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
133 assert(GlineIsLocal(gline));
135 /* Inform ops and log it */
136 - sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
137 + sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
138 + "%s removing local %s for %s%s%s%s%s",
139 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
140 cli_name(sptr) : cli_name((cli_user(sptr))->server),
141 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
142 @@ -1144,8 +1154,9 @@
144 gliter(GlobalGlineList, gline, sgline) {
145 if (!GlineIsLocal(gline) && gline->gl_lastmod)
146 - sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
147 - GlineIsRemActive(gline) ? '+' : '-',
148 + sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
149 + GlineIsAuto(gline) ? "=" : "",
150 + GlineIsRemActive(gline) ? '+' : '-',
151 gline->gl_nick ? gline->gl_nick : "",
152 gline->gl_nick ? "!" : "",
154 @@ -1157,7 +1168,8 @@
156 gliter(BadChanGlineList, gline, sgline) {
157 if (!GlineIsLocal(gline) && gline->gl_lastmod)
158 - sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s %Tu %Tu %Tu :%s",
159 + sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s %Tu %Tu %Tu :%s",
160 + GlineIsAuto(gline) ? "=" : "",
161 GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
162 gline->gl_expire - CurrentTime, gline->gl_lastmod,
163 gline->gl_lifetime, gline->gl_reason);
164 @@ -1175,7 +1187,8 @@
165 if (GlineIsLocal(gline) || !gline->gl_lastmod)
168 - sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
169 + sendcmdto_one(&me, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
170 + GlineIsAuto(gline) ? "=" : "",
171 GlineIsRemActive(gline) ? '+' : '-',
172 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
173 GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
174 @@ -1214,6 +1227,7 @@
175 gline->gl_expire + TSoffset, gline->gl_lastmod,
176 gline->gl_lifetime + TSoffset,
177 GlineIsLocal(gline) ? cli_name(&me) : "*",
178 + GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
179 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
180 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
181 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
182 @@ -1228,6 +1242,7 @@
183 gline->gl_expire + TSoffset, gline->gl_lastmod,
184 gline->gl_lifetime + TSoffset,
185 GlineIsLocal(gline) ? cli_name(&me) : "*",
186 + GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
187 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
188 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
189 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
190 @@ -1238,6 +1253,7 @@
191 gline->gl_expire + TSoffset, gline->gl_lastmod,
192 gline->gl_lifetime + TSoffset,
193 GlineIsLocal(gline) ? cli_name(&me) : "*",
194 + GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
195 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
196 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
197 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
198 @@ -1273,6 +1289,7 @@
199 gline->gl_host ? gline->gl_host : "",
200 gline->gl_expire + TSoffset, gline->gl_lastmod,
201 gline->gl_lifetime + TSoffset,
202 + GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
203 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
204 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
205 GlineIsRemActive(gline) ? '+' : '-',
206 @@ -1283,6 +1300,7 @@
207 send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user, "", "", "", "",
208 gline->gl_expire + TSoffset, gline->gl_lastmod,
209 gline->gl_lifetime + TSoffset,
210 + GlineIsAuto(gline) && IsAnOper(sptr) ? "=" : "",
211 gline->gl_state == GLOCAL_ACTIVATED ? ">" :
212 (gline->gl_state == GLOCAL_DEACTIVATED ? "<" : ""),
213 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
214 diff -r 8dcf56ed67b9 ircd/m_gline.c
215 --- a/ircd/m_gline.c Sun Feb 15 15:31:50 2009 +0100
216 +++ b/ircd/m_gline.c Sun Feb 15 15:59:10 2009 +0100
219 flags |= GLINE_FORCE;
221 + if (*mask == '=') {
223 + flags |= GLINE_AUTO; /* auto G-line action by service */
228 flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */
229 @@ -183,11 +188,14 @@
230 if ((action == GLINE_LOCAL_ACTIVATE || action == GLINE_LOCAL_DEACTIVATE) &&
232 Debug((DEBUG_DEBUG, "I am forwarding a local change to a global gline "
233 - "to a remote server; target %s, mask %s, operforce %s, action %c",
234 - target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
235 + "to a remote server; target %s, mask %s, auto %s, operforce %s, action %c",
237 + flags & GLINE_AUTO ? "YES" : "NO",
238 + flags & GLINE_OPERFORCE ? "YES" : "NO",
239 action == GLINE_LOCAL_ACTIVATE ? '>' : '<'));
241 - sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s", acptr,
242 + sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s", acptr,
243 + flags & GLINE_AUTO ? "=" : "",
244 flags & GLINE_OPERFORCE ? "!" : "",
245 action == GLINE_LOCAL_ACTIVATE ? '>' : '<', mask);
249 /* OK, create the local G-line */
250 Debug((DEBUG_DEBUG, "I am creating a local G-line here; target %s, "
251 - "mask %s, operforce %s, action %s, expire %Tu, reason: %s",
252 - target, mask, flags & GLINE_OPERFORCE ? "YES" : "NO",
253 + "mask %s, auto %s, operforce %s, action %s, expire %Tu, reason: %s",
255 + flags & GLINE_AUTO ? "YES" : "NO",
256 + flags & GLINE_OPERFORCE ? "YES" : "NO",
257 action == GLINE_ACTIVATE ? "+" : "-", expire, reason));
259 return gline_add(cptr, sptr, mask, reason, expire, lastmod,
262 /* Let's now destroy the G-line */;
263 Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
264 - "mask %s, operforce %s, action %s", target, mask,
265 + "mask %s, auto %s, operforce %s, action %s", target, mask,
266 + flags & GLINE_AUTO ? "YES" : "NO",
267 flags & GLINE_OPERFORCE ? "YES" : "NO",
268 action == GLINE_ACTIVATE ? "+" : "-"));
270 @@ -255,14 +266,17 @@
271 assert(!IsMe(acptr));
273 Debug((DEBUG_DEBUG, "I am forwarding a local G-line to a remote server; "
274 - "target %s, mask %s, operforce %s, action %c, expire %Tu, "
275 + "target %s, mask %s, auto %s, operforce %s, action %c, expire %Tu, "
276 "lastmod %Tu, reason: %s", target, mask,
277 + flags & GLINE_AUTO ? "YES" : "NO",
278 flags & GLINE_OPERFORCE ? "YES" : "NO",
279 action == GLINE_ACTIVATE ? '+' : '-', expire, CurrentTime,
282 - sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%c%s %Tu %Tu :%s",
283 - acptr, flags & GLINE_OPERFORCE ? "!" : "",
284 + sendcmdto_one(sptr, CMD_GLINE, acptr, "%C %s%s%c%s %Tu %Tu :%s",
286 + flags & GLINE_AUTO ? "=" : "",
287 + flags & GLINE_OPERFORCE ? "!" : "",
288 action == GLINE_ACTIVATE ? '+' : '-', mask,
289 expire - CurrentTime, CurrentTime, reason);
292 return need_more_params(sptr, "GLINE");
294 Debug((DEBUG_DEBUG, "I have a global G-line I am acting upon now; "
295 - "target %s, mask %s, operforce %s, action %s, expire %Tu, "
296 + "target %s, mask %s, auto %s, operforce %s, action %s, expire %Tu, "
297 "lastmod %Tu, lifetime %Tu, reason: %s; gline %s! (fields "
298 "present: %s %s %s)", target, mask,
299 + flags & GLINE_AUTO ? "YES" : "NO",
300 flags & GLINE_OPERFORCE ? "YES" : "NO",
301 action == GLINE_ACTIVATE ? "+" :
302 (action == GLINE_DEACTIVATE ? "-" :
304 action == GLINE_ACTIVATE ? "activation" : "deactivation"));
306 /* propagate the G-line, even though we don't have it */
307 - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s %Tu",
308 + sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s %Tu",
309 + flags & GLINE_AUTO ? "=" : "",
310 action == GLINE_ACTIVATE ? '+' : '-',
314 return gline_list(sptr, 0);
317 + /* ignore auto prefix from oper */
324 diff -r 8dcf56ed67b9 ircd/s_err.c
325 --- a/ircd/s_err.c Sun Feb 15 15:31:50 2009 +0100
326 +++ b/ircd/s_err.c Sun Feb 15 15:59:10 2009 +0100
329 { RPL_STATSTLINE, "%c %s %s", "246" },
331 - { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%c :%s", "247" },
332 + { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%s%c :%s", "247" },
334 { RPL_STATSULINE, "U %s", "248" },
340 - { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%c :%s", "280" },
341 + { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%s%c :%s", "280" },
343 { RPL_ENDOFGLIST, ":End of G-line List", "281" },