diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index 947779a1..cc8b254a 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -2184,39 +2184,14 @@ namespace Novell.CASA.GUI if ((sOldDirectory != null) && (sNewDirectory != null)) { if (!sOldDirectory.Equals(sNewDirectory)) - { - // get file list for .miCASAFiles - string[] files = Directory.GetFiles(sOldDirectory, ".miCASA*"); - if (files != null) - { - string sFileSeperator; - if (Common.IS_WINDOWS) - sFileSeperator = "\\"; - else - sFileSeperator = "/"; - - // first copy them to the new location - foreach ( string file in files) - { - string sFileName = file.Substring(file.LastIndexOf(sFileSeperator) + 1); - File.Copy(file, sNewDirectory + sFileName, true); - } - - // TODO: tell our daemon/service we changed the location - ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory); - cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd); - - // now delete them from the old directory - foreach (string file in files) - { - File.Delete(file); - } - + { + // instruct our daemon/service to change the location + ChangePersistentDir cpd = new ChangePersistentDir(sOldDirectory, sNewDirectory); + cpd = (ChangePersistentDir)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR, cpd); + if (cpd.GetErrorMessage().Equals("Success")) return true; - } } } - return false; } diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs index f55a28e4..aae1b6bb 100644 --- a/CASA/gui/Common.cs +++ b/CASA/gui/Common.cs @@ -143,10 +143,8 @@ public class Common public static string CONFIG_RUN_IN_TRAY = "RunInTray"; public static string CONFIG_DISPLAY_CASA_MANAGER = "DisplayCasaManagerOnClick"; public static string CONFIG_PERSISTENT_DIRECTORY = "PersistentDirectory"; - public static string CONFIG_PERSIST_SECRETS = "PersistSecrets"; - public static string CONFIG_DECRYPT_USING_DESKTOP_PASS = "DecryptUsingDesktopPassword"; + public static string CONFIG_PERSIST_SECRETS = "PersistSecrets"; - ///############################################################# ///CasaIcons path diff --git a/CASA/gui/FileChooser.cs b/CASA/gui/FileChooser.cs index 7b78d1bc..15f5b1eb 100644 --- a/CASA/gui/FileChooser.cs +++ b/CASA/gui/FileChooser.cs @@ -111,7 +111,17 @@ namespace Novell.CASA.GUI if (m_sFileSelected != null) { - if (m_iAction != FileChooser.ACTION_CHOOSE_DIR) + + if (m_iAction == FileChooser.ACTION_CHOOSE_DIR) + { + string sDirectory = m_currentDirectory + m_sFileSelected; + if (sDirectory.EndsWith(m_pathSeparator)) + { + sDirectory = sDirectory.Substring(0, sDirectory.Length - 1); + } + return sDirectory; + } + else { // is there a filter? if (m_currentFilter.Length > 0) @@ -127,7 +137,8 @@ namespace Novell.CASA.GUI } } } - + + return m_currentDirectory + m_sFileSelected; } diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index 9176b353..ef779670 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -181,15 +181,6 @@ namespace sscs.cache { CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Called"); - UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory()); - string sShouldUseDesktop = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_DECRYPT_USING_DESKTOP_PASS); - - if ((sShouldUseDesktop != null) && (sShouldUseDesktop.Equals("0"))) - { - CSSSLogger.DbgLog("Policy set: Did not start persistent by Desktop Password"); - return false; - } - // make sure we have a Persistence Directory if (GetPersistenceDirectory() == null || GetPersistenceDirectory().Length < 1) { @@ -824,7 +815,7 @@ namespace sscs.cache // reset the FileWatcher if (mpWatcher != null) { - mpWatcher.pauseWatcher(); + mpWatcher.pauseWatcher(); mpWatcher = new MPFileWatcher(sNewDirectory, ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE); mpWatcher.resumeWatcher(); } diff --git a/CASA/micasad/common/UnixUser.cs b/CASA/micasad/common/UnixUser.cs index e1b79fef..d3ea7ebf 100644 --- a/CASA/micasad/common/UnixUser.cs +++ b/CASA/micasad/common/UnixUser.cs @@ -57,7 +57,8 @@ namespace sscs.common override internal string GetUserHomeDir() { uint uid = (uint)userId.GetUID(); - Mono.Unix.UnixUserInfo uui = new Mono.Unix.UnixUserInfo(uid); + Mono.Unix.UnixUserInfo uui = new Mono.Unix.UnixUserInfo(uid); + userName = uui.UserName; return uui.HomeDirectory; } diff --git a/CASA/micasad/verbs/ObjectSerialization.cs b/CASA/micasad/verbs/ObjectSerialization.cs index d6da5f62..0258435d 100644 --- a/CASA/micasad/verbs/ObjectSerialization.cs +++ b/CASA/micasad/verbs/ObjectSerialization.cs @@ -254,17 +254,44 @@ namespace sscs.verbs private WrappedObject DoChangePersistentDir(SecretStore ssStore, WrappedObject wo) { + CSSSLogger.ExecutionTrace(this); ChangePersistentDir cpd = (ChangePersistentDir)wo.GetObject(); string sOldDir = cpd.GetOldDirectory(); string sNewDir = cpd.GetNewDirectory(); + + // copy all .miCASA* files to new location + string[] files = Directory.GetFiles(sOldDir, ".miCASA*"); + if (files != null) + { + string sFileSeperator; +#if W32 + sFileSeperator = "\\"; +#else + sFileSeperator = "/"; +#endif + + // first copy them to the new location + foreach ( string file in files) + { + string sFileName = file.Substring(file.LastIndexOf(sFileSeperator)); + File.Copy(file, sNewDir + sFileName, true); + } - if (ssStore.SetPeristenceDirectory(sNewDir)) - { - cpd.SetErrorMessage("Success"); - } - else - { - cpd.SetErrorMessage("Error: Changing directory failed"); + // update filewatcher + if (ssStore.SetPeristenceDirectory(sNewDir)) + { + cpd.SetErrorMessage("Success"); + } + else + { + cpd.SetErrorMessage("Error: Changing directory failed"); + } + + // now delete them from the old directory + foreach (string file in files) + { + File.Delete(file); + } } return wo;