diff options
author | Matthew Wild <mwild1@gmail.com> | 2022-03-05 20:32:47 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2022-03-05 20:32:47 +0000 |
commit | 750f3a78d5574c5b5fedf3972d7a9e4fc699d031 (patch) | |
tree | b75e205bda8b14ebfe8f88247c57054b6aa7ddb0 /util/prosodyctl/check.lua | |
parent | 08777eb3d66c3e47ef421ee7a82d3c32490321d9 (diff) | |
download | prosody-750f3a78d5574c5b5fedf3972d7a9e4fc699d031.tar.gz prosody-750f3a78d5574c5b5fedf3972d7a9e4fc699d031.zip |
prosodyctl: check turn: fix traceback when server does not provide realm/nonce
As coturn when installed out of the box on Debian (because auth isn't enabled?)
Diffstat (limited to 'util/prosodyctl/check.lua')
-rw-r--r-- | util/prosodyctl/check.lua | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua index c09acc55..6f22ab17 100644 --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -186,8 +186,12 @@ local function check_turn_service(turn_service, ping_service) local perm_request = stun.new_packet("create-permission"); perm_request:add_xor_peer_address(ping_service_ip); perm_request:add_attribute("username", turn_user); - perm_request:add_attribute("realm", realm); - perm_request:add_attribute("nonce", nonce); + if realm then + perm_request:add_attribute("realm", realm); + end + if nonce then + perm_request:add_attribute("nonce", nonce); + end perm_request:add_message_integrity(key); sock:send(perm_request:serialize()); @@ -210,8 +214,12 @@ local function check_turn_service(turn_service, ping_service) ping_request:add_xor_peer_address(ping_service_ip, ping_port); ping_request:add_attribute("data", ping_data); ping_request:add_attribute("username", turn_user); - ping_request:add_attribute("realm", realm); - ping_request:add_attribute("nonce", nonce); + if realm then + ping_request:add_attribute("realm", realm); + end + if nonce then + ping_request:add_attribute("nonce", nonce); + end ping_request:add_message_integrity(key); sock:send(ping_request:serialize()); |