Fix persistent issues
This commit is contained in:
parent
7500c9b1dd
commit
7d793edf1d
10
c_micasad/cache/SecretStore.cs
vendored
10
c_micasad/cache/SecretStore.cs
vendored
@ -117,6 +117,15 @@ namespace sscs.cache
|
|||||||
|
|
||||||
internal bool StartPersistenceByDesktopPasswd(string desktopPasswd)
|
internal bool StartPersistenceByDesktopPasswd(string desktopPasswd)
|
||||||
{
|
{
|
||||||
|
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Called");
|
||||||
|
// make sure we have a user home directory
|
||||||
|
if (GetUserHomeDirectory() == null || GetUserHomeDirectory().Length < 1)
|
||||||
|
{
|
||||||
|
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - No Home directory yet");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] baPasscode;
|
byte[] baPasscode;
|
||||||
@ -137,6 +146,7 @@ namespace sscs.cache
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
CSSSLogger.DbgLog(CSSSLogger.GetExecutionPath(this) + " Store is already persistent");
|
CSSSLogger.DbgLog(CSSSLogger.GetExecutionPath(this) + " Store is already persistent");
|
||||||
|
CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Started");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +130,14 @@ namespace sscs.common
|
|||||||
{
|
{
|
||||||
User user = (User)sessionTable[userId];
|
User user = (User)sessionTable[userId];
|
||||||
SecretStore ss = user.GetSecretStore();
|
SecretStore ss = user.GetSecretStore();
|
||||||
|
// start persistent if not going yet
|
||||||
|
if (!ss.IsStorePersistent())
|
||||||
|
{
|
||||||
|
string sDesktopPWD = ss.GetDesktopPasswd();
|
||||||
|
if (sDesktopPWD != null)
|
||||||
|
ss.StartPersistenceByDesktopPasswd(sDesktopPWD);
|
||||||
|
}
|
||||||
|
|
||||||
mutex.ReleaseMutex();
|
mutex.ReleaseMutex();
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,10 @@ namespace sscs.common
|
|||||||
*/
|
*/
|
||||||
override internal string GetUserHomeDir()
|
override internal string GetUserHomeDir()
|
||||||
{
|
{
|
||||||
|
CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Entered");
|
||||||
if (m_sUserHome.Length < 1)
|
if (m_sUserHome == null || m_sUserHome.Length < 1)
|
||||||
{
|
{
|
||||||
|
CSSSLogger.DbgLog("WinUser:GetUserHomeDir is empty");
|
||||||
//Console.WriteLine("read registry");
|
//Console.WriteLine("read registry");
|
||||||
// get the users home drive and homepath from the registry
|
// get the users home drive and homepath from the registry
|
||||||
//
|
//
|
||||||
@ -47,8 +48,13 @@ namespace sscs.common
|
|||||||
|
|
||||||
// look up Profile path
|
// look up Profile path
|
||||||
// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1757981266-436374069-725345543-1006]
|
// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-1757981266-436374069-725345543-1006]
|
||||||
|
CSSSLogger.DbgLog("Reading Reg: SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString);
|
||||||
string sProfile = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString, "ProfileImagePath");
|
string sProfile = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString, "ProfileImagePath");
|
||||||
m_sUserHome = sProfile;
|
|
||||||
|
if (sProfile == null)
|
||||||
|
CSSSLogger.DbgLog("WinUser:GetUserHomeDir get Profile return null");
|
||||||
|
else
|
||||||
|
m_sUserHome = sProfile;
|
||||||
|
|
||||||
//string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE");
|
//string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE");
|
||||||
//string sHomeDir = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEPATH");
|
//string sHomeDir = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEPATH");
|
||||||
@ -56,6 +62,8 @@ namespace sscs.common
|
|||||||
//Console.WriteLine("Homedir: "+ m_sUserHome);
|
//Console.WriteLine("Homedir: "+ m_sUserHome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSSSLogger.DbgLog("WinUser:GetUserHomeDir - Exited: "+m_sUserHome);
|
||||||
|
|
||||||
return m_sUserHome;
|
return m_sUserHome;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,14 @@ namespace sscs.common
|
|||||||
this.uidHigh = uidHighPart;
|
this.uidHigh = uidHighPart;
|
||||||
this.m_sSID = sSID;
|
this.m_sSID = sSID;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal WinUserIdentifier(int uidLowPart, int uidHighPart)
|
internal WinUserIdentifier(int uidLowPart, int uidHighPart)
|
||||||
{
|
{
|
||||||
this.uidLow = uidLowPart;
|
this.uidLow = uidLowPart;
|
||||||
this.uidHigh = uidHighPart;
|
this.uidHigh = uidHighPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal string GetSID()
|
internal string GetSID()
|
||||||
{
|
{
|
||||||
return m_sSID;
|
return m_sSID;
|
||||||
@ -29,7 +31,16 @@ namespace sscs.common
|
|||||||
{
|
{
|
||||||
WinUserIdentifier u = (WinUserIdentifier)obj;
|
WinUserIdentifier u = (WinUserIdentifier)obj;
|
||||||
if ((u.uidLow == uidLow) && (u.uidHigh == uidHigh))
|
if ((u.uidLow == uidLow) && (u.uidHigh == uidHigh))
|
||||||
|
{
|
||||||
|
// we have a match, set the SID if we can
|
||||||
|
if ((this.m_sSID.Length < 1) && (u.GetSID().Length>0))
|
||||||
|
{
|
||||||
|
CSSSLogger.DbgLog("******** WinUserIdentifier: Updating the SID *********");
|
||||||
|
this.m_sSID = u.GetSID();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user