Prevent a bad domain_name from causing a nil error for reverse authentication.
This commit is contained in:
parent
d68a273c64
commit
a8cdcf013c
|
|
@ -1,6 +1,6 @@
|
|||
-- xml_handler.lua
|
||||
-- Part of FusionPBX
|
||||
-- Copyright (C) 2013 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Copyright (C) 2013-2015 Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -39,8 +39,7 @@
|
|||
assert(dbh:connected());
|
||||
|
||||
--get the domain_uuid
|
||||
if (domain_uuid == nil) then
|
||||
--get the domain_uuid
|
||||
if (domain_uuid == nil and domain_name ~= nil) then
|
||||
if (domain_name ~= nil) then
|
||||
sql = "SELECT domain_uuid FROM v_domains ";
|
||||
sql = sql .. "WHERE domain_name = '" .. domain_name .."' ";
|
||||
|
|
@ -51,14 +50,10 @@
|
|||
domain_uuid = rows["domain_uuid"];
|
||||
end);
|
||||
end
|
||||
--if the domain_uuid is null then set an empty string
|
||||
if (domain_uuid == nil) then
|
||||
domain_uuid = " ";
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--get the extension information
|
||||
if (domain_uuid ~= nil) then
|
||||
sql = "SELECT * FROM v_extensions WHERE domain_uuid = '" .. domain_uuid .. "' and (extension = '" .. user .. "' or number_alias = '" .. user .. "') and enabled = 'true' ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
||||
|
|
@ -79,8 +74,10 @@
|
|||
--params
|
||||
password = row.password;
|
||||
end);
|
||||
end
|
||||
|
||||
--build the xml
|
||||
if (domain_name ~= nil and extension ~= nil and password ~= nil) then
|
||||
local xml = {}
|
||||
--table.insert(xml, [[<?xml version="1.0" encoding="UTF-8" standalone="no"?>]]);
|
||||
table.insert(xml, [[<document type="freeswitch/xml">]]);
|
||||
|
|
@ -96,6 +93,7 @@
|
|||
table.insert(xml, [[ </section>]]);
|
||||
table.insert(xml, [[</document>]]);
|
||||
XML_STRING = table.concat(xml, "\n");
|
||||
end
|
||||
|
||||
--close the database connection
|
||||
dbh:release();
|
||||
|
|
|
|||
Loading…
Reference in New Issue