-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglinedestroy.patch
132 lines (112 loc) · 4.79 KB
/
glinedestroy.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# HG changeset patch
# Parent e5696ca6af7ca3b62663f4891d4f570b3e66356e
Add % prefix for gline allowing a global gline to be destroyed (removed from memory)
instead of being kept in memory in a deactivated state until it expires.
This prefix should only be used when there are no servers split that have the gline,
because during a netmerge, if the other end has this gline,
it will be reintroduced to our side of the network.
Syntax:
P10 (Uworld gline, no lastmod)
"<source numeric> GL * %-<mask>"
P10 (normal gline, lastmod)
"<source numeric> GL * %-<mask> <expire> <lastmod> :<reason>"
Oper
"GLINE %-<mask> * <expire> :<reason>"
diff -r e5696ca6af7c include/gline.h
--- a/include/gline.h Sun Jul 21 09:54:48 2013 +0200
+++ b/include/gline.h Sun Jul 21 10:10:30 2013 +0200
@@ -83,6 +83,7 @@
#define GLINE_LASTMOD 0x0200 /**< Find only G-lines with non-zero lastmod. */
#define GLINE_OPERFORCE 0x0400 /**< Oper forcing G-line to be set. */
#define GLINE_REALNAME 0x0800 /**< G-line matches only the realname field. */
+#define GLINE_DESTROY 0x1000 /**< G-line is to be destroyed, removed from memory - snircd */
#define GLINE_EXPIRE 0x1000 /**< Expiration time update */
#define GLINE_LIFETIME 0x2000 /**< Record lifetime update */
@@ -110,6 +111,8 @@
#define GlineIsBadChan(g) ((g)->gl_flags & GLINE_BADCHAN)
/** Test whether \a g is local to this server. */
#define GlineIsLocal(g) ((g)->gl_flags & GLINE_LOCAL)
+/** Test whether \a g is to be destroyed - snircd */
+#define GlineIsDestroy(g) ((g)->gl_flags & GLINE_DESTROY)
/** Return nick mask of a G-line. */
#define GlineNick(g) ((g)->gl_nick)
diff -r e5696ca6af7c ircd/gline.c
--- a/ircd/gline.c Sun Jul 21 09:54:48 2013 +0200
+++ b/ircd/gline.c Sun Jul 21 10:10:30 2013 +0200
@@ -388,7 +388,8 @@
assert(gline->gl_lastmod);
- sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %c%s%s%s%s%s %Tu %Tu %Tu :%s",
+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %s%c%s%s%s%s%s %Tu %Tu %Tu :%s",
+ GlineIsDestroy(gline) ? "%" : "",
GlineIsRemActive(gline) ? '+' : '-',
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick,
GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!",
@@ -725,7 +726,14 @@
msg = "removing global";
gline->gl_flags &= ~GLINE_ACTIVE; /* propagate a -<mask> */
} else {
- msg = "deactivating global";
+
+ /* destroy gline - snircd */
+ if (flags & GLINE_DESTROY) {
+ msg = "destroying global";
+ gline->gl_flags |= GLINE_DESTROY;
+ }
+ else
+ msg = "deactivating global";
if (flags & GLINE_LOCAL)
gline->gl_flags |= GLINE_LDEACT;
@@ -740,7 +748,7 @@
}
}
- if ((saveflags & GLINE_ACTMASK) != GLINE_ACTIVE)
+ if ((saveflags & GLINE_ACTMASK) != GLINE_ACTIVE && !(flags & GLINE_DESTROY))
return 0; /* was inactive to begin with */
}
@@ -771,7 +779,8 @@
gline_propagate(cptr, sptr, gline);
/* if it's a local gline or a Uworld gline (and not locally deactivated).. */
- if (GlineIsLocal(gline) || (!gline->gl_lastmod && !(flags & GLINE_LOCAL)))
+ if (GlineIsLocal(gline) || (!gline->gl_lastmod && !(flags & GLINE_LOCAL)) ||
+ (flags & GLINE_DESTROY)) /* destroy gline - snircd */
gline_free(gline); /* get rid of it */
return 0;
diff -r e5696ca6af7c ircd/m_gline.c
--- a/ircd/m_gline.c Sun Jul 21 09:54:48 2013 +0200
+++ b/ircd/m_gline.c Sun Jul 21 10:10:30 2013 +0200
@@ -143,6 +143,9 @@
if (*mask == '!') {
mask++;
flags |= GLINE_OPERFORCE; /* assume oper had WIDE_GLINE */
+ } else if (*mask == '%') { /* destroy gline - snircd */
+ mask++;
+ flags |= GLINE_DESTROY;
}
switch (*mask) { /* handle +, -, <, and > */
@@ -238,8 +241,17 @@
lifetime, flags | GLINE_ACTIVE);
}
} else if (IsMe(acptr)) { /* destroying a local G-line */
- if (!agline) /* G-line doesn't exist, so let's complain... */
- return send_reply(sptr, ERR_NOSUCHGLINE, mask);
+ if (!agline) {
+ /* manually propagate destroy for a global gline we dont have - snircd */
+ if ((flags & GLINE_DESTROY) && !(flags & (GLINE_ACTIVE|GLINE_LOCAL))) {
+ sendcmdto_serv_butone(sptr, CMD_GLINE, cptr, "* %%-%s %Tu %Tu %Tu :%s",
+ mask, expire, lastmod, lifetime, reason);
+ return 0;
+ } else {
+ /* G-line doesn't exist, so let's complain... */
+ return send_reply(sptr, ERR_NOSUCHGLINE, mask);
+ }
+ }
/* Let's now destroy the G-line */;
Debug((DEBUG_DEBUG, "I am destroying a local G-line here; target %s, "
@@ -398,6 +410,9 @@
if (HasPriv(sptr, PRIV_WIDE_GLINE))
flags |= GLINE_OPERFORCE;
+ } else if (*mask == '%') { /* destroy gline - snircd */
+ mask++;
+ flags |= GLINE_DESTROY;
}
switch (*mask) { /* handle +, -, <, and > */