Przeglądaj źródła

fix #511

tags/v1.1.0-rc1
Shivaram Lingamneni 5 lat temu
rodzic
commit
dcb3487566
3 zmienionych plików z 19 dodań i 1 usunięć
  1. 6
    0
      gencapdefs.py
  2. 6
    1
      irc/caps/defs.go
  3. 7
    0
      irc/handlers.go

+ 6
- 0
gencapdefs.py Wyświetl plik

171
         url="https://wiki.znc.in/Playback",
171
         url="https://wiki.znc.in/Playback",
172
         standard="ZNC vendor",
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
 def validate_defs():
182
 def validate_defs():

+ 6
- 1
irc/caps/defs.go Wyświetl plik

7
 
7
 
8
 const (
8
 const (
9
 	// number of recognized capabilities:
9
 	// number of recognized capabilities:
10
-	numCapabs = 26
10
+	numCapabs = 27
11
 	// length of the uint64 array that represents the bitset:
11
 	// length of the uint64 array that represents the bitset:
12
 	bitsetLen = 1
12
 	bitsetLen = 1
13
 )
13
 )
116
 	// ZNCPlayback is the ZNC vendor capability named "znc.in/playback":
116
 	// ZNCPlayback is the ZNC vendor capability named "znc.in/playback":
117
 	// https://wiki.znc.in/Playback
117
 	// https://wiki.znc.in/Playback
118
 	ZNCPlayback Capability = iota
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
 // `capabilityNames[capab]` is the string name of the capability `capab`
125
 // `capabilityNames[capab]` is the string name of the capability `capab`
147
 		"znc.in/self-message",
151
 		"znc.in/self-message",
148
 		"draft/event-playback",
152
 		"draft/event-playback",
149
 		"znc.in/playback",
153
 		"znc.in/playback",
154
+		"oragono.io/nope",
150
 	}
155
 	}
151
 )
156
 )

+ 7
- 0
irc/handlers.go Wyświetl plik

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
 		// update maxlenrest, just in case they altered the maxline cap
584
 		// update maxlenrest, just in case they altered the maxline cap
578
 		rb.session.SetMaxlenRest()
585
 		rb.session.SetMaxlenRest()
579
 
586
 

Ładowanie…
Anuluj
Zapisz