diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index bdf806d2..6e5084cc 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -1041,7 +1041,18 @@ namespace sscs.cache if (!Directory.Exists(sNewPath)) { + string sSIDString; + string secDesc; + Directory.CreateDirectory(sNewPath); + + /* Give permissions to the user and system account */ + sSIDString = ((WinUserIdentifier)user.UserIdentifier).GetSID(); + System.Security.AccessControl.DirectorySecurity dirSec = Directory.GetAccessControl(sNewPath); + secDesc = "D:P(A;ID;GA;;;SY)(A;ID;GA;;;" + sSIDString + ")"; + System.Diagnostics.Trace.WriteLine("Setting security descriptor" + secDesc); + dirSec.SetSecurityDescriptorSddlForm(secDesc); + Directory.SetAccessControl(sNewPath, dirSec); } sSeperator = "\\"; diff --git a/CASA/micasad/common/WinUser.cs b/CASA/micasad/common/WinUser.cs index 25c0bc6c..bf7c5de7 100644 --- a/CASA/micasad/common/WinUser.cs +++ b/CASA/micasad/common/WinUser.cs @@ -81,9 +81,22 @@ namespace sscs.common CSSSLogger.DbgLog("Reading Reg: SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString); string sProfile = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString, "ProfileImagePath"); - if (sProfile == null) + if (sProfile == null) { CSSSLogger.DbgLog("WinUser:GetUserHomeDir get Profile return null"); - else + if (sSIDString.Equals("S-1-5-18")) { + // Bug#490570 + string programFiles; + programFiles = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir"); + if (programFiles == null) { + programFiles = ReadRegKey(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFiles"); + } + if (programFiles == null) { + CSSSLogger.DbgLog("WinUser:GetUserHomeDir unable to read program files path"); + } else { + m_sUserHome = programFiles + "\\Novell\\CASA\\profiles\\S-1-5-18"; + } + } + } else m_sUserHome = sProfile; //string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE");