Bug 267542. Don't start persistent until user has a home directory.

This commit is contained in:
Jim Norman 2007-04-24 18:51:33 +00:00
parent b9373bb188
commit d6a57d3d1e
4 changed files with 56 additions and 14 deletions

View File

@ -15,6 +15,7 @@ namespace sscs.cache
private string m_filename = null; private string m_filename = null;
private byte[] m_baMP = new byte[32]; private byte[] m_baMP = new byte[32];
private byte[] m_baMPIV = new byte[32]; private byte[] m_baMPIV = new byte[32];
private byte[] m_baMPSalt = null;
private bool m_bIgnoreFileDeletes = false; private bool m_bIgnoreFileDeletes = false;
public MPFileWatcher(string MPFilePath, string MPFileName) public MPFileWatcher(string MPFilePath, string MPFileName)
@ -91,7 +92,18 @@ namespace sscs.cache
fs.Read(m_baMPIV, 0, m_baMPIV.Length); fs.Read(m_baMPIV, 0, m_baMPIV.Length);
fs.Flush(); fs.Flush();
fs.Close(); 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) catch (Exception e)
{ {
LogMessage(e.ToString()); LogMessage(e.ToString());
@ -127,6 +139,25 @@ namespace sscs.cache
{ {
LogMessage(e.ToString()); 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) private void LogMessage(string message)

View File

@ -917,18 +917,29 @@ namespace sscs.cache
return null; return null;
} }
else else
{ {
// the user might have set a different one
// load the policy file and check. string sUserHomeDir = GetUserHomeDirectory();
UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory(), GetUserName()); if (sUserHomeDir != null)
if (uiPolicy != null) {
{
string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY); // the user might have set a different one
if ((sDir != null) && (sDir.Length > 0)) // load the policy file and check.
{ UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, sUserHomeDir, GetUserName());
m_persistenceDirectory = sDir; if (uiPolicy != null)
return m_persistenceDirectory; {
} 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;
} }
} }

View File

@ -33,7 +33,7 @@ namespace sscs.common
{ {
internal class WinUser : User internal class WinUser : User
{ {
private string m_sUserHome = ""; private string m_sUserHome = null;
internal WinUser() internal WinUser()
{ {

View File

@ -444,7 +444,7 @@ namespace sscs.lss
if (createdTimeNode != null) if (createdTimeNode != null)
{ {
//Console.WriteLine("Secret create time:" + new DateTime(long.Parse(createdTimeNode.Value))); //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 else
{ {