Bug 267542. Don't start persistent until user has a home directory.
This commit is contained in:
parent
b9373bb188
commit
d6a57d3d1e
31
CASA/micasad/cache/MPFileWatcher.cs
vendored
31
CASA/micasad/cache/MPFileWatcher.cs
vendored
@ -15,6 +15,7 @@ namespace sscs.cache
|
||||
private string m_filename = null;
|
||||
private byte[] m_baMP = new byte[32];
|
||||
private byte[] m_baMPIV = new byte[32];
|
||||
private byte[] m_baMPSalt = null;
|
||||
private bool m_bIgnoreFileDeletes = false;
|
||||
|
||||
public MPFileWatcher(string MPFilePath, string MPFileName)
|
||||
@ -91,7 +92,18 @@ namespace sscs.cache
|
||||
fs.Read(m_baMPIV, 0, m_baMPIV.Length);
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
|
||||
if (File.Exists(m_dir + m_filename + ".salt"))
|
||||
{
|
||||
m_baMPSalt = new byte[64];
|
||||
fs = new FileStream(m_dir + m_filename + ".salt", FileMode.Open, FileAccess.Read);
|
||||
fs.Read(m_baMPSalt, 0, m_baMPSalt.Length);
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
LogMessage(e.ToString());
|
||||
@ -127,6 +139,25 @@ namespace sscs.cache
|
||||
{
|
||||
LogMessage(e.ToString());
|
||||
}
|
||||
|
||||
|
||||
if (m_baMPSalt != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileStream fs = new FileStream(m_dir + m_filename + ".salt", FileMode.Create);
|
||||
fs.Write(m_baMPSalt, 0, m_baMPSalt.Length);
|
||||
fs.Flush();
|
||||
fs.Close();
|
||||
|
||||
File.SetAttributes(m_dir + m_filename + ".salt", FileAttributes.Hidden);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogMessage(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LogMessage(string message)
|
||||
|
35
CASA/micasad/cache/SecretStore.cs
vendored
35
CASA/micasad/cache/SecretStore.cs
vendored
@ -917,18 +917,29 @@ namespace sscs.cache
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the user might have set a different one
|
||||
// load the policy file and check.
|
||||
UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory(), GetUserName());
|
||||
if (uiPolicy != null)
|
||||
{
|
||||
string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY);
|
||||
if ((sDir != null) && (sDir.Length > 0))
|
||||
{
|
||||
m_persistenceDirectory = sDir;
|
||||
return m_persistenceDirectory;
|
||||
}
|
||||
{
|
||||
|
||||
string sUserHomeDir = GetUserHomeDirectory();
|
||||
if (sUserHomeDir != null)
|
||||
{
|
||||
|
||||
// the user might have set a different one
|
||||
// load the policy file and check.
|
||||
UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, sUserHomeDir, GetUserName());
|
||||
if (uiPolicy != null)
|
||||
{
|
||||
string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY);
|
||||
if ((sDir != null) && (sDir.Length > 0))
|
||||
{
|
||||
m_persistenceDirectory = sDir;
|
||||
return m_persistenceDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// user not logged in yet
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace sscs.common
|
||||
{
|
||||
internal class WinUser : User
|
||||
{
|
||||
private string m_sUserHome = "";
|
||||
private string m_sUserHome = null;
|
||||
|
||||
internal WinUser()
|
||||
{
|
||||
|
@ -444,7 +444,7 @@ namespace sscs.lss
|
||||
if (createdTimeNode != null)
|
||||
{
|
||||
//Console.WriteLine("Secret create time:" + new DateTime(long.Parse(createdTimeNode.Value)));
|
||||
secret.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value), DateTimeKind.Utc).ToLocalTime();
|
||||
secret.CreatedTime = new DateTime(long.Parse(createdTimeNode.Value), DateTimeKind.Utc).ToLocalTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user