Changeset

12382:574cf096a426

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?)
author Matthew Wild <mwild1@gmail.com>
date Sat, 05 Mar 2022 20:32:47 +0000
parents 12381:d999c2b3e289
children 12383:a9b6ed86b573
files util/prosodyctl/check.lua
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl/check.lua	Sat Mar 05 20:31:17 2022 +0000
+++ b/util/prosodyctl/check.lua	Sat Mar 05 20:32:47 2022 +0000
@@ -186,8 +186,12 @@
 	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 @@
 	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());