Bug#490570: Create CASA directory under

c:/Progra~1/Novell/CASA/Profiles/<userSID>/ for users who don't have home
directory defined in the system registry and grant rights to only the system
user and the CASA client user over the CASA directory.
This commit is contained in:
S Rahul 2009-05-26 06:02:34 +00:00
parent d4c128e677
commit 21ba1ead80
2 changed files with 26 additions and 2 deletions

View File

@ -1041,7 +1041,18 @@ namespace sscs.cache
if (!Directory.Exists(sNewPath)) if (!Directory.Exists(sNewPath))
{ {
string sSIDString;
string secDesc;
Directory.CreateDirectory(sNewPath); 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 = "\\"; sSeperator = "\\";

View File

@ -81,9 +81,22 @@ namespace sscs.common
CSSSLogger.DbgLog("Reading Reg: SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\" + sSIDString); 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");
if (sProfile == null) if (sProfile == null) {
CSSSLogger.DbgLog("WinUser:GetUserHomeDir get Profile return 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; m_sUserHome = sProfile;
//string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE"); //string sHomeDrive = ReadRegKey(Registry.Users, sSIDString+"\\Volatile Environment", "HOMEDRIVE");