Parcourir la source

fix #511

tags/v1.1.0-rc1
Shivaram Lingamneni il y a 5 ans
Parent
révision
dcb3487566
3 fichiers modifiés avec 19 ajouts et 1 suppressions
  1. 6
    0
      gencapdefs.py
  2. 6
    1
      irc/caps/defs.go
  3. 7
    0
      irc/handlers.go

+ 6
- 0
gencapdefs.py Voir le fichier

@@ -171,6 +171,12 @@ CAPDEFS = [
171 171
         url="https://wiki.znc.in/Playback",
172 172
         standard="ZNC vendor",
173 173
     ),
174
+    CapDef(
175
+        identifier="Nope",
176
+        name="oragono.io/nope",
177
+        url="https://oragono.io/nope",
178
+        standard="Oragono vendor",
179
+    ),
174 180
 ]
175 181
 
176 182
 def validate_defs():

+ 6
- 1
irc/caps/defs.go Voir le fichier

@@ -7,7 +7,7 @@ package caps
7 7
 
8 8
 const (
9 9
 	// number of recognized capabilities:
10
-	numCapabs = 26
10
+	numCapabs = 27
11 11
 	// length of the uint64 array that represents the bitset:
12 12
 	bitsetLen = 1
13 13
 )
@@ -116,6 +116,10 @@ const (
116 116
 	// ZNCPlayback is the ZNC vendor capability named "znc.in/playback":
117 117
 	// https://wiki.znc.in/Playback
118 118
 	ZNCPlayback Capability = iota
119
+
120
+	// Nope is the Oragono vendor capability named "oragono.io/nope":
121
+	// https://oragono.io/nope
122
+	Nope Capability = iota
119 123
 )
120 124
 
121 125
 // `capabilityNames[capab]` is the string name of the capability `capab`
@@ -147,5 +151,6 @@ var (
147 151
 		"znc.in/self-message",
148 152
 		"draft/event-playback",
149 153
 		"znc.in/playback",
154
+		"oragono.io/nope",
150 155
 	}
151 156
 )

+ 7
- 0
irc/handlers.go Voir le fichier

@@ -574,6 +574,13 @@ func capHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
574 574
 			}
575 575
 		}
576 576
 
577
+		// #511: oragono.io/nope is a fake cap to trap bad clients who blindly request
578
+		// every offered capability:
579
+		if toAdd.Has(caps.Nope) {
580
+			client.Quit(client.t("Requesting the oragono.io/nope CAP is forbidden"), rb.session)
581
+			return true
582
+		}
583
+
577 584
 		// update maxlenrest, just in case they altered the maxline cap
578 585
 		rb.session.SetMaxlenRest()
579 586
 

Chargement…
Annuler
Enregistrer