Feature added: Allow user to change the persistence location

This commit is contained in:
Jim Norman 2006-08-29 18:26:30 +00:00
parent bcc833a1bd
commit 24fdfe7f5e
17 changed files with 1111 additions and 117 deletions

View File

@ -185,6 +185,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "DbgFileChooser.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "ExportSecrets.cs"
SubType = "Code"

View File

@ -72,7 +72,7 @@ namespace Novell.CASA.GUI
dialogAbout,
dialogLogin,
dialogLoginContinue,
dialogDesktopPassword,
dialogDesktopPassword,
dialogConfirmRefresh,
dialogSingleInstance,
dialogLoginReprompt,
@ -92,7 +92,8 @@ namespace Novell.CASA.GUI
entryOldMP,
entryNewMP1,
entryNewMP2,
entryFirefoxMP;
entryFirefoxMP,
entryStorageDirectory;
[Glade.Widget]
@ -107,10 +108,11 @@ namespace Novell.CASA.GUI
Gtk.Label label88,
labelLoginContinue1,
labelLoginContinue2,
labelDesktopPasswordMessage;
labelDesktopPasswordMessage;
[Glade.Widget]
Gtk.Button okbuttonPersistentStorage;
Gtk.Button okbuttonPersistentStorage,
buttonChooseDirectory;
[Glade.Widget]
Gtk.MenuItem mmiNew,
@ -527,7 +529,7 @@ namespace Novell.CASA.GUI
private bool DeleteMiCasaFiles()
{
string[] faFiles = Directory.GetFiles(Common.GetUserHomeDir(), ".miCASA*");
string[] faFiles = Directory.GetFiles(Common.GetUserPersistentDir(config), ".miCASA*");
bool bDeletedFiles = true;
for (int i=0; i<faFiles.Length; i++)
@ -701,7 +703,7 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - BEGIN");
string MICASA_PASSCODE_BY_MASTER_PASSWD_FILE = "/.miCASAPCByMPasswd";
string fileName = Common.GetUserHomeDir() + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
string fileName = Common.GetUserPersistentDir(config) + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
return (File.Exists(fileName));
@ -723,7 +725,7 @@ namespace Novell.CASA.GUI
catch
{
// check for existence of persistent files
string sHomeDir = Common.GetUserHomeDir();
string sHomeDir = Common.GetUserPersistentDir(config);
Logger.DbgLog("GUI:CasaMain.DoesPersistentFilesExist() - END");
return (File.Exists(sHomeDir + Common.MICASA_PERSISTENCE_FILE)
@ -1655,6 +1657,11 @@ namespace Novell.CASA.GUI
checkbuttonKdeWallet.Sensitive = false;
checkbuttonKdeWallet.Visible = false;
}
if (entryStorageDirectory != null)
{
entryStorageDirectory.Text = Common.GetUserPersistentDir(config);
}
Logger.DbgLog("GUI:CasaMain.Preferences() - END");
}
@ -1776,6 +1783,24 @@ namespace Novell.CASA.GUI
StorePolicyInterface.SetAggregationPolicy(Common.STORE_GNOMEKEYRING, false, storeID, 1);
}
StorePolicyInterface.SaveAggregationPolicy();
// update perisentent location
// move .miCASA files
string sNewDir = entryStorageDirectory.Text;
string sOldDir = Common.GetUserPersistentDir(config);
try
{
if (MoveMiCASAFiles(sOldDir, sNewDir))
{
// save off selected directory
Common.SetUserPersistentDir(config, sNewDir);
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Files moved from\r\n" + sOldDir + "\r\nto\r\n" + sNewDir);
}
}
catch (Exception e)
{
CommonGUI.DisplayMessage(Gtk.MessageType.Warning, "Error occurred while moving files.\r\n" + e.ToString());
}
Logger.DbgLog("GUI:CasaMain.okbuttonPreferences_clicked() - END");
}
@ -2081,6 +2106,11 @@ namespace Novell.CASA.GUI
windowMain.Destroy();
}
/// <summary>
/// ********************************************************************
/// Import/export handlers
/// ********************************************************************
/// </summary>
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;
}
/// <summary>
/// ********************************************************************
/// 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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -0,0 +1,78 @@
using System;
namespace Novell.CASA.GUI
{
/// <summary>
/// Summary description for DbgFileChooser.
/// </summary>
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";
}
}
}
}

View File

@ -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<files.Length; i++)
{
ts.AppendValues(new Gdk.Pixbuf (Common.IMAGE_PATH + "CASA_16.png"), files[i].Name, (files[i].Length/1000).ToString() + " KB", files[i].LastWriteTime.ToShortDateString() + " " + files[i].LastWriteTime.ToShortTimeString());
}
if (m_iAction < FileChooser.ACTION_CHOOSE_DIR)
{
FileInfo[] files = dirInfo.GetFiles();
for (int i=0; i<files.Length; i++)
{
ts.AppendValues(new Gdk.Pixbuf (Common.IMAGE_PATH + "CASA_16.png"), files[i].Name, (files[i].Length/1000).ToString() + " KB", files[i].LastWriteTime.ToShortDateString() + " " + files[i].LastWriteTime.ToShortTimeString());
}
}
}
private int GetItemCount(string sDir)
@ -235,8 +249,8 @@ namespace Novell.CASA.GUI
string selected;
// trim any trailing \
if (m_currentDirectory.EndsWith(m_pathSeparator))
m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
//if (m_currentDirectory.EndsWith(m_pathSeparator))
// m_currentDirectory = m_currentDirectory.Substring(0, m_currentDirectory.Length - 1);
try
@ -245,8 +259,8 @@ namespace Novell.CASA.GUI
{
//selected = (string) model.GetValue(iter, 1);
selected = entrySelectedFile.Text;
if (Directory.Exists(m_currentDirectory + m_pathSeparator + selected))
if (Directory.Exists(m_currentDirectory + selected))
{
// if we are at root
if (m_currentDirectory.Equals("/"))
@ -255,11 +269,12 @@ namespace Novell.CASA.GUI
}
else
{
SetCurrentDirectory(m_currentDirectory + m_pathSeparator + selected);
SetCurrentDirectory(m_currentDirectory + selected);
}
// clear current view
ts.Clear();
entrySelectedFile.Text = "";
DisplayFileListing();
}
else
@ -306,7 +321,22 @@ namespace Novell.CASA.GUI
public void on_btnOkFileChooser_clicked(object obj, EventArgs args)
{
ProcessSelection();
if (m_iAction == ACTION_CHOOSE_DIR)
{
// set directory selected
if ((entrySelectedFile.Text != null) && (entrySelectedFile.Text.Length > 0))
m_sFileSelected = entrySelectedFile.Text + m_pathSeparator;
else
m_sFileSelected = "";
// destroy dialog
dialogFileChooser.Destroy();
m_bFileChoosing = false;
}
else
{
ProcessSelection();
}
}

View File

@ -56,7 +56,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image3935">
<widget class="GtkImage" id="image3986">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -78,7 +78,7 @@
<signal name="activate" handler="OnNewSecretActivated" last_modification_time="Tue, 27 Sep 2005 06:02:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3936">
<widget class="GtkImage" id="image3987">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -99,7 +99,7 @@
<signal name="activate" handler="OnNewKeyActivated" last_modification_time="Tue, 27 Sep 2005 06:02:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3937">
<widget class="GtkImage" id="image3988">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -125,7 +125,7 @@
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image3938">
<widget class="GtkImage" id="image3989">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -152,7 +152,7 @@
<signal name="activate" handler="OnLockMiCASASecrets" last_modification_time="Mon, 10 Oct 2005 19:51:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3939">
<widget class="GtkImage" id="image3990">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
@ -173,7 +173,7 @@
<signal name="activate" handler="OnUnLockMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3940">
<widget class="GtkImage" id="image3991">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -194,7 +194,7 @@
<signal name="activate" handler="OnDestroyMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3941">
<widget class="GtkImage" id="image3992">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -221,7 +221,7 @@
<signal name="activate" handler="on_exportSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3942">
<widget class="GtkImage" id="image3993">
<property name="visible">True</property>
<property name="stock">gtk-floppy</property>
<property name="icon_size">1</property>
@ -242,7 +242,7 @@
<signal name="activate" handler="on_importSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3943">
<widget class="GtkImage" id="image3994">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -270,7 +270,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image3944">
<widget class="GtkImage" id="image3995">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -306,7 +306,7 @@
<accelerator key="F2" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image3945">
<widget class="GtkImage" id="image3996">
<property name="visible">True</property>
<property name="stock">gtk-zoom-fit</property>
<property name="icon_size">1</property>
@ -327,7 +327,7 @@
<signal name="activate" handler="LinkKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3946">
<widget class="GtkImage" id="image3997">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -348,7 +348,7 @@
<signal name="activate" handler="CopyKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3947">
<widget class="GtkImage" id="image3998">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">1</property>
@ -376,7 +376,7 @@
<accelerator key="Delete" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image3948">
<widget class="GtkImage" id="image3999">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -410,7 +410,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image3949">
<widget class="GtkImage" id="image4000">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -432,7 +432,7 @@
<signal name="activate" handler="on_konquerer_activate" last_modification_time="Thu, 02 Mar 2006 07:08:06 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3950">
<widget class="GtkImage" id="image4001">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -453,7 +453,7 @@
<signal name="activate" handler="on_kopete_activate" last_modification_time="Thu, 02 Mar 2006 07:08:44 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3951">
<widget class="GtkImage" id="image4002">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -474,7 +474,7 @@
<signal name="activate" handler="on_networkmanager_activate" last_modification_time="Thu, 02 Mar 2006 07:07:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3952">
<widget class="GtkImage" id="image4003">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -495,7 +495,7 @@
<signal name="activate" handler="on_gaim_activate" last_modification_time="Thu, 02 Mar 2006 07:07:29 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3953">
<widget class="GtkImage" id="image4004">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -520,7 +520,7 @@
<signal name="activate" handler="ResetMasterPassword" last_modification_time="Wed, 02 Nov 2005 15:28:00 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3954">
<widget class="GtkImage" id="image4005">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -547,7 +547,7 @@
<signal name="activate" handler="Preferences" last_modification_time="Fri, 19 Aug 2005 06:40:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3955">
<widget class="GtkImage" id="image4006">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -581,7 +581,7 @@
<signal name="activate" handler="on_create_sample_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:58:41 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3956">
<widget class="GtkImage" id="image4007">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -602,7 +602,7 @@
<signal name="activate" handler="on_remove_test_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:05 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3957">
<widget class="GtkImage" id="image4008">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -621,6 +621,21 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="debug_file_chooser">
<property name="visible">True</property>
<property name="label" translatable="yes">Debug File Chooser</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_debug_file_chooser_activate" last_modification_time="Tue, 29 Aug 2006 15:54:42 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator8">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkCheckMenuItem" id="enable_logging1">
<property name="visible">True</property>
@ -653,7 +668,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image3958">
<widget class="GtkImage" id="image4009">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -680,7 +695,7 @@
<signal name="activate" handler="About" last_modification_time="Thu, 01 Sep 2005 15:30:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image3959">
<widget class="GtkImage" id="image4010">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">1</property>
@ -4729,7 +4744,140 @@ prompted for the Master Password at startup.</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame32">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkAlignment" id="alignment47">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox159">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox92">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox93">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkEntry" id="entryStorageDirectory">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="buttonChooseDirectory">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_buttonChooseDirectory_clicked" last_modification_time="Mon, 28 Aug 2006 20:08:37 GMT"/>
<child>
<widget class="GtkImage" id="image3960">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label273">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt; miCASA Storage Location &lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@ -4858,7 +5006,7 @@ prompted for the Master Password at startup.</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
@ -12999,4 +13147,449 @@ to encrypt this file</property>
</child>
</widget>
<widget class="GtkDialog" id="dialogDebugFileChooser">
<property name="visible">True</property>
<property name="title" translatable="yes">CASA - Debug File chooser</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">True</property>
<property name="icon">CASAicons.ico</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox160">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="hbuttonbox25">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button66">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button67">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button68">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox161">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox94">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="vbox162">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="image3961">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox163">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label274">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Debug file Chooser&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label275">
<property name="visible">True</property>
<property name="label" translatable="yes">This will be removed</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame33">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkAlignment" id="alignment48">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkTable" id="table33">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkLabel" id="label276">
<property name="visible">True</property>
<property name="label" translatable="yes">Save File</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label277">
<property name="visible">True</property>
<property name="label" translatable="yes">Open File</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label278">
<property name="visible">True</property>
<property name="label" translatable="yes">Choose Directory</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entrySaveFile">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entryOpenFile">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entryChooseDirectory">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="buttonSaveFile">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Save As...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_buttonSaveFile_clicked" last_modification_time="Tue, 29 Aug 2006 15:53:20 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="buttonOpenFile">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Open file</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_buttonOpenFile_clicked" last_modification_time="Tue, 29 Aug 2006 15:53:35 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="buttonChooseDirectory">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Choose Dir</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_buttonChooseDirectory_clicked" last_modification_time="Tue, 29 Aug 2006 15:53:42 GMT"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@ -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);
}
}
}
}

View File

@ -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");
}

View File

@ -98,6 +98,11 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\ChangePersistentDir.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "common\ExportXMLSecrets.cs"
SubType = "Code"

View File

@ -0,0 +1,42 @@
using System;
namespace Novell.CASA.MiCasa.Common
{
/// <summary>
/// Summary description for ChangePersistentDir.
/// </summary>
///
[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;
}
}
}

View File

@ -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;

View File

@ -129,6 +129,11 @@
Project = "{57CD94A2-5B4A-40C3-8189-CB760FB78357}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
<Reference
Name = "Novell.CASA.CASAPolicy"
Project = "{636A9D7E-BFB5-4EB9-96F8-51FF85A98826}"
Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
/>
</References>
</Build>
<Files>

View File

@ -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, "");
}

View File

@ -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:"

View File

@ -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;
}