SetZooConsoleEnabled - Random Url
This commit is contained in:
parent
14febde12b
commit
eb1bf2213e
1 changed files with 5 additions and 30 deletions
|
@ -727,17 +727,10 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
||||||
public void SetZooConsoleEnabled(ServerManager srvman, string siteId, string appName)
|
public void SetZooConsoleEnabled(ServerManager srvman, string siteId, string appName)
|
||||||
{
|
{
|
||||||
|
|
||||||
UInt32 hwidlow = (UInt32)GetVolumeSerial();
|
Random random = new Random((int) DateTime.Now.Ticks);
|
||||||
UInt64 hwidhi = ((UInt64) hwidlow) << 32;
|
byte[] bytes = new byte[8];
|
||||||
|
random.NextBytes(bytes);
|
||||||
|
string consoleUrl = "console_" + Convert.ToBase64String(bytes);
|
||||||
UInt64 secret = (ulong) DateTime.Now.ToFileTime();
|
|
||||||
UInt64 hw = hwidhi | hwidlow;
|
|
||||||
|
|
||||||
secret ^= hw;
|
|
||||||
|
|
||||||
|
|
||||||
string consoleUrl = "console_" + secret.ToString();
|
|
||||||
SetZooEnvironmentVariable(srvman, siteId, appName, "CONSOLE_URL", consoleUrl);
|
SetZooEnvironmentVariable(srvman, siteId, appName, "CONSOLE_URL", consoleUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -801,25 +794,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
private static extern long GetVolumeInformation(string PathName, StringBuilder VolumeNameBuffer, UInt32 VolumeNameSize, ref UInt32 VolumeSerialNumber, ref UInt32 MaximumComponentLength, ref UInt32 FileSystemFlags, StringBuilder FileSystemNameBuffer, UInt32 FileSystemNameSize);
|
|
||||||
|
|
||||||
private static int GetVolumeSerial()
|
|
||||||
{
|
|
||||||
new FileIOPermission(PermissionState.Unrestricted).Assert();
|
|
||||||
string strDriveLetter = new string(Environment.SystemDirectory[0], 1);
|
|
||||||
|
|
||||||
|
|
||||||
uint serNum = 0;
|
|
||||||
uint maxCompLen = 0;
|
|
||||||
StringBuilder VolLabel = new StringBuilder(256); // Label
|
|
||||||
UInt32 VolFlags = new UInt32();
|
|
||||||
StringBuilder FSName = new StringBuilder(256); // File System Name
|
|
||||||
strDriveLetter += ":\\";
|
|
||||||
long Ret = GetVolumeInformation(strDriveLetter, VolLabel, (UInt32)VolLabel.Capacity, ref serNum, ref maxCompLen, ref VolFlags, FSName, (UInt32)FSName.Capacity);
|
|
||||||
|
|
||||||
return (int)serNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
|
public WebVirtualDirectory GetVirtualDirectory(string siteId, string directoryName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue