Always request the 'sasl' cap before using AUTHENTICATE

It's required by InspIRCd.

This commit also adds a check so we don't forget it when testing
locally only with Ergo.
This commit is contained in:
Valentin Lorentz 2021-06-27 00:46:00 +02:00 committed by Val Lorentz
parent 829edddeb8
commit cc8b9748a7
5 changed files with 31 additions and 3 deletions

View File

@ -595,6 +595,8 @@ class BaseServerTestCase(
else:
raise
if password is not None:
if "sasl" not in (capabilities or ()):
raise ValueError("Used 'password' option without sasl capbilitiy")
self.sendLine(client, "AUTHENTICATE PLAIN")
m = self.getRegistrationMessage(client)
self.assertMessageMatch(m, command="AUTHENTICATE", params=["+"])

View File

@ -11,7 +11,9 @@ class Bouncer(cases.BaseServerTestCase):
self.controller.registerUser(self, "observer", "observerpassword")
self.controller.registerUser(self, "testuser", "mypassword")
self.connectClient("observer", password="observerpassword")
self.connectClient(
"observer", password="observerpassword", capabilities=["sasl"]
)
self.joinChannel(1, "#chan")
self.sendLine(1, "CAP REQ :message-tags server-time")
self.getMessages(1)

View File

@ -50,6 +50,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"labeled-response",
"message-tags",
"server-time",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -86,7 +87,13 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
self.connectClient(
bar,
name=bar,
capabilities=["batch", "labeled-response", "message-tags", "server-time"],
capabilities=[
"batch",
"labeled-response",
"message-tags",
"sasl",
"server-time",
],
password=pw,
)
self.getMessages(bar)
@ -153,6 +160,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -187,6 +195,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -200,6 +209,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -292,6 +302,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -498,6 +509,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -511,6 +523,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
],
password="sesame2",
@ -592,6 +605,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
EVENT_PLAYBACK_CAP,
],
@ -605,6 +619,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase):
"echo-message",
"batch",
"labeled-response",
"sasl",
CHATHISTORY_CAP,
],
password="sesame2",

View File

@ -24,7 +24,9 @@ class ConfusablesTestCase(cases.BaseServerTestCase):
self.assertNotIn(RPL_WELCOME, commands)
self.assertIn(ERR_NICKNAMEINUSE, commands)
self.connectClient("evan", name="evan", password="sesame")
self.connectClient(
"evan", name="evan", password="sesame", capabilities=["sasl"]
)
# should be able to switch to the confusable nick
self.sendLine("evan", "NICK еvan")
messages = self.getMessages("evan")

View File

@ -34,6 +34,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)
@ -49,6 +50,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
)
self.joinChannel(qux, chname)
@ -83,6 +85,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)
@ -102,6 +105,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)
@ -125,6 +129,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)
@ -160,6 +165,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)
@ -185,6 +191,7 @@ class ZncPlaybackTestCase(cases.BaseServerTestCase):
"message-tags",
"server-time",
"echo-message",
"sasl",
],
password=pw,
)