Software /
code /
clix
Comparison
clix.lua @ 166:b0c586241224
clix: Support SCRAM hashes stored as hex in config
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 03 Aug 2022 03:02:12 +0200 |
parent | 165:e4391832be1e |
child | 168:75e8ca131178 |
comparison
equal
deleted
inserted
replaced
165:e4391832be1e | 166:b0c586241224 |
---|---|
109 end); | 109 end); |
110 -- Optional config parameters | 110 -- Optional config parameters |
111 conn.connect_host = account.address; | 111 conn.connect_host = account.address; |
112 conn.connect_port = account.port; | 112 conn.connect_port = account.port; |
113 | 113 |
114 if not account.password and opts.interactive then | 114 if not account.password and not (account.clientkey and account.serverkey) and opts.interactive then |
115 account.password = read_password() | 115 account.password = read_password() |
116 end | 116 end |
117 | |
118 local clientkey, serverkey = account.clientkey, account.serverkey; | |
119 if clientkey and serverkey then | |
120 local hex = require "util.hex"; | |
121 clientkey = hex.from(clientkey); | |
122 serverkey = hex.from(serverkey); | |
123 elseif clientkey or serverkey then | |
124 conn:warn("Only one of 'clientkey' and 'serverkey' available, both reqired for SCRAM") | |
125 clientkey, serverkey = nil, nil; | |
126 end | |
117 | 127 |
118 -- Connect! | 128 -- Connect! |
119 conn:connect_client(account.jid, account.password); | 129 conn:connect_client(account.jid, account.password, clientkey, serverkey); |
120 | 130 |
121 -- COMPAT: Tigase discards stanzas sent at the same time as </stream:stream> | 131 -- COMPAT: Tigase discards stanzas sent at the same time as </stream:stream> |
122 local _real_close = conn.close; | 132 local _real_close = conn.close; |
123 function conn:close() | 133 function conn:close() |
124 conn:debug("Delaying close..."); | 134 conn:debug("Delaying close..."); |