]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - nickgline.patch
Remove topic_reveal.patch. This has been fixed in IRCU and ircu patch is correct...
[irc/quakenet/snircd-patchqueue.git] / nickgline.patch
1 # HG changeset patch
2 # Parent 551b70c8f77d787528b74f060234d656f477543b
3
4 diff -r 551b70c8f77d include/gline.h
5 --- a/include/gline.h Sat Jul 20 15:18:17 2013 +0100
6 +++ b/include/gline.h Sat Jul 20 15:20:58 2013 +0100
7 @@ -49,6 +49,7 @@
8 struct Gline {
9 struct Gline *gl_next; /**< Next G-line in linked list. */
10 struct Gline**gl_prev_p; /**< Previous pointer to this G-line. */
11 + char *gl_nick; /**< Nickname mask. */
12 char *gl_user; /**< Username mask (or channel/realname mask). */
13 char *gl_host; /**< Host portion of mask. */
14 char *gl_reason; /**< Reason for G-line. */
15 @@ -110,6 +111,8 @@
16 /** Test whether \a g is local to this server. */
17 #define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
18
19 +/** Return nick mask of a G-line. */
20 +#define GlineNick(g) ((g)->gl_nick)
21 /** Return user mask of a G-line. */
22 #define GlineUser(g) ((g)->gl_user)
23 /** Return host mask of a G-line. */
24 @@ -144,5 +147,6 @@
25 extern void gline_stats(struct Client *sptr, const struct StatDesc *sd,
26 char *param);
27 extern int gline_memory_count(size_t *gl_size);
28 +extern struct Gline *IsNickGlined(struct Client *cptr, char *nick);
29
30 #endif /* INCLUDED_gline_h */
31 diff -r 551b70c8f77d ircd/gline.c
32 --- a/ircd/gline.c Sat Jul 20 15:18:17 2013 +0100
33 +++ b/ircd/gline.c Sat Jul 20 15:20:58 2013 +0100
34 @@ -26,7 +26,6 @@
35 #include "gline.h"
36 #include "channel.h"
37 #include "client.h"
38 -#include "hash.h"
39 #include "ircd.h"
40 #include "ircd_alloc.h"
41 #include "ircd_features.h"
42 @@ -46,6 +45,7 @@
43 #include "msg.h"
44 #include "numnicks.h"
45 #include "numeric.h"
46 +#include "hash.h"
47
48 /* #include <assert.h> -- Now using assert in ircd_log.h */
49 #include <string.h>
50 @@ -104,32 +104,43 @@
51 * Otherwise, assign \a def_user to *user_p and \a userhost to *host_p.
52 *
53 * @param[in] userhost Input string from user.
54 + * @param[out] nick_p Gets pointer to nick part of hostmask.
55 * @param[out] user_p Gets pointer to user (or channel/realname) part of hostmask.
56 * @param[out] host_p Gets point to host part of hostmask (may be assigned NULL).
57 * @param[in] def_user Default value for user part.
58 */
59 static void
60 -canon_userhost(char *userhost, char **user_p, char **host_p, char *def_user)
61 +canon_userhost(char *userhost, char **nick_p, char **user_p, char **host_p, char *def_user)
62 {
63 - char *tmp;
64 + char *tmp, *s;
65
66 if (*userhost == '$') {
67 *user_p = userhost;
68 *host_p = NULL;
69 + *nick_p = NULL;
70 return;
71 }
72
73 - if (!(tmp = strchr(userhost, '@'))) {
74 + if ((tmp = strchr(userhost, '!'))) {
75 + *nick_p = userhost;
76 + *(tmp++) = '\0';
77 + } else {
78 + *nick_p = def_user;
79 + tmp = userhost;
80 + }
81 +
82 + if (!(s = strchr(tmp, '@'))) {
83 *user_p = def_user;
84 - *host_p = userhost;
85 + *host_p = tmp;
86 } else {
87 - *user_p = userhost;
88 - *(tmp++) = '\0';
89 - *host_p = tmp;
90 + *user_p = tmp;
91 + *(s++) = '\0';
92 + *host_p = s;
93 }
94 }
95
96 /** Create a Gline structure.
97 + * @param[in] nick Nick part of mask.
98 * @param[in] user User part of mask.
99 * @param[in] host Host part of mask (NULL if not applicable).
100 * @param[in] reason Reason for G-line.
101 @@ -139,7 +150,7 @@
102 * @return Newly allocated G-line.
103 */
104 static struct Gline *
105 -make_gline(char *user, char *host, char *reason, time_t expire, time_t lastmod,
106 +make_gline(char *nick, char *user, char *host, char *reason, time_t expire, time_t lastmod,
107 time_t lifetime, unsigned int flags)
108 {
109 struct Gline *gline;
110 @@ -166,7 +177,11 @@
111 BadChanGlineList->gl_prev_p = &gline->gl_next;
112 BadChanGlineList = gline;
113 } else {
114 - DupString(gline->gl_user, user); /* remember them... */
115 + if (*user!='$')
116 + DupString(gline->gl_nick, nick); /* remember them... */
117 + else
118 + gline->gl_nick = 0;
119 + DupString(gline->gl_user, user);
120 if (*user != '$')
121 DupString(gline->gl_host, host);
122 else
123 @@ -240,6 +255,10 @@
124 continue;
125 Debug((DEBUG_DEBUG,"Matched!"));
126 } else { /* Host/IP gline */
127 + if (cli_name(acptr) &&
128 + match(gline->gl_nick, cli_name(acptr)) !=0)
129 + continue;
130 +
131 if (cli_user(acptr)->username &&
132 match(gline->gl_user, (cli_user(acptr))->realusername) != 0)
133 continue;
134 @@ -359,8 +378,11 @@
135
136 assert(gline->gl_lastmod);
137
138 - sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu %Tu :%s",
139 - GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
140 + sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
141 + GlineIsRemActive(gline) ? '+' : '-',
142 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
143 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
144 + gline->gl_user,
145 gline->gl_host ? "@" : "",
146 gline->gl_host ? gline->gl_host : "",
147 gline->gl_expire - TStime(), gline->gl_lastmod,
148 @@ -454,8 +476,8 @@
149 unsigned int flags)
150 {
151 struct Gline *agline;
152 - char uhmask[USERLEN + HOSTLEN + 2];
153 - char *user, *host;
154 + char uhmask[NICKLEN + USERLEN + HOSTLEN + 3];
155 + char *nick, *user, *host;
156 int tmp;
157
158 assert(0 != userhost);
159 @@ -503,9 +525,9 @@
160 return send_reply(sptr, ERR_TOOMANYUSERS, tmp);
161 }
162 } else {
163 - canon_userhost(userhost, &user, &host, "*");
164 + canon_userhost(userhost, &nick, &user, &host, "*");
165 if (sizeof(uhmask) <
166 - ircd_snprintf(0, uhmask, sizeof(uhmask), "%s@%s", user, host))
167 + ircd_snprintf(0, uhmask, sizeof(uhmask), "%s!%s@%s", nick, user, host))
168 return send_reply(sptr, ERR_LONGMASK);
169 else if (MyUser(sptr) || (IsUser(sptr) && flags & GLINE_LOCAL)) {
170 switch (gline_checkmask(host)) {
171 @@ -545,29 +567,35 @@
172
173 /* Inform ops... */
174 sendto_opmask_butone(0, ircd_strncmp(reason, "AUTO", 4) ? SNO_GLINE :
175 - SNO_AUTO, "%s adding %s%s %s for %s%s%s, expiring at "
176 + SNO_AUTO, "%s adding %s%s %s for %s%s%s%s%s, expiring at "
177 "%Tu: %s",
178 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
179 cli_name(sptr) :
180 cli_name((cli_user(sptr))->server),
181 (flags & GLINE_ACTIVE) ? "" : "deactivated ",
182 (flags & GLINE_LOCAL) ? "local" : "global",
183 - (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE", user,
184 + (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE",
185 + (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : nick,
186 + (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : "!",
187 + user,
188 (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : "@",
189 (flags & (GLINE_BADCHAN|GLINE_REALNAME)) ? "" : host,
190 expire, reason);
191
192 /* and log it */
193 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
194 - "%#C adding %s %s for %s%s%s, expiring at %Tu: %s", sptr,
195 + "%#C adding %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
196 flags & GLINE_LOCAL ? "local" : "global",
197 - flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", user,
198 + flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE",
199 + flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : nick,
200 + flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : "!",
201 + user,
202 flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : "@",
203 flags & (GLINE_BADCHAN|GLINE_REALNAME) ? "" : host,
204 expire, reason);
205
206 /* make the gline */
207 - agline = make_gline(user, host, reason, expire, lastmod, lifetime, flags);
208 + agline = make_gline(nick, user, host, reason, expire, lastmod, lifetime, flags);
209
210 /* since we've disabled overlapped G-line checking, agline should
211 * never be NULL...
212 @@ -614,19 +642,24 @@
213 return 0; /* was active to begin with */
214
215 /* Inform ops and log it */
216 - sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s, "
217 + sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s%s%s, "
218 "expiring at %Tu: %s",
219 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
220 cli_name(sptr) :
221 cli_name((cli_user(sptr))->server),
222 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
223 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
224 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
225 gline->gl_user, gline->gl_host ? "@" : "",
226 gline->gl_host ? gline->gl_host : "",
227 gline->gl_expire, gline->gl_reason);
228
229 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
230 - "%#C activating global %s for %s%s%s, expiring at %Tu: %s", sptr,
231 - GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
232 + "%#C activating global %s for %s%s%s%s%s, expiring at %Tu: %s", sptr,
233 + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
234 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
235 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
236 + gline->gl_user,
237 gline->gl_host ? "@" : "",
238 gline->gl_host ? gline->gl_host : "",
239 gline->gl_expire, gline->gl_reason);
240 @@ -682,19 +715,24 @@
241 }
242
243 /* Inform ops and log it */
244 - sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s, expiring at %Tu: "
245 + sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: "
246 "%s",
247 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
248 cli_name(sptr) :
249 cli_name((cli_user(sptr))->server),
250 msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
251 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
252 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
253 gline->gl_user, gline->gl_host ? "@" : "",
254 gline->gl_host ? gline->gl_host : "",
255 gline->gl_expire, gline->gl_reason);
256
257 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
258 - "%#C %s %s for %s%s%s, expiring at %Tu: %s", sptr, msg,
259 - GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
260 + "%#C %s %s for %s%s%s%s%s, expiring at %Tu: %s", sptr, msg,
261 + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
262 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
263 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
264 + gline->gl_user,
265 gline->gl_host ? "@" : "",
266 gline->gl_host ? gline->gl_host : "",
267 gline->gl_expire, gline->gl_reason);
268 @@ -732,8 +770,10 @@
269 assert(gline);
270 assert(!GlineIsLocal(gline));
271
272 - Debug((DEBUG_DEBUG, "gline_modify(\"%s\", \"%s\", \"%s%s%s\", %s, \"%s\", "
273 + Debug((DEBUG_DEBUG, "gline_modify(\"%s\", \"%s\", \"%s%s%s%s%s\", %s, \"%s\", "
274 "%Tu, %Tu, %Tu, 0x%04x)", cli_name(cptr), cli_name(sptr),
275 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
276 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
277 gline->gl_user, gline->gl_host ? "@" : "",
278 gline->gl_host ? gline->gl_host : "",
279 action == GLINE_ACTIVATE ? "GLINE_ACTIVATE" :
280 @@ -883,17 +923,22 @@
281 /* All right, inform ops... */
282 non_auto = non_auto || ircd_strncmp(gline->gl_reason, "AUTO", 4);
283 sendto_opmask_butone(0, non_auto ? SNO_GLINE : SNO_AUTO,
284 - "%s modifying global %s for %s%s%s:%s",
285 + "%s modifying global %s for %s%s%s%s%s:%s",
286 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
287 cli_name(sptr) : cli_name((cli_user(sptr))->server),
288 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
289 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
290 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
291 gline->gl_user, gline->gl_host ? "@" : "",
292 gline->gl_host ? gline->gl_host : "", buf);
293
294 /* and log the change */
295 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
296 - "%#C modifying global %s for %s%s%s:%s", sptr,
297 - GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
298 + "%#C modifying global %s for %s%s%s%s%s:%s", sptr,
299 + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
300 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
301 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
302 + gline->gl_user,
303 gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "",
304 buf);
305
306 @@ -902,8 +947,10 @@
307 */
308 if (action != GLINE_LOCAL_ACTIVATE && action != GLINE_LOCAL_DEACTIVATE)
309 sendcmdto_serv_butone(sptr, CMD_GLINE, cptr,
310 - "* %s%s%s%s%s %Tu %Tu %Tu :%s",
311 + "* %s%s%s%s%s%s%s %Tu %Tu %Tu :%s",
312 flags & GLINE_OPERFORCE ? "!" : "", op,
313 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
314 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
315 gline->gl_user, gline->gl_host ? "@" : "",
316 gline->gl_host ? gline->gl_host : "",
317 gline->gl_expire - TStime(), gline->gl_lastmod,
318 @@ -926,15 +973,20 @@
319 assert(GlineIsLocal(gline));
320
321 /* Inform ops and log it */
322 - sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s",
323 + sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s",
324 (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
325 cli_name(sptr) : cli_name((cli_user(sptr))->server),
326 GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
327 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
328 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
329 gline->gl_user, gline->gl_host ? "@" : "",
330 gline->gl_host ? gline->gl_host : "");
331 log_write(LS_GLINE, L_INFO, LOG_NOSNOTICE,
332 - "%#C removing local %s for %s%s%s", sptr,
333 - GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", gline->gl_user,
334 + "%#C removing local %s for %s%s%s%s%s", sptr,
335 + GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
336 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
337 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
338 + gline->gl_user,
339 gline->gl_host ? "@" : "", gline->gl_host ? gline->gl_host : "");
340
341 gline_free(gline); /* get rid of the G-line */
342 @@ -962,7 +1014,7 @@
343 {
344 struct Gline *gline = 0;
345 struct Gline *sgline;
346 - char *user, *host, *t_uh;
347 + char *nick, *user, *host, *t_uh;
348
349 if (flags & (GLINE_BADCHAN | GLINE_ANY)) {
350 gliter(BadChanGlineList, gline, sgline) {
351 @@ -980,7 +1032,7 @@
352 return 0;
353
354 DupString(t_uh, userhost);
355 - canon_userhost(t_uh, &user, &host, "*");
356 + canon_userhost(t_uh, &nick, &user, &host, "*");
357
358 gliter(GlobalGlineList, gline, sgline) {
359 if ((flags & (GlineIsLocal(gline) ? GLINE_GLOBAL : GLINE_LOCAL)) ||
360 @@ -989,12 +1041,18 @@
361 else if (flags & GLINE_EXACT) {
362 if (((gline->gl_host && host && ircd_strcmp(gline->gl_host, host) == 0)
363 || (!gline->gl_host && !host)) &&
364 - (ircd_strcmp(gline->gl_user, user) == 0))
365 + ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
366 + (user && ircd_strcmp(gline->gl_user, user) == 0)) &&
367 + ((!nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, "*") == 0) ||
368 + (nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, nick) == 0) || (!gline->gl_nick && !nick)))
369 break;
370 } else {
371 if (((gline->gl_host && host && match(gline->gl_host, host) == 0)
372 || (!gline->gl_host && !host)) &&
373 - (match(gline->gl_user, user) == 0))
374 + ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
375 + (user && match(gline->gl_user, user) == 0)) &&
376 + ((!nick && gline->gl_nick && ircd_strcmp(gline->gl_nick, "*") == 0) ||
377 + (nick && gline->gl_nick && (match(gline->gl_nick, nick) == 0)) || (!gline->gl_nick && !nick)))
378 break;
379 }
380 }
381 @@ -1050,7 +1108,9 @@
382 continue;
383 }
384 else {
385 - if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
386 + if (match(gline->gl_nick, cli_name(cptr)) != 0)
387 + continue;
388 + if (match(gline->gl_user, (cli_user(cptr))->realusername) != 0)
389 continue;
390
391 if (GlineIsIpMask(gline)) {
392 @@ -1101,8 +1161,11 @@
393
394 gliter(GlobalGlineList, gline, sgline) {
395 if (!GlineIsLocal(gline) && gline->gl_lastmod)
396 - sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu %Tu :%s",
397 - GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
398 + sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
399 + GlineIsRemActive(gline) ? '+' : '-',
400 + gline->gl_nick ? gline->gl_nick : "",
401 + gline->gl_nick ? "!" : "",
402 + gline->gl_user,
403 gline->gl_host ? "@" : "",
404 gline->gl_host ? gline->gl_host : "",
405 gline->gl_expire - TStime(), gline->gl_lastmod,
406 @@ -1129,8 +1192,11 @@
407 if (GlineIsLocal(gline) || !gline->gl_lastmod)
408 return 0;
409
410 - sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s %Tu %Tu %Tu :%s",
411 - GlineIsRemActive(gline) ? '+' : '-', gline->gl_user,
412 + sendcmdto_one(&me, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
413 + GlineIsRemActive(gline) ? '+' : '-',
414 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
415 + GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
416 + gline->gl_user,
417 gline->gl_host ? "@" : "",
418 gline->gl_host ? gline->gl_host : "",
419 gline->gl_expire - TStime(), gline->gl_lastmod,
420 @@ -1157,8 +1223,10 @@
421 return send_reply(sptr, ERR_NOSUCHGLINE, userhost);
422
423 /* send gline information along */
424 - send_reply(sptr, RPL_GLIST, gline->gl_user,
425 - gline->gl_host ? "@" : "",
426 + send_reply(sptr, RPL_GLIST,
427 + GlineIsBadChan(gline) | GlineIsRealName(gline) ? "" : gline->gl_nick,
428 + GlineIsBadChan(gline) | GlineIsRealName(gline) ? "" : "!",
429 + gline->gl_user, GlineIsBadChan(gline) || GlineIsRealName(gline) ? "" : "@",
430 gline->gl_host ? gline->gl_host : "",
431 gline->gl_expire, gline->gl_lastmod,
432 gline->gl_lifetime,
433 @@ -1168,7 +1236,10 @@
434 GlineIsRemActive(gline) ? '+' : '-', gline->gl_reason);
435 } else {
436 gliter(GlobalGlineList, gline, sgline) {
437 - send_reply(sptr, RPL_GLIST, gline->gl_user,
438 + send_reply(sptr, RPL_GLIST,
439 + gline->gl_nick ? gline->gl_nick : "",
440 + gline->gl_nick ? "!" : "",
441 + gline->gl_user,
442 gline->gl_host ? "@" : "",
443 gline->gl_host ? gline->gl_host : "",
444 gline->gl_expire, gline->gl_lastmod,
445 @@ -1180,7 +1251,7 @@
446 }
447
448 gliter(BadChanGlineList, gline, sgline) {
449 - send_reply(sptr, RPL_GLIST, gline->gl_user, "", "",
450 + send_reply(sptr, RPL_GLIST, gline->gl_user, "", "", "", "",
451 gline->gl_expire, gline->gl_lastmod,
452 gline->gl_lifetime,
453 GlineIsLocal(gline) ? cli_name(&me) : "*",
454 @@ -1207,7 +1278,10 @@
455 struct Gline *sgline;
456
457 gliter(GlobalGlineList, gline, sgline) {
458 - send_reply(sptr, RPL_STATSGLINE, 'G', gline->gl_user,
459 + send_reply(sptr, RPL_STATSGLINE, 'G',
460 + gline->gl_nick ? gline->gl_nick : "",
461 + gline->gl_nick ? "!" : "",
462 + gline->gl_user,
463 gline->gl_host ? "@" : "",
464 gline->gl_host ? gline->gl_host : "",
465 gline->gl_expire, gline->gl_lastmod,
466 @@ -1242,6 +1316,7 @@
467 for (gline = GlobalGlineList; gline; gline = gline->gl_next) {
468 gl++;
469 *gl_size += sizeof(struct Gline);
470 + *gl_size += gline->gl_nick ? (strlen(gline->gl_nick) +1) : 0;
471 *gl_size += gline->gl_user ? (strlen(gline->gl_user) + 1) : 0;
472 *gl_size += gline->gl_host ? (strlen(gline->gl_host) + 1) : 0;
473 *gl_size += gline->gl_reason ? (strlen(gline->gl_reason) + 1) : 0;
474 @@ -1257,3 +1332,46 @@
475
476 return gl;
477 }
478 +
479 +struct Gline *
480 +IsNickGlined(struct Client *cptr, char *nick)
481 +{
482 + struct Gline *gline;
483 + struct Gline *sgline;
484 +
485 + for (gline = GlobalGlineList; gline; gline = sgline) {
486 + sgline = gline->gl_next;
487 +
488 + if (gline->gl_expire <= CurrentTime) {
489 + gline_free(gline);
490 + continue;
491 + }
492 +
493 + if (GlineIsRealName(gline)) /* skip realname glines */
494 + continue;
495 +
496 + if (!ircd_strcmp(gline->gl_nick, "*")) /* skip glines w. wildcarded nick */
497 + continue;
498 +
499 + if (match(gline->gl_nick, nick) != 0)
500 + continue;
501 +
502 + if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
503 + continue;
504 +
505 + if (GlineIsIpMask(gline)) {
506 + if (!ipmask_check(&(cli_ip(cptr)), &gline->gl_addr, gline->gl_bits))
507 + continue;
508 + }
509 + else {
510 + if (match(gline->gl_host, (cli_user(cptr))->realhost) != 0)
511 + continue;
512 + }
513 + return gline;
514 + }
515 + /*
516 + * No Glines matched
517 + */
518 + return 0;
519 +}
520 +
521 diff -r 551b70c8f77d ircd/m_nick.c
522 --- a/ircd/m_nick.c Sat Jul 20 15:18:17 2013 +0100
523 +++ b/ircd/m_nick.c Sat Jul 20 15:20:58 2013 +0100
524 @@ -98,6 +98,7 @@
525 #include "s_user.h"
526 #include "send.h"
527 #include "sys.h"
528 +#include "gline.h"
529
530 /* #include <assert.h> -- Now using assert in ircd_log.h */
531 #include <stdlib.h>
532 @@ -179,6 +180,11 @@
533 return 0;
534 }
535
536 + if (IsRegistered(sptr) && !IsAnOper(sptr) && IsNickGlined(sptr, nick)) {
537 + send_reply(sptr, ERR_ERRONEUSNICKNAME, nick);
538 + return 0;
539 + }
540 +
541 /*
542 * Check if this is a LOCAL user trying to use a reserved (Juped)
543 * nick, if so tell him that it's a nick in use...
544 diff -r 551b70c8f77d ircd/s_err.c
545 --- a/ircd/s_err.c Sat Jul 20 15:18:17 2013 +0100
546 +++ b/ircd/s_err.c Sat Jul 20 15:20:58 2013 +0100
547 @@ -526,7 +526,7 @@
548 /* 246 */
549 { RPL_STATSTLINE, "%c %s %s", "246" },
550 /* 247 */
551 - { RPL_STATSGLINE, "%c %s%s%s %Tu %Tu %Tu %s%c :%s", "247" },
552 + { RPL_STATSGLINE, "%c %s%s%s%s%s %Tu %Tu %Tu %s%c :%s", "247" },
553 /* 248 */
554 { RPL_STATSULINE, "U %s", "248" },
555 /* 249 */
556 @@ -592,7 +592,7 @@
557 /* 279 */
558 { 0 },
559 /* 280 */
560 - { RPL_GLIST, "%s%s%s %Tu %Tu %Tu %s %s%c :%s", "280" },
561 + { RPL_GLIST, "%s%s%s%s%s %Tu %Tu %Tu %s %s%c :%s", "280" },
562 /* 281 */
563 { RPL_ENDOFGLIST, ":End of G-line List", "281" },
564 /* 282 */