diff --git a/CASA/gui/CASAManager.csproj b/CASA/gui/CASAManager.csproj index 88df2db2..ad8001fb 100644 --- a/CASA/gui/CASAManager.csproj +++ b/CASA/gui/CASAManager.csproj @@ -185,6 +185,11 @@ SubType = "Code" BuildAction = "Compile" /> + + /// ******************************************************************** + /// Import/export handlers + /// ******************************************************************** + /// public void on_exportSecrets_activate(object obj, EventArgs args) { @@ -2099,6 +2129,61 @@ namespace Novell.CASA.GUI } + public void on_buttonChooseDirectory_clicked(object obj, EventArgs args) + { + //Choose directory for persistent storage + FileChooser fc = new FileChooser(FileChooser.ACTION_CHOOSE_DIR); + string sDirectory = fc.GetFile(entryStorageDirectory.Text, null); + + // show the user the directory choosen + if (sDirectory != null) + { + if (Directory.Exists(sDirectory)) + { + entryStorageDirectory.Text = sDirectory; + } + else + { + CommonGUI.DisplayMessage(Gtk.MessageType.Error, "Directory does not exist\r\n" + sDirectory); + } + } + } + + private bool MoveMiCASAFiles(string sOldDirectory, string sNewDirectory) + { + if ((sOldDirectory != null) && (sNewDirectory != null)) + { + if (!sOldDirectory.Equals(sNewDirectory)) + { + // get file list for .miCASAFiles + string[] files = Directory.GetFiles(sOldDirectory, ".miCASA*"); + if (files != null) + { + // first copy them to the new location + foreach ( string file in files) + { + string sFileName = file.Substring(file.LastIndexOf("\\") + 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); + } + + return true; + } + } + } + + return false; + } + /// /// ******************************************************************** /// private void HandleQuit() @@ -2153,7 +2238,12 @@ namespace Novell.CASA.GUI Logger.DbgLog("GUI:CasaMain.OnWindowMainDeleted() - END"); } - + + public void on_debug_file_chooser_activate(object obj, EventArgs args) + { + DbgFileChooser dbf = new DbgFileChooser(); + dbf.Run(); + } } } diff --git a/CASA/gui/Common.cs b/CASA/gui/Common.cs index 0a3e1c1d..69965e73 100644 --- a/CASA/gui/Common.cs +++ b/CASA/gui/Common.cs @@ -138,8 +138,11 @@ public class Common public static string ARG_SHOW_TRAY_ICON = "-tray"; public static string ARG_DEBUG = "-debug"; + // config settings public static string CONFIG_RUN_IN_TRAY = "RunInTray"; public static string DISPLAY_CASA_MANAGER = "DisplayCasaManagerOnClick"; + public static string CONFIG_PERSISTENT_DIRECTORY = "PersistentDirectory"; + ///############################################################# @@ -439,6 +442,16 @@ public class Common return Environment.GetEnvironmentVariable("USERPROFILE"); } + internal static string GetUserPersistentDir(Config config) + { + return (config.GetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, GetUserHomeDir())); + } + + internal static void SetUserPersistentDir(Config config, string sNewDirectory) + { + config.SetConfigSetting(CONFIG_PERSISTENT_DIRECTORY, sNewDirectory); + config.WriteConfig(); + } } } diff --git a/CASA/gui/DbgFileChooser.cs b/CASA/gui/DbgFileChooser.cs new file mode 100644 index 00000000..a0e3c873 --- /dev/null +++ b/CASA/gui/DbgFileChooser.cs @@ -0,0 +1,78 @@ +using System; + +namespace Novell.CASA.GUI +{ + /// + /// Summary description for DbgFileChooser. + /// + public class DbgFileChooser + { + #region widgets + [Glade.Widget] + Gtk.Dialog dialogDebugFileChooser; + + [Glade.Widget] + Gtk.Entry entrySaveFile, + entryOpenFile, + entryChooseDirectory; + + + #endregion + + public DbgFileChooser() + { + + } + + public void Run() + { + Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogDebugFileChooser", null); + gxmlTemp.Autoconnect (this); + //dialogDebugFileChooser.TransientFor = windowMain; + } + + public void on_buttonSaveFile_clicked(object obj, EventArgs args) + { + FileChooser fc = new FileChooser(FileChooser.ACTION_SAVE); + string sFile = fc.GetFile(null, null); + if (sFile != null) + { + entrySaveFile.Text = sFile; + } + else + { + entrySaveFile.Text = "Null"; + } + + } + + public void on_buttonOpenFile_clicked(object obj, EventArgs args) + { + FileChooser fc = new FileChooser(FileChooser.ACTION_OPEN); + string sFile = fc.GetFile(null, null); + if (sFile != null) + { + entryOpenFile.Text = sFile; + } + else + { + entryOpenFile.Text = "Null"; + } + } + public void on_buttonChooseDirectory_clicked(object obj, EventArgs args) + { + FileChooser fc = new FileChooser(FileChooser.ACTION_CHOOSE_DIR); + string sFile = fc.GetFile(null, null); + if (sFile != null) + { + entryChooseDirectory.Text = sFile; + } + else + { + entryChooseDirectory.Text = "Null"; + } + } + + + } +} diff --git a/CASA/gui/FileChooser.cs b/CASA/gui/FileChooser.cs index 2ba65b3e..8a4b7821 100644 --- a/CASA/gui/FileChooser.cs +++ b/CASA/gui/FileChooser.cs @@ -25,6 +25,7 @@ namespace Novell.CASA.GUI private int m_iAction = 1; public const int ACTION_OPEN = 1; public const int ACTION_SAVE = 2; + public const int ACTION_CHOOSE_DIR = 3; Thread tChooserThread = null; @@ -72,6 +73,8 @@ namespace Novell.CASA.GUI else m_currentDirectory = dir; + if (!m_currentDirectory.EndsWith(m_pathSeparator)) + m_currentDirectory = m_currentDirectory + m_pathSeparator; //if (m_currentDirectory.EndsWith(m_pathSeparator)) // m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1); @@ -92,16 +95,18 @@ namespace Novell.CASA.GUI m_hintFile = sHintFile; } - DoWork(); + DisplayChooser(); if (m_sFileSelected != null) - return m_currentDirectory + m_pathSeparator + m_sFileSelected; + { + return m_currentDirectory + m_sFileSelected; + } else return null; } - private void DoWork() + private void DisplayChooser() { // display chooser @@ -140,7 +145,13 @@ namespace Novell.CASA.GUI Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogFileChooser", null); gxmlTemp.Autoconnect(this); - if (m_iAction == ACTION_OPEN) + if (m_iAction == ACTION_CHOOSE_DIR) + { + entrySelectedFile.Visible = false; + dialogFileChooser.Title = "Select a directory"; + + } + else if (m_iAction == ACTION_OPEN) { buttonNewFolder.Visible = false; entrySelectedFile.Sensitive = false; @@ -208,11 +219,14 @@ namespace Novell.CASA.GUI ts.AppendValues(new Gdk.Pixbuf (Common.IMAGE_PATH + "folder.png"), dirs[i].Name, "", "File folder"); } - FileInfo[] files = dirInfo.GetFiles(); - for (int i=0; i 0)) + m_sFileSelected = entrySelectedFile.Text + m_pathSeparator; + else + m_sFileSelected = ""; + + // destroy dialog + dialogFileChooser.Destroy(); + m_bFileChoosing = false; + } + else + { + ProcessSelection(); + } } diff --git a/CASA/gui/images/casa.glade b/CASA/gui/images/casa.glade index 5b45180d..46f69153 100644 --- a/CASA/gui/images/casa.glade +++ b/CASA/gui/images/casa.glade @@ -56,7 +56,7 @@ True - + True gtk-new 1 @@ -78,7 +78,7 @@ - + True gtk-new 1 @@ -99,7 +99,7 @@ - + True gtk-new 1 @@ -125,7 +125,7 @@ - + True gtk-refresh 1 @@ -152,7 +152,7 @@ - + True gtk-dialog-authentication 1 @@ -173,7 +173,7 @@ - + True gtk-open 1 @@ -194,7 +194,7 @@ - + True gtk-delete 1 @@ -221,7 +221,7 @@ - + True gtk-floppy 1 @@ -242,7 +242,7 @@ - + True gtk-open 1 @@ -270,7 +270,7 @@ - + True gtk-quit 1 @@ -306,7 +306,7 @@ - + True gtk-zoom-fit 1 @@ -327,7 +327,7 @@ - + True gtk-jump-to 1 @@ -348,7 +348,7 @@ - + True gtk-copy 1 @@ -376,7 +376,7 @@ - + True gtk-delete 1 @@ -410,7 +410,7 @@ True - + True gtk-execute 1 @@ -432,7 +432,7 @@ - + True gtk-execute 1 @@ -453,7 +453,7 @@ - + True gtk-execute 1 @@ -474,7 +474,7 @@ - + True gtk-execute 1 @@ -495,7 +495,7 @@ - + True gtk-execute 1 @@ -520,7 +520,7 @@ - + True gtk-revert-to-saved 1 @@ -547,7 +547,7 @@ - + True gtk-preferences 1 @@ -581,7 +581,7 @@ - + True gtk-add 1 @@ -602,7 +602,7 @@ - + True gtk-remove 1 @@ -621,6 +621,21 @@ + + + True + Debug File Chooser + True + + + + + + + True + + + True @@ -653,7 +668,7 @@ - + True gtk-help 1 @@ -680,7 +695,7 @@ - + True gtk-dialog-info 1 @@ -4729,7 +4744,140 @@ prompted for the Master Password at startup. 0 - True + False + True + + + + + + 6 + True + 0 + 0.5 + GTK_SHADOW_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + 4 + True + False + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + True + True + True + 0 + + True + * + False + + + 3 + True + True + + + + + + True + True + GTK_RELIEF_NORMAL + False + + + + + True + gtk-find + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + + + + + True + <b> miCASA Storage Location </b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + False True @@ -4858,7 +5006,7 @@ prompted for the Master Password at startup. 0 - True + False True @@ -12999,4 +13147,449 @@ to encrypt this file + + True + CASA - Debug File chooser + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + True + True + CASAicons.ico + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-help + True + GTK_RELIEF_NONE + True + -11 + + + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + True + gtk-dialog-authentication + 6 + 0.5 + 0.5 + 0 + 0 + + + 4 + False + True + + + + + 4 + True + True + + + + + + True + False + 0 + + + + True + <b>Debug file Chooser</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 4 + False + False + + + + + + True + This will be removed + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 4 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + 6 + True + 0 + 0.5 + GTK_SHADOW_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 12 + 0 + + + + True + 3 + 3 + False + 0 + 0 + + + + True + Save File + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Open File + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Choose Directory + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + Save As... + True + GTK_RELIEF_NORMAL + True + + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + True + Open file + True + GTK_RELIEF_NORMAL + True + + + + 2 + 3 + 1 + 2 + fill + + + + + + + True + True + Choose Dir + True + GTK_RELIEF_NORMAL + True + + + + 2 + 3 + 2 + 3 + fill + + + + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index 0b35f64e..65bcb96b 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -34,6 +34,8 @@ using sscs.constants; using sscs.lss; using sscs.crypto; +using Novell.CASA.CASAPolicy; + namespace sscs.cache { class SecretStore @@ -54,6 +56,7 @@ namespace sscs.cache private LocalStorage lss = null; bool bIsStorePersistent = false; + string m_persistenceDirectory = null; private MPFileWatcher mpWatcher = null; @@ -86,17 +89,18 @@ namespace sscs.cache ssMutex = new Mutex(); + + // start a MPFileWatcher if necessary if (mpWatcher == null) { - // make sure HomeDirectory exists - String sHomeDir = GetUserHomeDirectory(); - if (sHomeDir != null && sHomeDir.Length > 0) + // make sure Persistence Directory exists + String sPersistentDir = GetPersistenceDirectory(); + if (sPersistentDir != null && sPersistentDir.Length > 0) { - mpWatcher = new MPFileWatcher(GetUserHomeDirectory(), ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE); + mpWatcher = new MPFileWatcher(GetPersistenceDirectory(), ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE); } } - } internal bool IsStorePersistent() @@ -177,17 +181,19 @@ namespace sscs.cache { CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Called"); - // make sure we have a user home directory - if (GetUserHomeDirectory() == null || GetUserHomeDirectory().Length < 1) + // make sure we have a Persistence Directory + if (GetPersistenceDirectory() == null || GetPersistenceDirectory().Length < 1) { - CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - No Home directory yet"); + CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - No Peristence directory yet"); + CSSSLogger.DbgLog("Directory: [" + GetPersistenceDirectory() + "]"); return false; } else { - if (!Directory.Exists(GetUserHomeDirectory())) + if (!Directory.Exists(GetPersistenceDirectory())) { - CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Home directory is not created yet"); + CSSSLogger.DbgLog("StartPersistenceByDesktopPasswd - Peristence directory is not created yet"); + CSSSLogger.DbgLog("Directory: " + GetPersistenceDirectory() + "]"); return false; } } @@ -777,33 +783,82 @@ namespace sscs.cache return user.GetUserHomeDir(); } + internal string GetPersistenceDirectory() + { + if (m_persistenceDirectory != null) + { + if (Directory.Exists(m_persistenceDirectory)) + return m_persistenceDirectory; + else + return null; + } + else + { + // the user might have set a different one + // load the policy file and check. + UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory()); + string sDir = uiPolicy.GetConfigSetting("PersistentDirectory"); + if ((sDir != null) && (sDir.Length > 0)) + { + m_persistenceDirectory = sDir; + return m_persistenceDirectory; + } + } + + return GetUserHomeDirectory(); + } + + internal bool SetPeristenceDirectory(string sNewDirectory) + { + if (Directory.Exists(sNewDirectory)) + { + // reset the FileWatcher + if (mpWatcher != null) + { + mpWatcher.pauseWatcher(); + mpWatcher = new MPFileWatcher(sNewDirectory, ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE); + mpWatcher.resumeWatcher(); + } + + m_persistenceDirectory = sNewDirectory; + return true; + } + + return false; + + } + internal string GetKeyFilePath() { - string homeDir = GetUserHomeDirectory(); - return homeDir + ConstStrings.MICASA_KEY_FILE; + string persistDir = GetPersistenceDirectory(); + return persistDir + ConstStrings.MICASA_KEY_FILE; } internal string GetPasscodeByDesktopFilePath() { - string homeDir = GetUserHomeDirectory(); - return homeDir + ConstStrings.MICASA_PASSCODE_BY_DESKTOP_FILE; + string persistDir = GetPersistenceDirectory(); + return persistDir + ConstStrings.MICASA_PASSCODE_BY_DESKTOP_FILE; } internal string GetPasscodeByMasterPasswdFilePath() { - string homeDir = GetUserHomeDirectory(); - return homeDir + ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE; + string persistDir = GetPersistenceDirectory(); + return persistDir + ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE; } internal string GetPersistenceFilePath() { - string homeDir = GetUserHomeDirectory(); - return homeDir + ConstStrings.MICASA_PERSISTENCE_FILE; + string persistDir = GetPersistenceDirectory(); + return persistDir + ConstStrings.MICASA_PERSISTENCE_FILE; } internal string GetValidationFilePath() { - string homeDir = GetUserHomeDirectory(); - return homeDir + ConstStrings.MICASA_VALIDATION_FILE; + string persistDir = GetPersistenceDirectory(); + return persistDir + ConstStrings.MICASA_VALIDATION_FILE; } + + + + internal byte[] GetSecrets(string sEncryptionString) { if (lss != null) @@ -848,5 +903,7 @@ namespace sscs.cache lss.AddXMLSecretsToStore(doc); } } + + } } diff --git a/CASA/micasad/common/SessionManager.cs b/CASA/micasad/common/SessionManager.cs index a72239d3..14494a7d 100644 --- a/CASA/micasad/common/SessionManager.cs +++ b/CASA/micasad/common/SessionManager.cs @@ -101,20 +101,26 @@ namespace sscs.common try { mutex.WaitOne(); - SecretStore ss = GetUserSecretStore(userId); - ss.DecrRefCount(); - - // We must keep the cache alive, and destroy it on - // a logout event - - //if( 0 == ss.refCount ) - if (destroySession) + try { - CSSSLogger.DbgLog("Removing the user session of " + userId.GetUID()); - ss.CommitStore(); - sessionTable.Remove(userId); - } + SecretStore ss = GetUserSecretStore(userId); + ss.DecrRefCount(); + // We must keep the cache alive, and destroy it on + // a logout event + + //if( 0 == ss.refCount ) + if (destroySession) + { + CSSSLogger.DbgLog("Removing the user session of " + userId.GetUID()); + ss.CommitStore(); + sessionTable.Remove(userId); + } + } + catch (Exception e) + { + CSSSLogger.DbgLog(e.ToString()); + } mutex.ReleaseMutex(); return true; } @@ -193,7 +199,9 @@ namespace sscs.common internal static void ListActiveUserSessions() { CSSSLogger.ExecutionTrace(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + CSSSLogger.DbgLog("List Active Sessions"); mutex.WaitOne(); + CSSSLogger.DbgLog("List Active Sessions2"); IDictionaryEnumerator etor = sessionTable.GetEnumerator(); int i = 0; @@ -206,7 +214,9 @@ namespace sscs.common Console.WriteLine((((SecretStore)(etor.Value)).secretStoreName + ":" + ((SecretStore)(etor.Value)).refCount); */ } + CSSSLogger.DbgLog("List Active Sessions3"); mutex.ReleaseMutex(); + CSSSLogger.DbgLog("List Active Sessions4"); } diff --git a/CASA/micasad/lib/Novell.CASA.Common.csproj b/CASA/micasad/lib/Novell.CASA.Common.csproj index c849869c..f8b4257a 100644 --- a/CASA/micasad/lib/Novell.CASA.Common.csproj +++ b/CASA/micasad/lib/Novell.CASA.Common.csproj @@ -98,6 +98,11 @@ SubType = "Code" BuildAction = "Compile" /> + + /// Summary description for ChangePersistentDir. + /// + /// + [Serializable] + public class ChangePersistentDir + { + private string m_sOldDirectory; + private string m_sNewDirectory; + private string m_sErrorMessage = ""; + + public ChangePersistentDir(string sOldDirectory, string sNewDirectory) + { + m_sOldDirectory = sOldDirectory; + m_sNewDirectory = sNewDirectory; + } + + public string GetOldDirectory() + { + return m_sOldDirectory; + } + + public string GetNewDirectory() + { + return m_sNewDirectory; + } + + public void SetErrorMessage(string sMessage) + { + m_sErrorMessage = sMessage; + } + + public string GetErrorMessage() + { + return m_sErrorMessage; + } + } +} diff --git a/CASA/micasad/lib/communication/MiCasaRequestReply.cs b/CASA/micasad/lib/communication/MiCasaRequestReply.cs index 4d5e1bd0..8659b241 100644 --- a/CASA/micasad/lib/communication/MiCasaRequestReply.cs +++ b/CASA/micasad/lib/communication/MiCasaRequestReply.cs @@ -58,6 +58,7 @@ namespace Novell.CASA.MiCasa.Communication public const int VERB_VALIDATE_DESKTOP_PWD = 20; public const int VERB_EXPORT_SECRETS = 21; public const int VERB_ADD_XML_SECRETS = 22; + public const int VERB_CHANGE_PERSIST_DIR = 23; public const int VERB_DUMP_LINKED_KEYS = 96; public const int VERB_CREATE_TEST_SECRETS = 97; diff --git a/CASA/micasad/micasad.csproj b/CASA/micasad/micasad.csproj index f055a87c..1b2013c8 100644 --- a/CASA/micasad/micasad.csproj +++ b/CASA/micasad/micasad.csproj @@ -129,6 +129,11 @@ Project = "{57CD94A2-5B4A-40C3-8189-CB760FB78357}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + diff --git a/CASA/micasad/verbs/ObjectSerialization.cs b/CASA/micasad/verbs/ObjectSerialization.cs index 0b6f54c9..d6da5f62 100644 --- a/CASA/micasad/verbs/ObjectSerialization.cs +++ b/CASA/micasad/verbs/ObjectSerialization.cs @@ -227,6 +227,10 @@ namespace sscs.verbs { return DoMergeXMLSecrets(ssStore, wo); } + case MiCasaRequestReply.VERB_CHANGE_PERSIST_DIR: + { + return DoChangePersistentDir(ssStore, wo); + } default: { @@ -239,11 +243,33 @@ namespace sscs.verbs { wo.SetError(constants.RetCodes.FAILURE, e.ToString()); } - - ssStore.ResumeFileWatcher(); + finally + { + ssStore.ResumeFileWatcher(); + } + return wo; } + + private WrappedObject DoChangePersistentDir(SecretStore ssStore, WrappedObject wo) + { + ChangePersistentDir cpd = (ChangePersistentDir)wo.GetObject(); + string sOldDir = cpd.GetOldDirectory(); + string sNewDir = cpd.GetNewDirectory(); + + if (ssStore.SetPeristenceDirectory(sNewDir)) + { + cpd.SetErrorMessage("Success"); + } + else + { + cpd.SetErrorMessage("Error: Changing directory failed"); + } + + return wo; + } + private WrappedObject DoMergeXMLSecrets(SecretStore ssStore, WrappedObject wo) { ImportXMLSecrets addSecrets = (ImportXMLSecrets)wo.GetObject(); @@ -262,7 +288,7 @@ namespace sscs.verbs int iBytes = fs.Read(baXMLSecrets, 0, (int)fs.Length); fs.Flush(); - fs.Close(); + fs.Close(); } } catch (Exception e) @@ -287,6 +313,10 @@ namespace sscs.verbs // do the merge now. ssStore.MergeXMLSecrets(baXMLSecrets); } + + // persist em + ssStore.CommitStore(); + addSecrets.SetStatus("Success"); wo.SetError(constants.RetCodes.SUCCESS, ""); } diff --git a/CASA/package/windows/vs_solutions/CASAInstall/CASA.ncb b/CASA/package/windows/vs_solutions/CASAInstall/CASA.ncb index a416619d..49b6ecc2 100644 Binary files a/CASA/package/windows/vs_solutions/CASAInstall/CASA.ncb and b/CASA/package/windows/vs_solutions/CASAInstall/CASA.ncb differ diff --git a/CASA/package/windows/vs_solutions/CASAInstall/CASA.suo b/CASA/package/windows/vs_solutions/CASAInstall/CASA.suo index 6ef73979..da15791b 100644 Binary files a/CASA/package/windows/vs_solutions/CASAInstall/CASA.suo and b/CASA/package/windows/vs_solutions/CASAInstall/CASA.suo differ diff --git a/CASA/package/windows/vs_solutions/CASAInstall/CASA.vdproj b/CASA/package/windows/vs_solutions/CASAInstall/CASA.vdproj index 587ecd08..5093dc00 100644 --- a/CASA/package/windows/vs_solutions/CASAInstall/CASA.vdproj +++ b/CASA/package/windows/vs_solutions/CASAInstall/CASA.vdproj @@ -21,12 +21,30 @@ } "Entry" { + "MsmKey" = "8:_26C938668CAE46EEA3971AB786BAA45D" + "OwnerKey" = "8:_BF2CE61978054B2DB482792974E390F0" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_6CE0B932302E4E3783AAD1EA468ABD34" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { + "MsmKey" = "8:_713FAE60EA4D44ABB1F2679555EE4BF8" + "OwnerKey" = "8:_A6D188F9B5AF430C92D0B9606ADF4C63" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_73B60A9F2922458DBF0EFCE0734B1D88" + "OwnerKey" = "8:_98DCC664712A41B993FCD33026D06FFC" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_93A5D480D91747B086FD13789A12978B" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -57,24 +75,6 @@ } "Entry" { - "MsmKey" = "8:_EF3E9937AC8B4A898E7B80BCEA175E6A" - "OwnerKey" = "8:_98DCC664712A41B993FCD33026D06FFC" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_EF3E9937AC8B4A898E7B80BCEA175E6A" - "OwnerKey" = "8:_BF2CE61978054B2DB482792974E390F0" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_EF3E9937AC8B4A898E7B80BCEA175E6A" - "OwnerKey" = "8:_A6D188F9B5AF430C92D0B9606ADF4C63" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { "MsmKey" = "8:_EF467E7BEF8E4109BAD7E2FE47508D13" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -307,13 +307,13 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:CASA" - "ProductCode" = "8:{970A65D5-A969-4659-B2AF-F212B518F99A}" - "PackageCode" = "8:{1368B6D9-3ACA-446D-8E33-C207F44508D6}" + "ProductCode" = "8:{01D33115-AC79-4F8F-9920-051681E05395}" + "PackageCode" = "8:{72593D72-94A3-482B-9CDA-6AD95E4A525B}" "UpgradeCode" = "8:{DFD8B8A0-EA51-4202-831C-7CD2B90A63AE}" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" - "ProductVersion" = "8:1.7.786" + "ProductVersion" = "8:1.7.820" "Manufacturer" = "8:Novell" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -835,16 +835,35 @@ } "MergeModule" { - "{35A69C6E-5BA4-440D-803D-762B59A45393}:_EF3E9937AC8B4A898E7B80BCEA175E6A" + "{35A69C6E-5BA4-440D-803D-762B59A45393}:_26C938668CAE46EEA3971AB786BAA45D" { "UseDynamicProperties" = "11:TRUE" "IsDependency" = "11:TRUE" "SourcePath" = "8:dotnetfxredist_x86.msm" - "Properties" - { - } - "LanguageId" = "3:1033" - "Exclude" = "11:TRUE" + "LanguageId" = "3:0" + "Exclude" = "11:FALSE" + "Folder" = "8:" + "Feature" = "8:" + "IsolateTo" = "8:" + } + "{35A69C6E-5BA4-440D-803D-762B59A45393}:_713FAE60EA4D44ABB1F2679555EE4BF8" + { + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:TRUE" + "SourcePath" = "8:dotnetfxredist_x86.msm" + "LanguageId" = "3:0" + "Exclude" = "11:FALSE" + "Folder" = "8:" + "Feature" = "8:" + "IsolateTo" = "8:" + } + "{35A69C6E-5BA4-440D-803D-762B59A45393}:_73B60A9F2922458DBF0EFCE0734B1D88" + { + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:TRUE" + "SourcePath" = "8:dotnetfxredist_x86.msm" + "LanguageId" = "3:0" + "Exclude" = "11:FALSE" "Folder" = "8:" "Feature" = "8:" "IsolateTo" = "8:" diff --git a/CASA/policy/PolicyImpl.cs b/CASA/policy/PolicyImpl.cs index 972f5fac..92da4d99 100644 --- a/CASA/policy/PolicyImpl.cs +++ b/CASA/policy/PolicyImpl.cs @@ -31,8 +31,18 @@ namespace Novell.CASA.CASAPolicy { public class ICASAPol { - static string GetPolicyFilePath() + static string GetPolicyFilePath() + { + return GetPolicyFilePath(null); + } + + static string GetPolicyFilePath(string sUserDir) { + if (sUserDir != null) + { + return sUserDir + XmlConsts.policyFileName; + } + try { /* There needs to be a better way to get the HOME dir, @@ -313,15 +323,21 @@ public class ICASAPol return linkKey; } - static public CASAPol GetPolicy(CASAPolType policyType) + + static public CASAPol GetPolicy(CASAPolType policyType) + { + return GetPolicy(policyType, null); + } + + static public CASAPol GetPolicy(CASAPolType policyType, string sDir) { CASAPol pol = null; try { XmlDocument doc = new XmlDocument(); - if(!File.Exists(GetPolicyFilePath())) + if(!File.Exists(GetPolicyFilePath(sDir))) return null; - doc.Load(GetPolicyFilePath()); + doc.Load(GetPolicyFilePath(sDir)); switch(policyType) { case CASAPolType.AGGREGATION_POL: @@ -348,7 +364,7 @@ public class ICASAPol } catch(Exception e) { - //Console.WriteLine(e.ToString()); + System.Diagnostics.Trace.WriteLine("POLICY: " + e.ToString()); } return pol; }