aboutsummaryrefslogtreecommitdiff
path: root/modules/sasl.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-09-07 15:51:41 +0100
committerGravatar jesopo2018-09-07 15:51:41 +0100
commit7e3d7542b9c37e8980c78089a739add9be8b0606 (patch)
treef6ccbbe38d5bfffdc1b1eca0909f97d045068a5d /modules/sasl.py
parentSupport server-time, even if it's ignored for the moment (diff)
signature
Support CAP 3.2
Diffstat (limited to 'modules/sasl.py')
-rw-r--r--modules/sasl.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/sasl.py b/modules/sasl.py
index 7bde0813..8df4b3c9 100644
--- a/modules/sasl.py
+++ b/modules/sasl.py
@@ -14,9 +14,16 @@ class Module(object):
event["server"].send_capability_request("sasl")
def on_cap(self, event):
- if "sasl" in event["capabilities"] and event["server"].get_setting(
- "sasl", None):
+ has_sasl = "sasl" in event["capabilities"]
+ has_mechanisms = has_sasl and not event["capabilities"]["sasl"
+ ] == None
+ has_plaintext = has_mechanisms and "PLAIN" in event["capabilities"
+ ]["sasl"].split(",")
+
+ if has_sasl and (has_plaintext or not has_mechanisms) and event[
+ "server"].get_setting("sasl", None):
event["server"].queue_capability("sasl")
+
def on_cap_ack(self, event):
if "sasl" in event["capabilities"]:
event["server"].send_authenticate("PLAIN")