From bc4d5cba8e91b6a7dd83ea8a5194548eba677a76 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 28 Dec 2019 17:51:03 +0000 Subject: [PATCH] Separate provisioning into user and auth info --- modules/provision.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/provision.py b/modules/provision.py index f15d4c6..59dda84 100644 --- a/modules/provision.py +++ b/modules/provision.py @@ -13,7 +13,19 @@ def provisionUserData(num, nick, altnick, ident, realname, unused): # last field commands["controlpanel"].append("Set Ident %s %s" % (nick, ident)) commands["controlpanel"].append("Set RealName %s %s" % (nick, realname)) deliverRelayCommands(num, commands) - return + +def provisionAuthenticationData(num, nick, network, security, auth, password): + commands = {} + if auth == "sasl": + commands["sasl"] = [] + commands["status"].append("LoadMod sasl") + commands["sasl"].append("Mechanism plain") + commands["sasl"].append("Set %s %s" % (nick, password)) + elif auth == "ns": + commands["nickserv"] = [] + commands["status"].append("LoadMod nickserv") + commands["nickserv"].append("Set %s" % password) + deliverRelayCommands(num, commands, user=nick+"/"+network) def provisionNetworkData(num, nick, network, host, port, security, auth, password): commands = {} @@ -26,6 +38,7 @@ def provisionNetworkData(num, nick, network, host, port, security, auth, passwor commands["controlpanel"].append("AddServer %s %s %s +%s" % (nick, network, host, port)) elif security == "plain": commands["controlpanel"].append("AddServer %s %s %s %s" % (nick, network, host, port)) + # Remove below and use provisionAuthenticationData() when registration implemented if auth == "sasl": stage2commands["sasl"] = [] stage2commands["status"].append("LoadMod sasl") @@ -35,6 +48,7 @@ def provisionNetworkData(num, nick, network, host, port, security, auth, passwor stage2commands["nickserv"] = [] stage2commands["status"].append("LoadMod nickserv") stage2commands["nickserv"].append("Set %s" % password) + # End if not main.config["ConnectOnCreate"]: stage2commands["status"].append("Disconnect") if main.config["Toggles"]["CycleChans"]: @@ -42,7 +56,6 @@ def provisionNetworkData(num, nick, network, host, port, security, auth, passwor stage2commands["status"].append("LoadMod chansaver") deliverRelayCommands(num, commands, stage2=[[nick+"/"+network, stage2commands]]) - return def provisionRelayForNetwork(num, alias, network): provisionNetworkData(num, alias, network, @@ -51,7 +64,6 @@ def provisionRelayForNetwork(num, alias, network): main.network[network].security, main.network[network].auth, main.network[network].aliases[num]["password"]) - return def provisionRelay(num, network): aliasObj = main.alias[num] @@ -60,7 +72,6 @@ def provisionRelay(num, network): reactor.callLater(5, provisionRelayForNetwork, num, alias, network) if main.config["ConnectOnCreate"]: reactor.callLater(10, main.network[network].start_bot, num) - return def provisionMultipleRelays(net, relaysNeeded): numsProvisioned = []