Deploying more changes

This commit is contained in:
Rick Falkvinge
2012-11-14 23:59:40 +00:00
parent 7ccc1b2cf0
commit eb0ca6752d
2 changed files with 19 additions and 11 deletions
-6
View File
@@ -96,8 +96,6 @@
} else {
// Config is NOT writable. Keep the error on-screen and keep re-checking every two seconds.
alert('setting first timeout function');
setTimeout('recheckConfigurationWritability();', 5000); // 5s until first re-check
}
}
@@ -137,8 +135,6 @@
function recheckConfigurationWritability() {
alert('In timeout function');
$.ajax({
type: "POST",
url: "Default.aspx/IsConfigurationFileWritable",
@@ -149,8 +145,6 @@
success: function (msg) {
if (msg.d == true) {
alert('yes, writable');
// Yes, config is writable. Hide "unwritable" div, show "writable" div, all is nice
$('#DivDatabaseUnwritable').slideUp('fast').fadeOut('fast');
$('#DivDatabaseWritable').fadeIn('fast');
+19 -5
View File
@@ -294,9 +294,21 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page
[WebMethod]
public static bool VerifyHostName(string input)
{
if (System.Diagnostics.Debugger.IsAttached)
{
return true; // Cannot read "/etc/hostname" in Windows environment
}
// validate against /etc/hostname
if (input == "/etc/hostname")
string realHostName;
using (TextReader reader = new StreamReader("/etc/hostname")) // This will throw in a Windows dev environment
{
realHostName = reader.ReadLine();
}
if (String.Compare(input, realHostName, true, CultureInfo.InvariantCulture) == 0) // case-insensitive compare
{
return true;
}
@@ -304,10 +316,12 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page
return false;
}
[WebMethod]
[WebMethod(true)]
public static bool VerifyHostAddress (string input)
{
if (input == "127.0.0.1")
string localAddress = HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"];
if (input == localAddress)
{
return true;
}
@@ -315,7 +329,7 @@ public partial class Pages_v5_Init_Default : System.Web.UI.Page
return false;
}
[WebMethod]
[WebMethod(true)]
public static bool VerifyHostNameAndAddress (string name, string address)
{
return VerifyHostName(name) && VerifyHostAddress(address);