comparison mod_auth_external/mod_auth_external.lua @ 1157:a7d0d129df6f

mod_auth_external: Log full response from pty if it appears to be an error message
author Matthew Wild <mwild1@gmail.com>
date Tue, 13 Aug 2013 21:37:05 +0100
parents 3c82984ffa51
children ae1767b54964
comparison
equal deleted inserted replaced
1156:3c82984ffa51 1157:a7d0d129df6f
65 elseif (script_type == "ejabberd" and response == "\0\2\0\1") or 65 elseif (script_type == "ejabberd" and response == "\0\2\0\1") or
66 (script_type == "generic" and response:gsub("\r?\n$", "") == "1") then 66 (script_type == "generic" and response:gsub("\r?\n$", "") == "1") then
67 return true; 67 return true;
68 else 68 else
69 if response then 69 if response then
70 log("warn", "Unable to interpret data from auth process, %d bytes beginning with: %s", #response, (response:sub(1,4):gsub(".", function (c) 70 log("warn", "Unable to interpret data from auth process, %s", (response:match("^error:") and response) or ("["..#response.." bytes]"));
71 return ("%02X "):format(c:byte());
72 end)));
73 else 71 else
74 log("warn", "Error while waiting for result from auth process: %s", response or "unknown error"); 72 log("warn", "Error while waiting for result from auth process: %s", response or "unknown error");
75 end 73 end
76 return nil, "internal-server-error"; 74 return nil, "internal-server-error";
77 end 75 end