diff --git a/CASA/gui/CASAManager.csproj b/CASA/gui/CASAManager.csproj
index ad8001fb..eedff964 100644
--- a/CASA/gui/CASAManager.csproj
+++ b/CASA/gui/CASAManager.csproj
@@ -235,6 +235,16 @@
SubType = "Code"
BuildAction = "Compile"
/>
+
+
/// ********************************************************************
/// private void HandleQuit()
@@ -2249,7 +2280,7 @@ namespace Novell.CASA.GUI
{
DbgFileChooser dbf = new DbgFileChooser();
dbf.Run();
- }
+ }
}
}
diff --git a/CASA/gui/PersistentPolicyDialog.cs b/CASA/gui/PersistentPolicyDialog.cs
new file mode 100644
index 00000000..99e21c5e
--- /dev/null
+++ b/CASA/gui/PersistentPolicyDialog.cs
@@ -0,0 +1,309 @@
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+using Gtk;
+using Glade;
+
+
+using Novell.CASA;
+using Novell.CASA.CASAPolicy;
+
+namespace Novell.CASA.GUI
+{
+ ///
+ /// Summary description for PolicyDialog.
+ ///
+ public class PersistentPolicyDialog
+ {
+
+ private TreeStore tsPersistentList = new TreeStore(typeof(string));
+ private TreeStore tsNonPersistentList = new TreeStore(typeof(string));
+
+ private PersistencePol policy = null;
+ private bool bChanged = false;
+
+
+ #region Glade Widgets
+
+ [Glade.Widget]
+ Gtk.TreeView tvPersistentList,
+ tvNonPersistentList;
+
+ [Glade.Widget]
+ Gtk.Dialog dialogPersistentPolicy;
+
+ [Glade.Widget]
+ Gtk.Button applybuttonPersistent,
+ buttonMakeNonPersistent,
+ buttonMakePersistent;
+
+ #endregion
+
+ public PersistentPolicyDialog()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ public void ShowDialog()
+ {
+ Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogPersistentPolicy", null);
+ gxmlTemp.Autoconnect(this);
+
+ activateMoveButtons(false, false);
+ applybuttonPersistent.Sensitive = false;
+
+ // load store
+ SecretStore ss = SecretStore.getInstance();
+ StringCollection sc = ss.enumerateSecretIDs();
+ StringEnumerator senum = sc.GetEnumerator();
+
+ // load policy
+ policy = (PersistencePol)ICASAPol.GetPolicy(CASAPolType.PERSISTENCE_POL);
+ if (policy == null)
+ {
+ policy = new PersistencePol("Platform", "PersistentPath_NOT USED", 10);
+ }
+
+ while (senum.MoveNext())
+ {
+ string sSecretID = senum.Current;
+ if (policy.GetSecretPolicy(sSecretID, "Persistent", true))
+ {
+ tsPersistentList.AppendValues(sSecretID);
+ }
+ else
+ {
+ //tsNonPersistentList.AppendValues(sSecretID);
+ }
+ }
+
+ // display non-persistent IDs
+ ArrayList al = policy.GetNonpersistentSecretIDs();
+ for (int i=0; iTrue
-
+
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
@@ -559,6 +559,34 @@
+
+
+
+
+
+
+
+
@@ -581,7 +609,7 @@
-
+
True
gtk-add
1
@@ -602,7 +630,7 @@
-
+
True
gtk-remove
1
@@ -668,7 +696,7 @@
-
+
True
gtk-help
1
@@ -695,7 +723,7 @@
-
+
True
gtk-dialog-info
1
@@ -795,7 +823,6 @@
GTK_POS_TOP
True
False
-
@@ -1053,6 +1080,7 @@
+ True
False
0
@@ -4440,6 +4468,440 @@ prompted for the Master Password at startup.
False
0
+
+
+ 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
+ True
+ Encrpyt and save miCASA secrets to disk (Persistent)
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Decypt and open miCASA using my workstation password
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ 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 Store options </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
+
+
+
+
+
+ 6
+ True
+ 0
+ 0.5
+ GTK_SHADOW_IN
+
+
+
+ True
+ 0.5
+ 0.5
+ 1
+ 1
+ 0
+ 0
+ 12
+ 0
+
+
+
+ 4
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Show CASA Manager icon in notify area
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ Display CASA Manager when icon is clicked
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ Lock/Unlock secrets when icon is clicked
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ radiobutton1
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
+
+
+
+ True
+ <b> CASA Manager Options </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
+
+
+
6
@@ -4576,312 +5038,6 @@ prompted for the Master Password at startup.
-
-
- 6
- True
- 0
- 0.5
- GTK_SHADOW_IN
-
-
-
- True
- 0.5
- 0.5
- 1
- 1
- 0
- 0
- 12
- 0
-
-
-
- 4
- True
- False
- 0
-
-
-
- True
- True
- Show CASA Manager in notify area
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
-
-
- 0
- False
- False
-
-
-
-
-
- True
- False
- 0
-
-
-
- True
-
- False
- False
- GTK_JUSTIFY_LEFT
- False
- False
- 0.5
- 0.5
- 0
- 0
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 0
- False
- False
-
-
-
-
-
- True
- False
- 0
-
-
-
- True
- True
- Display CASA Manager when icon is clicked
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
-
-
- 0
- False
- False
-
-
-
-
-
- True
- True
- Lock/Unlock secrets when icon is clicked
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
- radiobutton1
-
-
-
- 0
- False
- False
-
-
-
-
- 0
- True
- True
-
-
-
-
- 0
- True
- True
-
-
-
-
-
-
-
-
-
- True
- <b> Options </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
-
-
-
-
-
- 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
-
-
-
6
@@ -13650,4 +13806,399 @@ to encrypt this file
+
+ True
+ Edit Secret Policy
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_CENTER_ON_PARENT
+ True
+ 200
+ 530
+ True
+ False
+ 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_NORMAL
+ True
+ -11
+
+
+
+
+
+ True
+ True
+ True
+ gtk-apply
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -10
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ 64
+ 64
+ True
+ True
+ GTK_POLICY_AUTOMATIC
+ GTK_POLICY_ALWAYS
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
+
+ True
+ Select non-persistent Secrets
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_CENTER_ON_PARENT
+ True
+ 250
+ 500
+ True
+ False
+ 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_NORMAL
+ True
+ -11
+
+
+
+
+
+ True
+ True
+ True
+ gtk-apply
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -10
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ True
+ GTK_POLICY_ALWAYS
+ GTK_POLICY_ALWAYS
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+
+
+
+
+
+
+
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+ True
+ gtk-go-forward
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+ 7
+ False
+ False
+
+
+
+
+
+ True
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+
+ True
+ gtk-go-back
+ 4
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 19
+ False
+ True
+
+
+
+
+
+ True
+ True
+ GTK_POLICY_ALWAYS
+ GTK_POLICY_ALWAYS
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ True
+ False
+ False
+ True
+ False
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
diff --git a/CASA/policy/PersistencePol.cs b/CASA/policy/PersistencePol.cs
index eeb8f053..6b15334a 100644
--- a/CASA/policy/PersistencePol.cs
+++ b/CASA/policy/PersistencePol.cs
@@ -22,6 +22,8 @@
using System;
using System.Collections;
+using System.Collections.Specialized;
+
using System.Xml;
using System.Xml.Serialization;
@@ -54,13 +56,91 @@ public class PersistencePol : CASAPol
}
}
- public PersistencePol(string osName,string path, int time)
+ public PersistencePol(string osName,string path, int time)
+ {
+ policyType = CASAPolType.PERSISTENCE_POL;
+ os = osName;
+ filePath = path;
+ pollInterval = time;
+ }
+
+
+ public PersistencePol(string osName,string path, int time, Hashtable htPolicies)
{
policyType = CASAPolType.PERSISTENCE_POL;
os = osName;
filePath = path;
pollInterval = time;
+ htSecretPolicys = htPolicies;
}
+
+ private Hashtable htSecretPolicys; // = new Hashtable();
+ public void SetSecretPolicy(string sSecretID, string sPolicyAttribID, string sPolicyAttribValue, string sDefaultValue)
+ {
+
+ if (htSecretPolicys == null)
+ {
+ htSecretPolicys = new Hashtable();
+ }
+
+ // find policys for given secretID
+ NameValueCollection nvc = (NameValueCollection)htSecretPolicys[sSecretID];
+ if (nvc == null)
+ {
+ nvc = new NameValueCollection();
+ htSecretPolicys.Add(sSecretID, nvc);
+ }
+
+ if (sPolicyAttribValue.Equals(sDefaultValue))
+ {
+ nvc.Remove(sPolicyAttribID);
+ }
+ else
+ {
+ nvc.Set(sPolicyAttribID, sPolicyAttribValue);
+ }
+ }
+
+ public bool GetSecretPolicy(string sSecretID, string sPolicyAttribID, bool bDefaultValue)
+ {
+ string sReturn = GetSecretPolicy(sSecretID, sPolicyAttribID, bDefaultValue.ToString());
+ return bool.Parse(sReturn);
+ }
+
+ public string GetSecretPolicy(string sSecretID, string sPolicyAttribID, string sDefaultValue)
+ {
+ if (htSecretPolicys != null)
+ {
+ NameValueCollection nvc = (NameValueCollection)htSecretPolicys[sSecretID];
+ if (nvc != null)
+ {
+ try
+ {
+ return nvc.GetValues(sPolicyAttribID)[0];
+ }
+ catch
+ {
+ }
+ }
+ }
+
+ return sDefaultValue;
+ }
+
+ public ArrayList GetNonpersistentSecretIDs()
+ {
+ ArrayList al = new ArrayList();
+
+ //enumerate all secrets loaded
+ IDictionaryEnumerator idEnum = htSecretPolicys.GetEnumerator();
+ while (idEnum.MoveNext())
+ {
+ string sSecretID = (string)idEnum.Key;
+ al.Add(sSecretID);
+ }
+
+ return al;
+ }
public override void DumpPol()
{
@@ -95,10 +175,40 @@ public class PersistencePol : CASAPol
elem.InnerText = pollInterval.ToString();
persistPolElem.AppendChild(elem);
+
+ // write out policy for secrets
+ // write out NameValueCollection
+ XmlElement configElem = doc.CreateElement("SecretPolicies");
+ persistPolElem.AppendChild(configElem);
+
+ IDictionaryEnumerator ienum = htSecretPolicys.GetEnumerator();
+ while (ienum.MoveNext())
+ {
+ // get the collection for current SecretID
+ string sCurrentID = ienum.Key.ToString();
+ NameValueCollection nvc = (NameValueCollection)htSecretPolicys[sCurrentID];
+
+ // if no attributes exist, skip it
+ if (nvc.Count == 0) continue;
+
+ // create a policy element
+ XmlElement policyElement = doc.CreateElement("Secret");
+ policyElement.SetAttribute("id", sCurrentID);
+
+ // add all attributes
+ for (int i=0; i