default sasl-hard-fail to false but add a bot-wide setting for it
This commit is contained in:
parent
7d3521395e
commit
1d34363db4
1 changed files with 7 additions and 3 deletions
|
@ -17,11 +17,14 @@ def _parse(value):
|
||||||
mechanism, _, arguments = value.partition(" ")
|
mechanism, _, arguments = value.partition(" ")
|
||||||
return {"mechanism": mechanism.upper(), "args": arguments}
|
return {"mechanism": mechanism.upper(), "args": arguments}
|
||||||
|
|
||||||
|
HARDFAIL = utils.BoolSetting("sasl-hard-fail",
|
||||||
|
"Set whether a SASL failure should cause a disconnect")
|
||||||
|
|
||||||
@utils.export("serverset", utils.FunctionSetting(_parse, "sasl",
|
@utils.export("serverset", utils.FunctionSetting(_parse, "sasl",
|
||||||
"Set the sasl username/password for this server",
|
"Set the sasl username/password for this server",
|
||||||
example="PLAIN BitBot:hunter2"))
|
example="PLAIN BitBot:hunter2"))
|
||||||
@utils.export("serverset", utils.BoolSetting("sasl-hard-fail",
|
@utils.export("serverset", HARDFAIL)
|
||||||
"Set whether a SASL failure should cause a disconnect"))
|
@utils.export("botset", HARDFAIL)
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
def _best_userpass_mechanism(self, mechanisms):
|
def _best_userpass_mechanism(self, mechanisms):
|
||||||
for potential_mechanism in USERPASS_MECHANISMS:
|
for potential_mechanism in USERPASS_MECHANISMS:
|
||||||
|
@ -147,7 +150,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
self._end_sasl(event["server"])
|
self._end_sasl(event["server"])
|
||||||
|
|
||||||
def _panic(self, server, message):
|
def _panic(self, server, message):
|
||||||
if server.get_setting("sasl-hard-fail", True):
|
if server.get_setting("sasl-hard-fail",
|
||||||
|
self.bot.get_setting("sasl-hard-fail", False)):
|
||||||
message = "SASL panic for %s: %s" % (str(server), message)
|
message = "SASL panic for %s: %s" % (str(server), message)
|
||||||
if not server.from_init:
|
if not server.from_init:
|
||||||
self.log.error(message)
|
self.log.error(message)
|
||||||
|
|
Loading…
Add table
Reference in a new issue