Handle malformed values. Detect non-existence MP file.
This commit is contained in:
parent
dfbdcc6403
commit
5afe199508
@ -64,7 +64,7 @@ public class Common
|
|||||||
public static string MICASA_PASSCODE_BY_MP_FILE = "/.miCASAPCByMPasswd";
|
public static string MICASA_PASSCODE_BY_MP_FILE = "/.miCASAPCByMPasswd";
|
||||||
public static string MICASA_KEY_FILE = "/.miCASAKey";
|
public static string MICASA_KEY_FILE = "/.miCASAKey";
|
||||||
public static string MICASA_PERSISTENCE_FILE = "/.miCASA";
|
public static string MICASA_PERSISTENCE_FILE = "/.miCASA";
|
||||||
public static string MICASA_VALIDATION_FILE = "/.miCASAValidate";
|
public static string MICASA_VALIDATION_FILE = "/.miCASAValidateHash";
|
||||||
|
|
||||||
static Char[] SpecialCharacters = new Char[]{ '*', ':', '\'', '\\', '&', '=', '<', '>' };
|
static Char[] SpecialCharacters = new Char[]{ '*', ':', '\'', '\\', '&', '=', '<', '>' };
|
||||||
|
|
||||||
|
@ -20,22 +20,23 @@
|
|||||||
*
|
*
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
namespace Novell.CASA.GUI {
|
namespace Novell.CASA.GUI
|
||||||
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
using Gtk;
|
|
||||||
using Glade;
|
|
||||||
using Novell.CASA.MiCasa.Common;
|
|
||||||
using Novell.CASA.MiCasa.Communication;
|
|
||||||
|
|
||||||
|
|
||||||
public class MiCasa : Store
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
using Glade;
|
||||||
|
using Novell.CASA.MiCasa.Common;
|
||||||
|
using Novell.CASA.MiCasa.Communication;
|
||||||
|
|
||||||
|
|
||||||
|
public class MiCasa : Store
|
||||||
|
{
|
||||||
Gtk.TreeStore tsSecretIDMiCasa,
|
Gtk.TreeStore tsSecretIDMiCasa,
|
||||||
tsNativeInfoMiCasa,
|
tsNativeInfoMiCasa,
|
||||||
tsKeyValue,
|
tsKeyValue,
|
||||||
@ -150,7 +151,7 @@ public class MiCasa : Store
|
|||||||
/// SecretID TreeStore
|
/// SecretID TreeStore
|
||||||
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
|
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
|
||||||
tsSecretIDMiCasa = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
tsSecretIDMiCasa = new TreeStore(typeof(string), typeof(string[]), typeof(string[]), typeof(string), typeof(string[]), typeof(string[]));
|
||||||
tvSecretIDMiCasa.AppendColumn("Secret ID",new CellRendererText(),"text",0);
|
tvSecretIDMiCasa.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
||||||
tvSecretIDMiCasa.Model = tsSecretIDMiCasa;
|
tvSecretIDMiCasa.Model = tsSecretIDMiCasa;
|
||||||
tsSecretIDMiCasa.SetSortColumnId(0, Gtk.SortType.Ascending);
|
tsSecretIDMiCasa.SetSortColumnId(0, Gtk.SortType.Ascending);
|
||||||
tvSecretIDMiCasa.RowActivated += new RowActivatedHandler(OntvSecretIDMiCasaRowActivated);
|
tvSecretIDMiCasa.RowActivated += new RowActivatedHandler(OntvSecretIDMiCasaRowActivated);
|
||||||
@ -161,10 +162,10 @@ public class MiCasa : Store
|
|||||||
/// NativeInfo TreeStore
|
/// NativeInfo TreeStore
|
||||||
tvNativeInfoMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoMiCasa");
|
tvNativeInfoMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoMiCasa");
|
||||||
tsNativeInfoMiCasa = new TreeStore(typeof(string), typeof(string));
|
tsNativeInfoMiCasa = new TreeStore(typeof(string), typeof(string));
|
||||||
tvNativeInfoMiCasa.AppendColumn("NativeKey",new CellRendererText(),"text",0);
|
tvNativeInfoMiCasa.AppendColumn("NativeKey", new CellRendererText(), "text", 0);
|
||||||
tvNativeInfoMiCasa.AppendColumn("NativeValue",new CellRendererText(),"text",1);
|
tvNativeInfoMiCasa.AppendColumn("NativeValue", new CellRendererText(), "text", 1);
|
||||||
tvNativeInfoMiCasa.Model = tsNativeInfoMiCasa;
|
tvNativeInfoMiCasa.Model = tsNativeInfoMiCasa;
|
||||||
tvNativeInfoMiCasa.ModifyBase(StateType.Normal,new Gdk.Color(0xff,0xff,0xe6));
|
tvNativeInfoMiCasa.ModifyBase(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xe6));
|
||||||
/// Aggregate the store
|
/// Aggregate the store
|
||||||
AggregateStore();
|
AggregateStore();
|
||||||
Logger.DbgLog("GUI:MiCasa.MiCasa() - END");
|
Logger.DbgLog("GUI:MiCasa.MiCasa() - END");
|
||||||
@ -187,9 +188,9 @@ public class MiCasa : Store
|
|||||||
tsSecretIDMiCasa.Clear();
|
tsSecretIDMiCasa.Clear();
|
||||||
tsNativeInfoMiCasa.Clear();
|
tsNativeInfoMiCasa.Clear();
|
||||||
StoreDataInterface.AggregateStore(Common.STORE_MICASA);
|
StoreDataInterface.AggregateStore(Common.STORE_MICASA);
|
||||||
StoreDataInterface.ReadStore(Common.STORE_MICASA,ref tsSecretIDMiCasa);
|
StoreDataInterface.ReadStore(Common.STORE_MICASA, ref tsSecretIDMiCasa);
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.AggregateStore() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.AggregateStore() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -221,19 +222,19 @@ public class MiCasa : Store
|
|||||||
string[] NativeKeys = null,
|
string[] NativeKeys = null,
|
||||||
NativeValues = null;
|
NativeValues = null;
|
||||||
|
|
||||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||||
selected = (string) model.GetValue (iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
|
|
||||||
if( (null != selected) && (selected.Length > 0) )
|
if ((null != selected) && (selected.Length > 0))
|
||||||
{
|
{
|
||||||
tsNativeInfoMiCasa.Clear();
|
tsNativeInfoMiCasa.Clear();
|
||||||
/// Populate NativeInfo
|
/// Populate NativeInfo
|
||||||
tsNativeInfoMiCasa.AppendValues("Keychain Name", "= "+model.GetValue(iter,3));
|
tsNativeInfoMiCasa.AppendValues("Keychain Name", "= " + model.GetValue(iter, 3));
|
||||||
NativeKeys = (string[]) model.GetValue (iter, 4);
|
NativeKeys = (string[])model.GetValue(iter, 4);
|
||||||
NativeValues = (string[]) model.GetValue (iter, 5);
|
NativeValues = (string[])model.GetValue(iter, 5);
|
||||||
for( int i=0; i< NativeKeys.Length; i++ )
|
for (int i = 0; i < NativeKeys.Length; i++)
|
||||||
if( (null != NativeValues[i]) && ("" != NativeValues[i]) )
|
if ((null != NativeValues[i]) && ("" != NativeValues[i]))
|
||||||
tsNativeInfoMiCasa.AppendValues(NativeKeys[i], "= "+NativeValues[i]);
|
tsNativeInfoMiCasa.AppendValues(NativeKeys[i], "= " + NativeValues[i]);
|
||||||
tvNativeInfoMiCasa.ShowAll();
|
tvNativeInfoMiCasa.ShowAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,21 +251,21 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - BEGIN");
|
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - BEGIN");
|
||||||
|
|
||||||
if( 3 == args.Event.Button )
|
if (3 == args.Event.Button)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
|
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "menuRightClick", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
||||||
|
|
||||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||||
cmiCopy.Sensitive = true;
|
cmiCopy.Sensitive = true;
|
||||||
else
|
else
|
||||||
cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
cmiNewKey.Sensitive = cmiView.Sensitive = cmiLink.Sensitive = cmiCopy.Sensitive = cmiDelete.Sensitive = false;
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -292,19 +293,19 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( null == arrDeletedKeys )
|
if (null == arrDeletedKeys)
|
||||||
arrDeletedKeys = new ArrayList();
|
arrDeletedKeys = new ArrayList();
|
||||||
else
|
else
|
||||||
arrDeletedKeys.Clear();
|
arrDeletedKeys.Clear();
|
||||||
|
|
||||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selected = (string) model.GetValue(iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
keys = (string[]) model.GetValue(iter, 1);
|
keys = (string[])model.GetValue(iter, 1);
|
||||||
values = (string[]) model.GetValue(iter, 2);
|
values = (string[])model.GetValue(iter, 2);
|
||||||
|
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogManageSecret", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||||
dialogManageSecret.Title = "miCASA - Manage Secret";
|
dialogManageSecret.Title = "miCASA - Manage Secret";
|
||||||
|
|
||||||
@ -313,8 +314,8 @@ public class MiCasa : Store
|
|||||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
||||||
tsKeyValue = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string));
|
tsKeyValue = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(string));
|
||||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
tvKeyValue.AppendColumn("Key", new CellRendererText(), "text", 0);
|
||||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
tvKeyValue.AppendColumn("Value", cellEditable, "text", 2);
|
||||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||||
tvKeyValue.AppendColumn("Created", new CellRendererText(), "text", 5);
|
tvKeyValue.AppendColumn("Created", new CellRendererText(), "text", 5);
|
||||||
tvKeyValue.AppendColumn("Modified", new CellRendererText(), "text", 6);
|
tvKeyValue.AppendColumn("Modified", new CellRendererText(), "text", 6);
|
||||||
@ -328,7 +329,9 @@ public class MiCasa : Store
|
|||||||
SecretStore ss = GetMiCasaStore();
|
SecretStore ss = GetMiCasaStore();
|
||||||
bool bHasLinks = false;
|
bool bHasLinks = false;
|
||||||
|
|
||||||
for( int i=0; i< keys.Length; i++ )
|
for (int i = 0; i < keys.Length; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Secret secret = ss.GetSecret(selected);
|
Secret secret = ss.GetSecret(selected);
|
||||||
|
|
||||||
@ -342,8 +345,8 @@ public class MiCasa : Store
|
|||||||
else
|
else
|
||||||
bHasLinks = false;
|
bHasLinks = false;
|
||||||
|
|
||||||
if( (null != keys[i]) && (null != values[i]) )
|
if ((null != keys[i]) && (null != values[i]))
|
||||||
if( bHasLinks )
|
if (bHasLinks)
|
||||||
{
|
{
|
||||||
tsKeyValue.AppendValues(keys[i],
|
tsKeyValue.AppendValues(keys[i],
|
||||||
values[i],
|
values[i],
|
||||||
@ -364,6 +367,11 @@ public class MiCasa : Store
|
|||||||
dtModified.ToShortDateString() + " " + dtModified.ToShortTimeString());
|
dtModified.ToShortDateString() + " " + dtModified.ToShortTimeString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.DbgLog(e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -371,7 +379,7 @@ public class MiCasa : Store
|
|||||||
entryKey.HasFocus = true;
|
entryKey.HasFocus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.dialogManageSecret() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.dialogManageSecret() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -397,34 +405,34 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||||
val = tsKeyValue.GetValue(iter,0);
|
val = tsKeyValue.GetValue(iter, 0);
|
||||||
KeyName = val.ToString();
|
KeyName = val.ToString();
|
||||||
if( true == cbuttonShowPassword.Active )
|
if (true == cbuttonShowPassword.Active)
|
||||||
val = tsKeyValue.GetValue(iter,1);
|
val = tsKeyValue.GetValue(iter, 1);
|
||||||
else
|
else
|
||||||
val = tsKeyValue.GetValue(iter,2);
|
val = tsKeyValue.GetValue(iter, 2);
|
||||||
KeyValue = val.ToString();
|
KeyValue = val.ToString();
|
||||||
|
|
||||||
tvSecretIDMiCasa.Selection.GetSelected (out model, out iter);
|
tvSecretIDMiCasa.Selection.GetSelected(out model, out iter);
|
||||||
|
|
||||||
if( false == entrySecretID.Editable )
|
if (false == entrySecretID.Editable)
|
||||||
{
|
{
|
||||||
if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) )
|
if (("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText))
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter))
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
|
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
|
||||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||||
tsKeyValue.SetValue(iter, 2, "********");
|
tsKeyValue.SetValue(iter, 2, "********");
|
||||||
|
|
||||||
tvSecretIDMiCasa.Selection.GetSelected (out model, out iter);
|
tvSecretIDMiCasa.Selection.GetSelected(out model, out iter);
|
||||||
Keys = (string[]) model.GetValue(iter, 1);
|
Keys = (string[])model.GetValue(iter, 1);
|
||||||
Values = (string[]) model.GetValue(iter, 2);
|
Values = (string[])model.GetValue(iter, 2);
|
||||||
for( int i=0; i< Keys.Length; i++ )
|
for (int i = 0; i < Keys.Length; i++)
|
||||||
{
|
{
|
||||||
if( Keys[i] == KeyName )
|
if (Keys[i] == KeyName)
|
||||||
{
|
{
|
||||||
Values[i] = args.NewText;
|
Values[i] = args.NewText;
|
||||||
tsSecretIDMiCasa.SetValue(iter, 2, Values);
|
tsSecretIDMiCasa.SetValue(iter, 2, Values);
|
||||||
@ -438,14 +446,14 @@ public class MiCasa : Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( (Common.MAX_LEN >= args.NewText.Length) )
|
else if ((Common.MAX_LEN >= args.NewText.Length))
|
||||||
{
|
{
|
||||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||||
tsKeyValue.SetValue(iter, 2, "********");
|
tsKeyValue.SetValue(iter, 2, "********");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -465,34 +473,34 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewAdd_clicked() - BEGIN");
|
Logger.DbgLog("GUI:MiCasa.on_buttonNewAdd_clicked() - BEGIN");
|
||||||
|
|
||||||
if( ("" != entryKey.Text) && ("" != entryValue.Text) )
|
if (("" != entryKey.Text) && ("" != entryValue.Text))
|
||||||
{
|
{
|
||||||
TreeIter iterKey;
|
TreeIter iterKey;
|
||||||
object val = null;
|
object val = null;
|
||||||
ArrayList arrKeys = new ArrayList();
|
ArrayList arrKeys = new ArrayList();
|
||||||
ArrayList arrValues = new ArrayList();
|
ArrayList arrValues = new ArrayList();
|
||||||
|
|
||||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
if (tsKeyValue.GetIterFirst(out iterKey))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
val = tsKeyValue.GetValue(iterKey,0);
|
val = tsKeyValue.GetValue(iterKey, 0);
|
||||||
arrKeys.Add(val.ToString());
|
arrKeys.Add(val.ToString());
|
||||||
val = tsKeyValue.GetValue(iterKey,1);
|
val = tsKeyValue.GetValue(iterKey, 1);
|
||||||
arrValues.Add(val.ToString());
|
arrValues.Add(val.ToString());
|
||||||
}
|
}
|
||||||
while( tsKeyValue.IterNext(ref iterKey) );
|
while (tsKeyValue.IterNext(ref iterKey));
|
||||||
}
|
}
|
||||||
if( -1 == arrKeys.IndexOf(entryKey.Text) )
|
if (-1 == arrKeys.IndexOf(entryKey.Text))
|
||||||
if( true == Common.ValidateString(entryKey.Text) )
|
if (true == Common.ValidateString(entryKey.Text))
|
||||||
{
|
{
|
||||||
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
|
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
|
||||||
entryKey.Text = entryValue.Text = "";
|
entryKey.Text = entryValue.Text = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSpecialCharacter", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
//dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
//dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
||||||
}
|
}
|
||||||
//tvKeyValue.Selection.SelectIter(iterKey);
|
//tvKeyValue.Selection.SelectIter(iterKey);
|
||||||
@ -517,16 +525,16 @@ public class MiCasa : Store
|
|||||||
TreeModel modelKey;
|
TreeModel modelKey;
|
||||||
TreeIter iterKey;
|
TreeIter iterKey;
|
||||||
|
|
||||||
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
|
if (tvKeyValue.Selection.GetSelected(out modelKey, out iterKey))
|
||||||
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
|
if (false == (bool)tsKeyValue.GetValue(iterKey, 3))
|
||||||
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
|
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey, 0));
|
||||||
|
|
||||||
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
|
if (0 != tvKeyValue.Selection.CountSelectedRows())
|
||||||
{
|
{
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
|
|
||||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||||
tsKeyValue.Remove(ref iter);
|
tsKeyValue.Remove(ref iter);
|
||||||
tvKeyValue.ColumnsAutosize();
|
tvKeyValue.ColumnsAutosize();
|
||||||
}
|
}
|
||||||
@ -593,9 +601,9 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
TreeViewColumn tvCol;
|
TreeViewColumn tvCol;
|
||||||
|
|
||||||
if( tvKeyValue.Model.IterNChildren() > 0 )
|
if (tvKeyValue.Model.IterNChildren() > 0)
|
||||||
|
|
||||||
if( 0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text) )
|
if (0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text))
|
||||||
{
|
{
|
||||||
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
|
||||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||||
@ -615,7 +623,7 @@ public class MiCasa : Store
|
|||||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||||
{
|
{
|
||||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||||
m_config.WriteConfig();
|
m_config.WriteConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,12 +635,12 @@ public class MiCasa : Store
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// prompt user
|
// prompt user
|
||||||
MessageDialog md=new MessageDialog(dialogLogin,Gtk.DialogFlags.Modal,
|
MessageDialog md = new MessageDialog(dialogLogin, Gtk.DialogFlags.Modal,
|
||||||
Gtk.MessageType.Warning,
|
Gtk.MessageType.Warning,
|
||||||
Gtk.ButtonsType.Ok,
|
Gtk.ButtonsType.Ok,
|
||||||
"Master Password incorrect");
|
"Master Password incorrect");
|
||||||
|
|
||||||
md.Response +=new ResponseHandler(md_Response2);
|
md.Response += new ResponseHandler(md_Response2);
|
||||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||||
md.Modal = true;
|
md.Modal = true;
|
||||||
md.Show();
|
md.Show();
|
||||||
@ -658,7 +666,7 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
if (!bTimerActive)
|
if (!bTimerActive)
|
||||||
{
|
{
|
||||||
GLib.Timeout.Add ((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler (update_gui));
|
GLib.Timeout.Add((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler(update_gui));
|
||||||
bTimerActive = true;
|
bTimerActive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,7 +694,7 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||||
{
|
{
|
||||||
if( "" != entryMasterPassword3.Text )
|
if ("" != entryMasterPassword3.Text)
|
||||||
okbuttonLogin_clicked(obj, args);
|
okbuttonLogin_clicked(obj, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,7 +710,7 @@ public class MiCasa : Store
|
|||||||
if (md != null)
|
if (md != null)
|
||||||
{
|
{
|
||||||
md.Destroy();
|
md.Destroy();
|
||||||
entryMasterPassword3.Text="";
|
entryMasterPassword3.Text = "";
|
||||||
entryMasterPassword3.HasFocus = true;
|
entryMasterPassword3.HasFocus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -729,9 +737,9 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( (0 == tvKeyValue.Model.IterNChildren()) && tvSecretIDMiCasa.Selection.GetSelected (out modelSecret, out iterSecret) )
|
if ((0 == tvKeyValue.Model.IterNChildren()) && tvSecretIDMiCasa.Selection.GetSelected(out modelSecret, out iterSecret))
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref modelSecret, ref iterSecret))
|
||||||
{
|
{
|
||||||
tsSecretIDMiCasa.Remove(ref iterSecret);
|
tsSecretIDMiCasa.Remove(ref iterSecret);
|
||||||
tvSecretIDMiCasa.ColumnsAutosize();
|
tvSecretIDMiCasa.ColumnsAutosize();
|
||||||
@ -744,13 +752,13 @@ public class MiCasa : Store
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (null != arrDeletedKeys) && (arrDeletedKeys.Count > 0) )
|
if ((null != arrDeletedKeys) && (arrDeletedKeys.Count > 0))
|
||||||
{
|
{
|
||||||
tvSecretIDMiCasa.Selection.GetSelected (out modelSecret, out iterSecret);
|
tvSecretIDMiCasa.Selection.GetSelected(out modelSecret, out iterSecret);
|
||||||
strDeletedKeys = (string[])arrDeletedKeys.ToArray(typeof(string));
|
strDeletedKeys = (string[])arrDeletedKeys.ToArray(typeof(string));
|
||||||
for( int i=0; i < strDeletedKeys.Length; i++)
|
for (int i = 0; i < strDeletedKeys.Length; i++)
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_KEY, strDeletedKeys[i], null, ref modelSecret, ref iterSecret) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_KEY, strDeletedKeys[i], null, ref modelSecret, ref iterSecret))
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - DELETE_KEY_SUCCEEDED.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - DELETE_KEY_SUCCEEDED.");
|
||||||
else
|
else
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - DELETE_KEY_FAILED.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - DELETE_KEY_FAILED.");
|
||||||
@ -759,29 +767,29 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tsKeyValue.GetIterFirst(out iterKey) && tvSecretIDMiCasa.Selection.GetSelected (out modelSecret, out iterSecret) )
|
if (tsKeyValue.GetIterFirst(out iterKey) && tvSecretIDMiCasa.Selection.GetSelected(out modelSecret, out iterSecret))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
NewKey = (string) tsKeyValue.GetValue(iterKey,0);
|
NewKey = (string)tsKeyValue.GetValue(iterKey, 0);
|
||||||
NewValue = (string) tsKeyValue.GetValue(iterKey,1);
|
NewValue = (string)tsKeyValue.GetValue(iterKey, 1);
|
||||||
dirtyBit = (bool) tsKeyValue.GetValue(iterKey,3);
|
dirtyBit = (bool)tsKeyValue.GetValue(iterKey, 3);
|
||||||
|
|
||||||
if( true == dirtyBit )
|
if (true == dirtyBit)
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_ADD_KEY, NewKey, NewValue, ref modelSecret, ref iterSecret) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_ADD_KEY, NewKey, NewValue, ref modelSecret, ref iterSecret))
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - ADD_KEY_VALUE_SUCCEEDED.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - ADD_KEY_VALUE_SUCCEEDED.");
|
||||||
else
|
else
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - ADD_KEY_VALUE_FAILED.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - ADD_KEY_VALUE_FAILED.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( tsKeyValue.IterNext(ref iterKey) );
|
while (tsKeyValue.IterNext(ref iterKey));
|
||||||
|
|
||||||
}
|
}
|
||||||
AggregateStore();
|
AggregateStore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -803,7 +811,7 @@ public class MiCasa : Store
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// SECRET-ID DOUBLE CLICKED
|
/// SECRET-ID DOUBLE CLICKED
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OntvSecretIDMiCasaRowActivated( object obj, RowActivatedArgs args )
|
private void OntvSecretIDMiCasaRowActivated(object obj, RowActivatedArgs args)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OntvSecretIDMiCasaRowActivated() - SecretID doubled clicked.");
|
Logger.DbgLog("GUI:MiCasa.OntvSecretIDMiCasaRowActivated() - SecretID doubled clicked.");
|
||||||
ViewKeyValues();
|
ViewKeyValues();
|
||||||
@ -828,8 +836,8 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnNewSecretActivated() - BEGIN");
|
Logger.DbgLog("GUI:MiCasa.OnNewSecretActivated() - BEGIN");
|
||||||
|
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogNewSecret", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||||
dialogNewSecret.Title = "miCASA - New Secret";
|
dialogNewSecret.Title = "miCASA - New Secret";
|
||||||
|
|
||||||
@ -837,10 +845,10 @@ public class MiCasa : Store
|
|||||||
cellEditable.Editable = true;
|
cellEditable.Editable = true;
|
||||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||||
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
/// KEY:0 VALUE:1 VALUE-DUP:2 DIRTY-BIT:3 LINK:4
|
||||||
tsKeyValue = new TreeStore(typeof(string),typeof(string), typeof(string), typeof(bool), typeof(string));
|
tsKeyValue = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string));
|
||||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
tvKeyValue.AppendColumn("Key", new CellRendererText(), "text", 0);
|
||||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
tvKeyValue.AppendColumn("Value", cellEditable, "text", 2);
|
||||||
tvKeyValue.AppendColumn("Linked",new CellRendererText(),"text",4);
|
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||||
tvKeyValue.Model = tsKeyValue;
|
tvKeyValue.Model = tsKeyValue;
|
||||||
tsKeyValue.Clear();
|
tsKeyValue.Clear();
|
||||||
entrySecretID.HasFocus = true;
|
entrySecretID.HasFocus = true;
|
||||||
@ -886,7 +894,7 @@ public class MiCasa : Store
|
|||||||
ArrayList arrKeys = null,
|
ArrayList arrKeys = null,
|
||||||
arrValues = null;
|
arrValues = null;
|
||||||
|
|
||||||
if ( true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text) )
|
if (true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text))
|
||||||
{
|
{
|
||||||
/*// prompt user
|
/*// prompt user
|
||||||
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
|
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
|
||||||
@ -898,13 +906,13 @@ public class MiCasa : Store
|
|||||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||||
md.Modal = true;
|
md.Modal = true;
|
||||||
md.Show();*/
|
md.Show();*/
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSpecialCharacter", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
entrySecretID.HasFocus = true;
|
entrySecretID.HasFocus = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (true == entrySecretID.Editable) && ("" != entrySecretID.Text) && (tvKeyValue.Model.IterNChildren() > 0) )
|
if ((true == entrySecretID.Editable) && ("" != entrySecretID.Text) && (tvKeyValue.Model.IterNChildren() > 0))
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - Adding New Secrets and KeyValues.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - Adding New Secrets and KeyValues.");
|
||||||
|
|
||||||
@ -913,22 +921,22 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
if (tsKeyValue.GetIterFirst(out iterKey))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
val = tsKeyValue.GetValue(iterKey,0);
|
val = tsKeyValue.GetValue(iterKey, 0);
|
||||||
NewKey = val.ToString();
|
NewKey = val.ToString();
|
||||||
val = tsKeyValue.GetValue(iterKey,1);
|
val = tsKeyValue.GetValue(iterKey, 1);
|
||||||
NewValue = val.ToString();
|
NewValue = val.ToString();
|
||||||
|
|
||||||
if( -1 == (arrKeys.IndexOf(NewKey)) )
|
if (-1 == (arrKeys.IndexOf(NewKey)))
|
||||||
{
|
{
|
||||||
arrKeys.Add(NewKey);
|
arrKeys.Add(NewKey);
|
||||||
arrValues.Add(NewValue);
|
arrValues.Add(NewValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( tsKeyValue.IterNext(ref iterKey) );
|
while (tsKeyValue.IterNext(ref iterKey));
|
||||||
|
|
||||||
Keys = (string[])arrKeys.ToArray(typeof(string));
|
Keys = (string[])arrKeys.ToArray(typeof(string));
|
||||||
Values = (string[])arrValues.ToArray(typeof(string));
|
Values = (string[])arrValues.ToArray(typeof(string));
|
||||||
@ -948,7 +956,7 @@ public class MiCasa : Store
|
|||||||
iterSecret = tsSecretIDMiCasa.AppendValues(entrySecretID.Text, Keys, Values, "Default", NativeKeys, NativeValues);
|
iterSecret = tsSecretIDMiCasa.AppendValues(entrySecretID.Text, Keys, Values, "Default", NativeKeys, NativeValues);
|
||||||
modelSecret = tvSecretIDMiCasa.Model;
|
modelSecret = tvSecretIDMiCasa.Model;
|
||||||
|
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_ADD_SECRET, "", "", ref modelSecret, ref iterSecret) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_ADD_SECRET, "", "", ref modelSecret, ref iterSecret))
|
||||||
{
|
{
|
||||||
AggregateStore();
|
AggregateStore();
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - ADD_NEW_SECRET_SUCCEEDED.");
|
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - ADD_NEW_SECRET_SUCCEEDED.");
|
||||||
@ -957,7 +965,7 @@ public class MiCasa : Store
|
|||||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - ERROR: ADD_NEW_SECRET_FAILED");
|
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - ERROR: ADD_NEW_SECRET_FAILED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -1005,7 +1013,7 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnCopyActivated() - BEGIN");
|
Logger.DbgLog("GUI:MiCasa.OnCopyActivated() - BEGIN");
|
||||||
|
|
||||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||||
{
|
{
|
||||||
|
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
@ -1013,14 +1021,14 @@ public class MiCasa : Store
|
|||||||
string selected = null;
|
string selected = null;
|
||||||
string[] saKeys, saValues;
|
string[] saKeys, saValues;
|
||||||
|
|
||||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selected = (string) model.GetValue (iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
if (selected.StartsWith("SS_CredSet"))
|
if (selected.StartsWith("SS_CredSet"))
|
||||||
selected = selected.Substring(11);
|
selected = selected.Substring(11);
|
||||||
|
|
||||||
saKeys = (string[]) model.GetValue(iter, 1);
|
saKeys = (string[])model.GetValue(iter, 1);
|
||||||
saValues = (string[]) model.GetValue(iter, 2);
|
saValues = (string[])model.GetValue(iter, 2);
|
||||||
|
|
||||||
CopySecret cs = new CopySecret(selected, saKeys, saValues);
|
CopySecret cs = new CopySecret(selected, saKeys, saValues);
|
||||||
cs.Show();
|
cs.Show();
|
||||||
@ -1054,35 +1062,35 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.OnDeleteActivated() - BEGIN");
|
Logger.DbgLog("GUI:MiCasa.OnDeleteActivated() - BEGIN");
|
||||||
|
|
||||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||||
{
|
{
|
||||||
|
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selected = null;
|
string selected = null;
|
||||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selected = (string) model.GetValue (iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_config.GetConfigSetting(Common.CONFIG_SHOW_DELETE_DIALOG, true))
|
if (m_config.GetConfigSetting(Common.CONFIG_SHOW_DELETE_DIALOG, true))
|
||||||
{
|
{
|
||||||
|
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogConfirmDelete", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||||
dialogConfirmDelete.Title = "miCASA - Delete Secret";
|
dialogConfirmDelete.Title = "miCASA - Delete Secret";
|
||||||
checkbuttonShowDeleteDialog.Visible = true;
|
checkbuttonShowDeleteDialog.Visible = true;
|
||||||
|
|
||||||
if( (null != selected) && (selected.Length > 0) )
|
if ((null != selected) && (selected.Length > 0))
|
||||||
entryDeleteSecretID.Text = selected;
|
entryDeleteSecretID.Text = selected;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (null != selected) && (selected.Length > 0) )
|
if ((null != selected) && (selected.Length > 0))
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter))
|
||||||
{
|
{
|
||||||
tsSecretIDMiCasa.Remove(ref iter);
|
tsSecretIDMiCasa.Remove(ref iter);
|
||||||
tvSecretIDMiCasa.ColumnsAutosize();
|
tvSecretIDMiCasa.ColumnsAutosize();
|
||||||
@ -1104,9 +1112,9 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter) )
|
if (Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_DELETE_SECRET, "", "", ref model, ref iter))
|
||||||
{
|
{
|
||||||
tsSecretIDMiCasa.Remove(ref iter);
|
tsSecretIDMiCasa.Remove(ref iter);
|
||||||
tvSecretIDMiCasa.ColumnsAutosize();
|
tvSecretIDMiCasa.ColumnsAutosize();
|
||||||
@ -1119,7 +1127,7 @@ public class MiCasa : Store
|
|||||||
Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - DELETE_SECRET_FAILED");
|
Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - DELETE_SECRET_FAILED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception exp)
|
catch (Exception exp)
|
||||||
{
|
{
|
||||||
Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString());
|
Logger.DbgLog("GUI:MiCasa.on_buttonYes_clicked() - EXCEPTION:" + exp.ToString());
|
||||||
}
|
}
|
||||||
@ -1144,15 +1152,15 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selected=null;
|
string selected = null;
|
||||||
|
|
||||||
if(tvKeyValue.Selection.GetSelected (out model, out iter))
|
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selected=(string) model.GetValue (iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
if(selected != null && selected.Length > 0)
|
if (selected != null && selected.Length > 0)
|
||||||
{
|
{
|
||||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLinkKeyValue", null);
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLinkKeyValue", null);
|
||||||
gxmlTemp.Autoconnect (this);
|
gxmlTemp.Autoconnect(this);
|
||||||
dialogLinkKeyValue.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
dialogLinkKeyValue.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
||||||
dialogLinkKeyValue.Title = "miCASA - Link Keys";
|
dialogLinkKeyValue.Title = "miCASA - Link Keys";
|
||||||
dialogLinkKeyValue.Modal = true;
|
dialogLinkKeyValue.Modal = true;
|
||||||
@ -1166,12 +1174,12 @@ public class MiCasa : Store
|
|||||||
(notebook2.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = false;
|
(notebook2.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = false;
|
||||||
|
|
||||||
// show available secrets
|
// show available secrets
|
||||||
tsAvailableSecrets=new TreeStore(typeof(string),typeof(string));
|
tsAvailableSecrets = new TreeStore(typeof(string), typeof(string));
|
||||||
tsAvailableSecrets.SetSortColumnId(0, Gtk.SortType.Ascending);
|
tsAvailableSecrets.SetSortColumnId(0, Gtk.SortType.Ascending);
|
||||||
|
|
||||||
tvAvailableSecrets.AppendColumn("Secret ID",new CellRendererText(),"text",0);
|
tvAvailableSecrets.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
||||||
tvAvailableSecrets.Model=tsAvailableSecrets;
|
tvAvailableSecrets.Model = tsAvailableSecrets;
|
||||||
tvAvailableSecrets.ButtonReleaseEvent +=new ButtonReleaseEventHandler(tvAvailableSecrets_ButtonReleaseEvent);
|
tvAvailableSecrets.ButtonReleaseEvent += new ButtonReleaseEventHandler(tvAvailableSecrets_ButtonReleaseEvent);
|
||||||
|
|
||||||
// show secretIDs
|
// show secretIDs
|
||||||
SecretStore ss = GetMiCasaStore();
|
SecretStore ss = GetMiCasaStore();
|
||||||
@ -1184,20 +1192,20 @@ public class MiCasa : Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show available keys
|
// show available keys
|
||||||
tsAvailableKeys=new TreeStore(typeof(string), typeof(string));
|
tsAvailableKeys = new TreeStore(typeof(string), typeof(string));
|
||||||
tvAvailableKeys.AppendColumn("Key", new CellRendererText(), "text", 0);
|
tvAvailableKeys.AppendColumn("Key", new CellRendererText(), "text", 0);
|
||||||
//tvAvailableKeys.AppendColumn("Value", new CellRendererText(), "text", 1);
|
//tvAvailableKeys.AppendColumn("Value", new CellRendererText(), "text", 1);
|
||||||
tvAvailableKeys.Model=tsAvailableKeys;
|
tvAvailableKeys.Model = tsAvailableKeys;
|
||||||
tvAvailableKeys.Show();
|
tvAvailableKeys.Show();
|
||||||
|
|
||||||
|
|
||||||
// populate current linked keys
|
// populate current linked keys
|
||||||
tsLinkedKeys=new TreeStore(typeof(string), typeof(string));
|
tsLinkedKeys = new TreeStore(typeof(string), typeof(string));
|
||||||
tsLinkedKeys.SetSortColumnId(0, Gtk.SortType.Descending);
|
tsLinkedKeys.SetSortColumnId(0, Gtk.SortType.Descending);
|
||||||
|
|
||||||
tvLinkedKeys.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
tvLinkedKeys.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
||||||
tvLinkedKeys.AppendColumn("Key", new CellRendererText(), "text", 1);
|
tvLinkedKeys.AppendColumn("Key", new CellRendererText(), "text", 1);
|
||||||
tvLinkedKeys.Model=tsLinkedKeys;
|
tvLinkedKeys.Model = tsLinkedKeys;
|
||||||
|
|
||||||
Secret secret = ss.GetSecret(entrySecretID.Text);
|
Secret secret = ss.GetSecret(entrySecretID.Text);
|
||||||
ShowLinkedKeys(secret, selected);
|
ShowLinkedKeys(secret, selected);
|
||||||
@ -1208,8 +1216,8 @@ public class MiCasa : Store
|
|||||||
//entryLinkValue.Text = secret.getKeyValue(selected);
|
//entryLinkValue.Text = secret.getKeyValue(selected);
|
||||||
entryLinkValue.Sensitive = false;
|
entryLinkValue.Sensitive = false;
|
||||||
entryLinkValue.Text = "********";
|
entryLinkValue.Text = "********";
|
||||||
entryLinkValue.Changed +=new EventHandler(entryLinkValue_Changed);
|
entryLinkValue.Changed += new EventHandler(entryLinkValue_Changed);
|
||||||
entryLinkValue.LeaveNotifyEvent +=new LeaveNotifyEventHandler(entryLinkValue_LeaveNotifyEvent);
|
entryLinkValue.LeaveNotifyEvent += new LeaveNotifyEventHandler(entryLinkValue_LeaveNotifyEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1226,7 +1234,7 @@ public class MiCasa : Store
|
|||||||
ienum.Reset();
|
ienum.Reset();
|
||||||
while (ienum.MoveNext())
|
while (ienum.MoveNext())
|
||||||
{
|
{
|
||||||
LinkedKeyInfo lki = (LinkedKeyInfo) ienum.Value;
|
LinkedKeyInfo lki = (LinkedKeyInfo)ienum.Value;
|
||||||
tsLinkedKeys.AppendValues(lki.GetLinkedSecretID(true), lki.GetLinkedKeyID());
|
tsLinkedKeys.AppendValues(lki.GetLinkedSecretID(true), lki.GetLinkedKeyID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1236,19 +1244,19 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selected=null;
|
string selected = null;
|
||||||
|
|
||||||
if(tvAvailableSecrets.Selection.GetSelected (out model, out iter))
|
if (tvAvailableSecrets.Selection.GetSelected(out model, out iter))
|
||||||
selected=(string) model.GetValue (iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
|
|
||||||
tsAvailableKeys.Clear();
|
tsAvailableKeys.Clear();
|
||||||
|
|
||||||
if(selected != null && selected.Length > 0)
|
if (selected != null && selected.Length > 0)
|
||||||
{
|
{
|
||||||
SecretStore ss = GetMiCasaStore();
|
SecretStore ss = GetMiCasaStore();
|
||||||
Secret secret = ss.GetSecret(selected);
|
Secret secret = ss.GetSecret(selected);
|
||||||
NameValueCollection nvc = secret.GetKeyValueCollection();
|
NameValueCollection nvc = secret.GetKeyValueCollection();
|
||||||
for (int i=0; i<nvc.Count; i++)
|
for (int i = 0; i < nvc.Count; i++)
|
||||||
{
|
{
|
||||||
// don't allow linking this key to ourself.
|
// don't allow linking this key to ourself.
|
||||||
if (labelLinkSecretID.Text.Equals(selected)
|
if (labelLinkSecretID.Text.Equals(selected)
|
||||||
@ -1264,19 +1272,19 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selectedSecret=null;
|
string selectedSecret = null;
|
||||||
|
|
||||||
if (tvAvailableSecrets.Selection.GetSelected (out model, out iter))
|
if (tvAvailableSecrets.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selectedSecret=(string) model.GetValue (iter, 0);
|
selectedSecret = (string)model.GetValue(iter, 0);
|
||||||
|
|
||||||
TreeModel modelKey;
|
TreeModel modelKey;
|
||||||
TreeIter iterKey;
|
TreeIter iterKey;
|
||||||
string selectedKey=null;
|
string selectedKey = null;
|
||||||
|
|
||||||
if (tvAvailableKeys.Selection.GetSelected (out modelKey, out iterKey))
|
if (tvAvailableKeys.Selection.GetSelected(out modelKey, out iterKey))
|
||||||
{
|
{
|
||||||
selectedKey = (string) modelKey.GetValue (iterKey, 0);
|
selectedKey = (string)modelKey.GetValue(iterKey, 0);
|
||||||
//tsLinkedKeys.AppendValues(selectedSecret, selectedKey);
|
//tsLinkedKeys.AppendValues(selectedSecret, selectedKey);
|
||||||
|
|
||||||
// add a null terminator to the secretid
|
// add a null terminator to the secretid
|
||||||
@ -1296,14 +1304,14 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selectedSecret=null;
|
string selectedSecret = null;
|
||||||
string selectedKey=null;
|
string selectedKey = null;
|
||||||
if (tvLinkedKeys.Selection.GetSelected (out model, out iter))
|
if (tvLinkedKeys.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
selectedSecret = (string) model.GetValue(iter,0);
|
selectedSecret = (string)model.GetValue(iter, 0);
|
||||||
// add NULL
|
// add NULL
|
||||||
//selectedSecret = selectedSecret;
|
//selectedSecret = selectedSecret;
|
||||||
selectedKey = (string) model.GetValue(iter,1);
|
selectedKey = (string)model.GetValue(iter, 1);
|
||||||
|
|
||||||
LinkedKeyInfo lki = new LinkedKeyInfo(selectedSecret, selectedKey);
|
LinkedKeyInfo lki = new LinkedKeyInfo(selectedSecret, selectedKey);
|
||||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_LINKED_KEY, null, labelLinkSecretID.Text, labelLinkKeyID.Text, lki);
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_LINKED_KEY, null, labelLinkSecretID.Text, labelLinkKeyID.Text, lki);
|
||||||
@ -1421,7 +1429,7 @@ public class MiCasa : Store
|
|||||||
// display decode window
|
// display decode window
|
||||||
TreeModel model;
|
TreeModel model;
|
||||||
TreeIter iter;
|
TreeIter iter;
|
||||||
string selected=null;
|
string selected = null;
|
||||||
string value = null;
|
string value = null;
|
||||||
|
|
||||||
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
||||||
@ -1432,7 +1440,7 @@ public class MiCasa : Store
|
|||||||
selected = (string)model.GetValue(iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
value = (string)model.GetValue(iter, 1);
|
value = (string)model.GetValue(iter, 1);
|
||||||
|
|
||||||
if ((value == null) || (value.Length <1))
|
if ((value == null) || (value.Length < 1))
|
||||||
{
|
{
|
||||||
// read value from store
|
// read value from store
|
||||||
SecretStore ss = GetMiCasaStore();
|
SecretStore ss = GetMiCasaStore();
|
||||||
@ -1446,7 +1454,7 @@ public class MiCasa : Store
|
|||||||
baTarget = new byte[baValue.Length - 16];
|
baTarget = new byte[baValue.Length - 16];
|
||||||
Array.Copy(baValue, 13, baTarget, 0, baValue.Length - 16);
|
Array.Copy(baValue, 13, baTarget, 0, baValue.Length - 16);
|
||||||
}
|
}
|
||||||
/* try
|
/* try
|
||||||
{
|
{
|
||||||
baValue = Convert.FromBase64String(System.Text.Encoding.ASCII.GetString(baTarget));
|
baValue = Convert.FromBase64String(System.Text.Encoding.ASCII.GetString(baTarget));
|
||||||
value = System.Text.Encoding.ASCII.GetString(baValue);
|
value = System.Text.Encoding.ASCII.GetString(baValue);
|
||||||
@ -1455,7 +1463,7 @@ public class MiCasa : Store
|
|||||||
{
|
{
|
||||||
value = e.ToString();
|
value = e.ToString();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected != null && selected.Length > 0)
|
if (selected != null && selected.Length > 0)
|
||||||
@ -1556,7 +1564,7 @@ public class MiCasa : Store
|
|||||||
importSecrets.Run();
|
importSecrets.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///##################################################################
|
///##################################################################
|
||||||
/// END OF FILE
|
/// END OF FILE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user