FSN#35623 Putorders webservice laten aanroepen controleerbaar via fac_verify
svn path=/Website/trunk/; revision=28378
This commit is contained in:
@@ -12,6 +12,17 @@
|
||||
Kopieer dit bestand tijdelijk(!) naar verify.asp om het echt bruikbaar
|
||||
te maken.
|
||||
Als je de gelegenheid hebt om in te loggen met PRSSYS gebruik dan
|
||||
gewoon appl/fac/fac_verify2.asp
|
||||
*/ %>
|
||||
gewoon appl/fac/fac_verify.asp
|
||||
*/
|
||||
String.prototype.format = function()
|
||||
{
|
||||
var formatted = this;
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
{
|
||||
var regexp = new RegExp('\\{'+i+'\\}', 'gi');
|
||||
formatted = formatted.replace(regexp, arguments[i]);
|
||||
}
|
||||
return formatted;
|
||||
};
|
||||
%>
|
||||
<!--#include file="fac_verify.inc "-->
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
var arr = ['X'];
|
||||
for (var i = 0; i < 16; i++)
|
||||
arr.push(arr.join(""));
|
||||
var str = arr.join(""); // 64KB
|
||||
var str = arr.join(""); // 64kB
|
||||
var i = 0;
|
||||
try
|
||||
{
|
||||
@@ -187,7 +187,7 @@ function zipfile(pathname, filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
txt = xhr2.status + ": " + xhr2.statusText;;
|
||||
txt = xhr2.status + ": " + xhr2.statusText;
|
||||
}
|
||||
document.getElementById('checkAPI2P').appendChild( document.createTextNode(txt) );
|
||||
}
|
||||
@@ -211,13 +211,12 @@ function zipfile(pathname, filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
txt = xhr3.status + ": " + xhr3.statusText;;
|
||||
txt = xhr3.status + ": " + xhr3.statusText;
|
||||
}
|
||||
document.getElementById('checkAPI2D').appendChild( document.createTextNode(txt) );
|
||||
}
|
||||
}
|
||||
xhr3.send(null);
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -433,6 +432,34 @@ checker("Server.ScriptTimeout",
|
||||
}
|
||||
)
|
||||
|
||||
checker("Application pool",
|
||||
function ()
|
||||
{
|
||||
var res = resultcodes.ok;
|
||||
var message;
|
||||
var info;
|
||||
if (typeof Application("SET_INSTANCE_TIME") == "undefined")
|
||||
{
|
||||
res = resultcodes.warning;
|
||||
message = "Application('SET_INSTANCE_TIME') not set?";
|
||||
}
|
||||
else
|
||||
{
|
||||
var tm_start = new Date(Application("SET_INSTANCE_TIME"));
|
||||
message = "Application pool start: " + tm_start.toLocaleString();
|
||||
if (tm_start.getHours() >= 9 && tm_start.getHours() <= 18)
|
||||
{
|
||||
info = "During office hours?";
|
||||
res = resultcodes.warning;
|
||||
}
|
||||
}
|
||||
return { result: res,
|
||||
message: message,
|
||||
info: info
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
checker("Max download (Response Buffering Limit)",
|
||||
function ()
|
||||
{
|
||||
@@ -443,7 +470,7 @@ checker("Max download (Response Buffering Limit)",
|
||||
res = resultcodes.error;
|
||||
return { result: res,
|
||||
message: "Maximum download is " + maxDownload + " bytes",
|
||||
info: String(maxDownload / 1024) + "KB"
|
||||
info: String(maxDownload / 1024) + "kB" + "<br>" + (maxDownload / 1024 / 1024).toFixed(1) + "MB"
|
||||
};
|
||||
}
|
||||
)
|
||||
@@ -607,6 +634,7 @@ testfolder("../../cust/"+custID+"/dwf", false); // neednotbethere
|
||||
__GROUP = "Putorders";
|
||||
|
||||
if (this.S)
|
||||
{
|
||||
checker("Overrules",
|
||||
function ()
|
||||
{
|
||||
@@ -624,6 +652,51 @@ if (this.S)
|
||||
}
|
||||
)
|
||||
|
||||
checker("Internal web url",
|
||||
function ()
|
||||
{
|
||||
var puo_web_url = S("puo_fclt_web_url") + "/appl/fac/fac_verify_test.asp?checkINSTANCE=1&fac_id=" + custID;
|
||||
// Controleer of we via S("puo_fclt_web_url") op dezelfde webserver uitkomen als de huidige request
|
||||
// Ze moeten beide dezelfde Application("SET_INSTANCE_RANDOM") hebben
|
||||
var result = { result: resultcodes.ok, message: "Checking internal url: " + S("puo_fclt_web_url") };
|
||||
try
|
||||
{
|
||||
var http_request = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0");
|
||||
http_request.open("GET", puo_web_url, false); // Synchroon
|
||||
// Het hoeft niet echt lang te duren!
|
||||
var lResolve = 1 * 1000;
|
||||
var lConnect = 1 * 1000;
|
||||
var lSend = 2 * 1000;
|
||||
var lReceive = 2 * 1000;
|
||||
http_request.setTimeouts(lResolve, lConnect, lSend, lReceive);
|
||||
http_request.send();
|
||||
|
||||
if (http_request.status < 200 || http_request.status > 299)
|
||||
{
|
||||
result.result = resultcodes.error;
|
||||
result.message += "<br>http_request error " + http_request.status + ": (" + http_request.statusText + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
var remote_random = http_request.responseText;
|
||||
var this_random = Application("SET_INSTANCE_RANDOM");
|
||||
if (remote_random != this_random)
|
||||
{
|
||||
result.result = resultcodes.error;
|
||||
result.message += "<br>puo_fclt_web_url url does not point to this website? ";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
result.result = resultcodes.error;
|
||||
result.message += "<br>http_request error " + e.description;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
checker("Logfiles",
|
||||
function ()
|
||||
{
|
||||
@@ -649,13 +722,13 @@ checker("Logfiles",
|
||||
var year = dt.getYear();
|
||||
txt = "putorders_" + custID + "_" + year + "_" + (month<10?"0":"") + month + ".log";
|
||||
txt += " <a href='" + zelf + "?put_log=1&year=" + year + "&month=" + month + "'>scheduled</a>";
|
||||
txt += " of <a href='" + zelf + "?put_log=2&year=" + year + "&month=" + month + "'> immediate</a>";
|
||||
txt += " or <a href='" + zelf + "?put_log=2&year=" + year + "&month=" + month + "'> immediate</a>";
|
||||
var dt = new Date();
|
||||
var month = dt.getMonth()+1;
|
||||
var year = dt.getYear();
|
||||
txt += "<br>putorders_" + custID + "_" + year + "_" + (month<10?"0":"") + month + ".log";
|
||||
txt += " <a href='" + zelf + "?put_log=1&year=" + year + "&month=" + month + "'>scheduled</a>";
|
||||
txt += " of <a href='" + zelf + "?put_log=2&year=" + year + "&month=" + month + "'> immediate</a>";
|
||||
txt += " or <a href='" + zelf + "?put_log=2&year=" + year + "&month=" + month + "'> immediate</a>";
|
||||
|
||||
return { result: resultcodes.ok, message: txt };
|
||||
}
|
||||
@@ -962,25 +1035,29 @@ checker("PBKDF2 timing (for setting S('prs_password_hash_factor'))",
|
||||
{
|
||||
try
|
||||
{
|
||||
oSLNKDWF = new ActiveXObject("SLNKDWF.About");
|
||||
var oSLNKDWF = new ActiveXObject("SLNKDWF.About");
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
return { result: resultcodes.warning,
|
||||
message: e.description + "<br>SLNKDWF.DLL not installed. PBKDF2 password hashing not available"};
|
||||
message: e.description + "<br>SLNKDWF.DLL not installed. PBKDF2 password hashing not available"};
|
||||
}
|
||||
var oSLNKDWF = new ActiveXObject("SLNKDWF.About");
|
||||
var oCrypto = new ActiveXObject("SLNKDWF.Crypto");
|
||||
var workfactor = 10;
|
||||
var workfactor = 12;
|
||||
var message = [];
|
||||
while (1)
|
||||
{
|
||||
var usStart = oSLNKDWF.usTimer;
|
||||
var is_hash = oCrypto.hex_pbkdf2("password", "salt", Math.pow(2, workfactor), 20);
|
||||
var current = "";
|
||||
if (this.S && this.S("prs_password_hash_factor") == workfactor)
|
||||
{
|
||||
current = " (current)"
|
||||
}
|
||||
var tm = ((oSLNKDWF.usTimer - usStart)/1000).toFixed(0);
|
||||
if (tm > 50)
|
||||
{
|
||||
message.push("Calculating with hash_factor {0} ({1}) took {2} ms".format(workfactor, Math.pow(2, workfactor), tm));
|
||||
message.push("Calculating with hash_factor {0} ({1}) took {2} ms{3}".format(workfactor, Math.pow(2, workfactor), tm, current));
|
||||
}
|
||||
if (tm > 500)
|
||||
break;
|
||||
|
||||
@@ -30,4 +30,12 @@ Response.Clear();
|
||||
Response.Write("OK_DELETE");
|
||||
Response.End;
|
||||
}
|
||||
if (Request.QueryString("checkINSTANCE") == 1)
|
||||
{
|
||||
if (typeof Application("SET_INSTANCE_RANDOM") != "undefined")
|
||||
{
|
||||
Response.Write(Application("SET_INSTANCE_RANDOM"));
|
||||
}
|
||||
Response.End;
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -71,6 +71,12 @@ settings =
|
||||
|
||||
Application.Lock();
|
||||
|
||||
if (typeof Application("SET_INSTANCE_TIME") == "undefined")
|
||||
{
|
||||
Application("SET_INSTANCE_TIME") = new Date().getTime(); // Estimated application pool start
|
||||
Application("SET_INSTANCE_RANDOM") = shared.random(32);
|
||||
}
|
||||
|
||||
var sql = "SELECT fac_setting_name,"
|
||||
+ " fac_setting_type,"
|
||||
+ " coalesce(fac_setting_pvalue, fac_setting_default) fac_setting_value"
|
||||
|
||||
Reference in New Issue
Block a user