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_KEY_FILE = "/.miCASAKey";
|
||||
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[]{ '*', ':', '\'', '\\', '&', '=', '<', '>' };
|
||||
|
||||
|
@ -20,22 +20,23 @@
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
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
|
||||
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
|
||||
{
|
||||
Gtk.TreeStore tsSecretIDMiCasa,
|
||||
tsNativeInfoMiCasa,
|
||||
tsKeyValue,
|
||||
@ -150,7 +151,7 @@ public class MiCasa : Store
|
||||
/// SecretID TreeStore
|
||||
tvSecretIDMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvSecretIDMiCasa");
|
||||
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;
|
||||
tsSecretIDMiCasa.SetSortColumnId(0, Gtk.SortType.Ascending);
|
||||
tvSecretIDMiCasa.RowActivated += new RowActivatedHandler(OntvSecretIDMiCasaRowActivated);
|
||||
@ -161,10 +162,10 @@ public class MiCasa : Store
|
||||
/// NativeInfo TreeStore
|
||||
tvNativeInfoMiCasa = (Gtk.TreeView)CasaMain.gxmlMain.GetWidget("tvNativeInfoMiCasa");
|
||||
tsNativeInfoMiCasa = new TreeStore(typeof(string), typeof(string));
|
||||
tvNativeInfoMiCasa.AppendColumn("NativeKey",new CellRendererText(),"text",0);
|
||||
tvNativeInfoMiCasa.AppendColumn("NativeValue",new CellRendererText(),"text",1);
|
||||
tvNativeInfoMiCasa.AppendColumn("NativeKey", new CellRendererText(), "text", 0);
|
||||
tvNativeInfoMiCasa.AppendColumn("NativeValue", new CellRendererText(), "text", 1);
|
||||
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
|
||||
AggregateStore();
|
||||
Logger.DbgLog("GUI:MiCasa.MiCasa() - END");
|
||||
@ -187,9 +188,9 @@ public class MiCasa : Store
|
||||
tsSecretIDMiCasa.Clear();
|
||||
tsNativeInfoMiCasa.Clear();
|
||||
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());
|
||||
}
|
||||
@ -221,19 +222,19 @@ public class MiCasa : Store
|
||||
string[] NativeKeys = null,
|
||||
NativeValues = null;
|
||||
|
||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
||||
selected = (string) model.GetValue (iter, 0);
|
||||
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||
selected = (string)model.GetValue(iter, 0);
|
||||
|
||||
if( (null != selected) && (selected.Length > 0) )
|
||||
if ((null != selected) && (selected.Length > 0))
|
||||
{
|
||||
tsNativeInfoMiCasa.Clear();
|
||||
/// Populate NativeInfo
|
||||
tsNativeInfoMiCasa.AppendValues("Keychain Name", "= "+model.GetValue(iter,3));
|
||||
NativeKeys = (string[]) model.GetValue (iter, 4);
|
||||
NativeValues = (string[]) model.GetValue (iter, 5);
|
||||
for( int i=0; i< NativeKeys.Length; i++ )
|
||||
if( (null != NativeValues[i]) && ("" != NativeValues[i]) )
|
||||
tsNativeInfoMiCasa.AppendValues(NativeKeys[i], "= "+NativeValues[i]);
|
||||
tsNativeInfoMiCasa.AppendValues("Keychain Name", "= " + model.GetValue(iter, 3));
|
||||
NativeKeys = (string[])model.GetValue(iter, 4);
|
||||
NativeValues = (string[])model.GetValue(iter, 5);
|
||||
for (int i = 0; i < NativeKeys.Length; i++)
|
||||
if ((null != NativeValues[i]) && ("" != NativeValues[i]))
|
||||
tsNativeInfoMiCasa.AppendValues(NativeKeys[i], "= " + NativeValues[i]);
|
||||
tvNativeInfoMiCasa.ShowAll();
|
||||
}
|
||||
|
||||
@ -250,21 +251,21 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - BEGIN");
|
||||
|
||||
if( 3 == args.Event.Button )
|
||||
if (3 == args.Event.Button)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnRightClicked() - Context menu opened.");
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "menuRightClick", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "menuRightClick", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
menuRightClick.Popup(null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
|
||||
|
||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
||||
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||
cmiCopy.Sensitive = true;
|
||||
else
|
||||
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());
|
||||
}
|
||||
@ -292,19 +293,19 @@ public class MiCasa : Store
|
||||
|
||||
try
|
||||
{
|
||||
if( null == arrDeletedKeys )
|
||||
if (null == arrDeletedKeys)
|
||||
arrDeletedKeys = new ArrayList();
|
||||
else
|
||||
arrDeletedKeys.Clear();
|
||||
|
||||
if( tvSecretIDMiCasa.Selection.GetSelected (out model, out iter) )
|
||||
if (tvSecretIDMiCasa.Selection.GetSelected(out model, out iter))
|
||||
{
|
||||
selected = (string) model.GetValue(iter, 0);
|
||||
keys = (string[]) model.GetValue(iter, 1);
|
||||
values = (string[]) model.GetValue(iter, 2);
|
||||
selected = (string)model.GetValue(iter, 0);
|
||||
keys = (string[])model.GetValue(iter, 1);
|
||||
values = (string[])model.GetValue(iter, 2);
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogManageSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogManageSecret", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
dialogManageSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||
dialogManageSecret.Title = "miCASA - Manage Secret";
|
||||
|
||||
@ -313,8 +314,8 @@ public class MiCasa : Store
|
||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// 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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
tvKeyValue.AppendColumn("Key", new CellRendererText(), "text", 0);
|
||||
tvKeyValue.AppendColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||
tvKeyValue.AppendColumn("Created", new CellRendererText(), "text", 5);
|
||||
tvKeyValue.AppendColumn("Modified", new CellRendererText(), "text", 6);
|
||||
@ -328,7 +329,9 @@ public class MiCasa : Store
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
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);
|
||||
|
||||
@ -342,8 +345,8 @@ public class MiCasa : Store
|
||||
else
|
||||
bHasLinks = false;
|
||||
|
||||
if( (null != keys[i]) && (null != values[i]) )
|
||||
if( bHasLinks )
|
||||
if ((null != keys[i]) && (null != values[i]))
|
||||
if (bHasLinks)
|
||||
{
|
||||
tsKeyValue.AppendValues(keys[i],
|
||||
values[i],
|
||||
@ -364,6 +367,11 @@ public class MiCasa : Store
|
||||
dtModified.ToShortDateString() + " " + dtModified.ToShortTimeString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.DbgLog(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -371,7 +379,7 @@ public class MiCasa : Store
|
||||
entryKey.HasFocus = true;
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
catch (Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.dialogManageSecret() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
@ -397,34 +405,34 @@ public class MiCasa : Store
|
||||
|
||||
try
|
||||
{
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
val = tsKeyValue.GetValue(iter,0);
|
||||
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||
val = tsKeyValue.GetValue(iter, 0);
|
||||
KeyName = val.ToString();
|
||||
if( true == cbuttonShowPassword.Active )
|
||||
val = tsKeyValue.GetValue(iter,1);
|
||||
if (true == cbuttonShowPassword.Active)
|
||||
val = tsKeyValue.GetValue(iter, 1);
|
||||
else
|
||||
val = tsKeyValue.GetValue(iter,2);
|
||||
val = tsKeyValue.GetValue(iter, 2);
|
||||
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");
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||
tsKeyValue.SetValue(iter, 1, args.NewText);
|
||||
tsKeyValue.SetValue(iter, 2, "********");
|
||||
|
||||
tvSecretIDMiCasa.Selection.GetSelected (out model, out iter);
|
||||
Keys = (string[]) model.GetValue(iter, 1);
|
||||
Values = (string[]) model.GetValue(iter, 2);
|
||||
for( int i=0; i< Keys.Length; i++ )
|
||||
tvSecretIDMiCasa.Selection.GetSelected(out model, out iter);
|
||||
Keys = (string[])model.GetValue(iter, 1);
|
||||
Values = (string[])model.GetValue(iter, 2);
|
||||
for (int i = 0; i < Keys.Length; i++)
|
||||
{
|
||||
if( Keys[i] == KeyName )
|
||||
if (Keys[i] == KeyName)
|
||||
{
|
||||
Values[i] = args.NewText;
|
||||
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, 2, "********");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
catch (Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
@ -465,34 +473,34 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewAdd_clicked() - BEGIN");
|
||||
|
||||
if( ("" != entryKey.Text) && ("" != entryValue.Text) )
|
||||
if (("" != entryKey.Text) && ("" != entryValue.Text))
|
||||
{
|
||||
TreeIter iterKey;
|
||||
object val = null;
|
||||
ArrayList arrKeys = new ArrayList();
|
||||
ArrayList arrValues = new ArrayList();
|
||||
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
if (tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
val = tsKeyValue.GetValue(iterKey, 0);
|
||||
arrKeys.Add(val.ToString());
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
val = tsKeyValue.GetValue(iterKey, 1);
|
||||
arrValues.Add(val.ToString());
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
while (tsKeyValue.IterNext(ref iterKey));
|
||||
}
|
||||
if( -1 == arrKeys.IndexOf(entryKey.Text) )
|
||||
if( true == Common.ValidateString(entryKey.Text) )
|
||||
if (-1 == arrKeys.IndexOf(entryKey.Text))
|
||||
if (true == Common.ValidateString(entryKey.Text))
|
||||
{
|
||||
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
|
||||
entryKey.Text = entryValue.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSpecialCharacter", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
//dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
||||
}
|
||||
//tvKeyValue.Selection.SelectIter(iterKey);
|
||||
@ -517,16 +525,16 @@ public class MiCasa : Store
|
||||
TreeModel modelKey;
|
||||
TreeIter iterKey;
|
||||
|
||||
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
|
||||
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
|
||||
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
|
||||
if (tvKeyValue.Selection.GetSelected(out modelKey, out iterKey))
|
||||
if (false == (bool)tsKeyValue.GetValue(iterKey, 3))
|
||||
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey, 0));
|
||||
|
||||
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
|
||||
if (0 != tvKeyValue.Selection.CountSelectedRows())
|
||||
{
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
|
||||
tvKeyValue.Selection.GetSelected (out model, out iter);
|
||||
tvKeyValue.Selection.GetSelected(out model, out iter);
|
||||
tsKeyValue.Remove(ref iter);
|
||||
tvKeyValue.ColumnsAutosize();
|
||||
}
|
||||
@ -593,9 +601,9 @@ public class MiCasa : Store
|
||||
{
|
||||
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));
|
||||
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
|
||||
@ -615,7 +623,7 @@ public class MiCasa : Store
|
||||
string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||
if (!sSaveTimed.Equals(m_sRememberFor))
|
||||
{
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING,m_sRememberFor);
|
||||
m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||
m_config.WriteConfig();
|
||||
}
|
||||
|
||||
@ -627,12 +635,12 @@ public class MiCasa : Store
|
||||
else
|
||||
{
|
||||
// prompt user
|
||||
MessageDialog md=new MessageDialog(dialogLogin,Gtk.DialogFlags.Modal,
|
||||
MessageDialog md = new MessageDialog(dialogLogin, Gtk.DialogFlags.Modal,
|
||||
Gtk.MessageType.Warning,
|
||||
Gtk.ButtonsType.Ok,
|
||||
"Master Password incorrect");
|
||||
|
||||
md.Response +=new ResponseHandler(md_Response2);
|
||||
md.Response += new ResponseHandler(md_Response2);
|
||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||
md.Modal = true;
|
||||
md.Show();
|
||||
@ -658,7 +666,7 @@ public class MiCasa : Store
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -686,7 +694,7 @@ public class MiCasa : Store
|
||||
|
||||
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||
{
|
||||
if( "" != entryMasterPassword3.Text )
|
||||
if ("" != entryMasterPassword3.Text)
|
||||
okbuttonLogin_clicked(obj, args);
|
||||
}
|
||||
|
||||
@ -702,7 +710,7 @@ public class MiCasa : Store
|
||||
if (md != null)
|
||||
{
|
||||
md.Destroy();
|
||||
entryMasterPassword3.Text="";
|
||||
entryMasterPassword3.Text = "";
|
||||
entryMasterPassword3.HasFocus = true;
|
||||
}
|
||||
}
|
||||
@ -729,9 +737,9 @@ public class MiCasa : Store
|
||||
|
||||
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);
|
||||
tvSecretIDMiCasa.ColumnsAutosize();
|
||||
@ -744,13 +752,13 @@ public class MiCasa : Store
|
||||
}
|
||||
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));
|
||||
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.");
|
||||
else
|
||||
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
|
||||
{
|
||||
NewKey = (string) tsKeyValue.GetValue(iterKey,0);
|
||||
NewValue = (string) tsKeyValue.GetValue(iterKey,1);
|
||||
dirtyBit = (bool) tsKeyValue.GetValue(iterKey,3);
|
||||
NewKey = (string)tsKeyValue.GetValue(iterKey, 0);
|
||||
NewValue = (string)tsKeyValue.GetValue(iterKey, 1);
|
||||
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.");
|
||||
else
|
||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - ADD_KEY_VALUE_FAILED.");
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
while (tsKeyValue.IterNext(ref iterKey));
|
||||
|
||||
}
|
||||
AggregateStore();
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
catch (Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.on_buttonManageOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
@ -803,7 +811,7 @@ public class MiCasa : Store
|
||||
/// <summary>
|
||||
/// SECRET-ID DOUBLE CLICKED
|
||||
/// </summary>
|
||||
private void OntvSecretIDMiCasaRowActivated( object obj, RowActivatedArgs args )
|
||||
private void OntvSecretIDMiCasaRowActivated(object obj, RowActivatedArgs args)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OntvSecretIDMiCasaRowActivated() - SecretID doubled clicked.");
|
||||
ViewKeyValues();
|
||||
@ -828,8 +836,8 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnNewSecretActivated() - BEGIN");
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogNewSecret", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogNewSecret", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
dialogNewSecret.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||
dialogNewSecret.Title = "miCASA - New Secret";
|
||||
|
||||
@ -837,10 +845,10 @@ public class MiCasa : Store
|
||||
cellEditable.Editable = true;
|
||||
cellEditable.Edited += new EditedHandler(OnKeyValueEdited);
|
||||
/// 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));
|
||||
tvKeyValue.AppendColumn("Key",new CellRendererText(),"text",0);
|
||||
tvKeyValue.AppendColumn("Value",cellEditable,"text",2);
|
||||
tvKeyValue.AppendColumn("Linked",new CellRendererText(),"text",4);
|
||||
tsKeyValue = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string));
|
||||
tvKeyValue.AppendColumn("Key", new CellRendererText(), "text", 0);
|
||||
tvKeyValue.AppendColumn("Value", cellEditable, "text", 2);
|
||||
tvKeyValue.AppendColumn("Linked", new CellRendererText(), "text", 4);
|
||||
tvKeyValue.Model = tsKeyValue;
|
||||
tsKeyValue.Clear();
|
||||
entrySecretID.HasFocus = true;
|
||||
@ -886,7 +894,7 @@ public class MiCasa : Store
|
||||
ArrayList arrKeys = null,
|
||||
arrValues = null;
|
||||
|
||||
if ( true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text) )
|
||||
if (true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text))
|
||||
{
|
||||
/*// prompt user
|
||||
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
|
||||
@ -898,13 +906,13 @@ public class MiCasa : Store
|
||||
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
|
||||
md.Modal = true;
|
||||
md.Show();*/
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogSpecialCharacter", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
entrySecretID.HasFocus = true;
|
||||
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.");
|
||||
|
||||
@ -913,22 +921,22 @@ public class MiCasa : Store
|
||||
|
||||
try
|
||||
{
|
||||
if(tsKeyValue.GetIterFirst(out iterKey))
|
||||
if (tsKeyValue.GetIterFirst(out iterKey))
|
||||
{
|
||||
do
|
||||
{
|
||||
val = tsKeyValue.GetValue(iterKey,0);
|
||||
val = tsKeyValue.GetValue(iterKey, 0);
|
||||
NewKey = val.ToString();
|
||||
val = tsKeyValue.GetValue(iterKey,1);
|
||||
val = tsKeyValue.GetValue(iterKey, 1);
|
||||
NewValue = val.ToString();
|
||||
|
||||
if( -1 == (arrKeys.IndexOf(NewKey)) )
|
||||
if (-1 == (arrKeys.IndexOf(NewKey)))
|
||||
{
|
||||
arrKeys.Add(NewKey);
|
||||
arrValues.Add(NewValue);
|
||||
}
|
||||
}
|
||||
while( tsKeyValue.IterNext(ref iterKey) );
|
||||
while (tsKeyValue.IterNext(ref iterKey));
|
||||
|
||||
Keys = (string[])arrKeys.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);
|
||||
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();
|
||||
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");
|
||||
}
|
||||
}
|
||||
catch(Exception exp)
|
||||
catch (Exception exp)
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.on_buttonNewOk_clicked() - EXCEPTION:" + exp.ToString());
|
||||
}
|
||||
@ -1005,7 +1013,7 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnCopyActivated() - BEGIN");
|
||||
|
||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
||||
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||
{
|
||||
|
||||
TreeModel model;
|
||||
@ -1013,14 +1021,14 @@ public class MiCasa : Store
|
||||
string selected = null;
|
||||
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"))
|
||||
selected = selected.Substring(11);
|
||||
|
||||
saKeys = (string[]) model.GetValue(iter, 1);
|
||||
saValues = (string[]) model.GetValue(iter, 2);
|
||||
saKeys = (string[])model.GetValue(iter, 1);
|
||||
saValues = (string[])model.GetValue(iter, 2);
|
||||
|
||||
CopySecret cs = new CopySecret(selected, saKeys, saValues);
|
||||
cs.Show();
|
||||
@ -1054,35 +1062,35 @@ public class MiCasa : Store
|
||||
{
|
||||
Logger.DbgLog("GUI:MiCasa.OnDeleteActivated() - BEGIN");
|
||||
|
||||
if( 0 != tvSecretIDMiCasa.Selection.CountSelectedRows() )
|
||||
if (0 != tvSecretIDMiCasa.Selection.CountSelectedRows())
|
||||
{
|
||||
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
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))
|
||||
{
|
||||
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogConfirmDelete", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogConfirmDelete", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
dialogConfirmDelete.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");
|
||||
dialogConfirmDelete.Title = "miCASA - Delete Secret";
|
||||
checkbuttonShowDeleteDialog.Visible = true;
|
||||
|
||||
if( (null != selected) && (selected.Length > 0) )
|
||||
if ((null != selected) && (selected.Length > 0))
|
||||
entryDeleteSecretID.Text = selected;
|
||||
|
||||
}
|
||||
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);
|
||||
tvSecretIDMiCasa.ColumnsAutosize();
|
||||
@ -1104,9 +1112,9 @@ public class MiCasa : Store
|
||||
|
||||
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);
|
||||
tvSecretIDMiCasa.ColumnsAutosize();
|
||||
@ -1119,7 +1127,7 @@ public class MiCasa : Store
|
||||
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());
|
||||
}
|
||||
@ -1144,15 +1152,15 @@ public class MiCasa : Store
|
||||
{
|
||||
TreeModel model;
|
||||
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);
|
||||
if(selected != null && selected.Length > 0)
|
||||
selected = (string)model.GetValue(iter, 0);
|
||||
if (selected != null && selected.Length > 0)
|
||||
{
|
||||
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLinkKeyValue", null);
|
||||
gxmlTemp.Autoconnect (this);
|
||||
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLinkKeyValue", null);
|
||||
gxmlTemp.Autoconnect(this);
|
||||
dialogLinkKeyValue.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
|
||||
dialogLinkKeyValue.Title = "miCASA - Link Keys";
|
||||
dialogLinkKeyValue.Modal = true;
|
||||
@ -1166,12 +1174,12 @@ public class MiCasa : Store
|
||||
(notebook2.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = false;
|
||||
|
||||
// show available secrets
|
||||
tsAvailableSecrets=new TreeStore(typeof(string),typeof(string));
|
||||
tsAvailableSecrets = new TreeStore(typeof(string), typeof(string));
|
||||
tsAvailableSecrets.SetSortColumnId(0, Gtk.SortType.Ascending);
|
||||
|
||||
tvAvailableSecrets.AppendColumn("Secret ID",new CellRendererText(),"text",0);
|
||||
tvAvailableSecrets.Model=tsAvailableSecrets;
|
||||
tvAvailableSecrets.ButtonReleaseEvent +=new ButtonReleaseEventHandler(tvAvailableSecrets_ButtonReleaseEvent);
|
||||
tvAvailableSecrets.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
||||
tvAvailableSecrets.Model = tsAvailableSecrets;
|
||||
tvAvailableSecrets.ButtonReleaseEvent += new ButtonReleaseEventHandler(tvAvailableSecrets_ButtonReleaseEvent);
|
||||
|
||||
// show secretIDs
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
@ -1184,20 +1192,20 @@ public class MiCasa : Store
|
||||
}
|
||||
|
||||
// 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("Value", new CellRendererText(), "text", 1);
|
||||
tvAvailableKeys.Model=tsAvailableKeys;
|
||||
tvAvailableKeys.Model = tsAvailableKeys;
|
||||
tvAvailableKeys.Show();
|
||||
|
||||
|
||||
// populate current linked keys
|
||||
tsLinkedKeys=new TreeStore(typeof(string), typeof(string));
|
||||
tsLinkedKeys = new TreeStore(typeof(string), typeof(string));
|
||||
tsLinkedKeys.SetSortColumnId(0, Gtk.SortType.Descending);
|
||||
|
||||
tvLinkedKeys.AppendColumn("Secret ID", new CellRendererText(), "text", 0);
|
||||
tvLinkedKeys.AppendColumn("Key", new CellRendererText(), "text", 1);
|
||||
tvLinkedKeys.Model=tsLinkedKeys;
|
||||
tvLinkedKeys.Model = tsLinkedKeys;
|
||||
|
||||
Secret secret = ss.GetSecret(entrySecretID.Text);
|
||||
ShowLinkedKeys(secret, selected);
|
||||
@ -1208,8 +1216,8 @@ public class MiCasa : Store
|
||||
//entryLinkValue.Text = secret.getKeyValue(selected);
|
||||
entryLinkValue.Sensitive = false;
|
||||
entryLinkValue.Text = "********";
|
||||
entryLinkValue.Changed +=new EventHandler(entryLinkValue_Changed);
|
||||
entryLinkValue.LeaveNotifyEvent +=new LeaveNotifyEventHandler(entryLinkValue_LeaveNotifyEvent);
|
||||
entryLinkValue.Changed += new EventHandler(entryLinkValue_Changed);
|
||||
entryLinkValue.LeaveNotifyEvent += new LeaveNotifyEventHandler(entryLinkValue_LeaveNotifyEvent);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1226,7 +1234,7 @@ public class MiCasa : Store
|
||||
ienum.Reset();
|
||||
while (ienum.MoveNext())
|
||||
{
|
||||
LinkedKeyInfo lki = (LinkedKeyInfo) ienum.Value;
|
||||
LinkedKeyInfo lki = (LinkedKeyInfo)ienum.Value;
|
||||
tsLinkedKeys.AppendValues(lki.GetLinkedSecretID(true), lki.GetLinkedKeyID());
|
||||
}
|
||||
}
|
||||
@ -1236,19 +1244,19 @@ public class MiCasa : Store
|
||||
{
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selected=null;
|
||||
string selected = null;
|
||||
|
||||
if(tvAvailableSecrets.Selection.GetSelected (out model, out iter))
|
||||
selected=(string) model.GetValue (iter, 0);
|
||||
if (tvAvailableSecrets.Selection.GetSelected(out model, out iter))
|
||||
selected = (string)model.GetValue(iter, 0);
|
||||
|
||||
tsAvailableKeys.Clear();
|
||||
|
||||
if(selected != null && selected.Length > 0)
|
||||
if (selected != null && selected.Length > 0)
|
||||
{
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
Secret secret = ss.GetSecret(selected);
|
||||
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.
|
||||
if (labelLinkSecretID.Text.Equals(selected)
|
||||
@ -1264,19 +1272,19 @@ public class MiCasa : Store
|
||||
{
|
||||
TreeModel model;
|
||||
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;
|
||||
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);
|
||||
|
||||
// add a null terminator to the secretid
|
||||
@ -1296,14 +1304,14 @@ public class MiCasa : Store
|
||||
{
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selectedSecret=null;
|
||||
string selectedKey=null;
|
||||
if (tvLinkedKeys.Selection.GetSelected (out model, out iter))
|
||||
string selectedSecret = null;
|
||||
string selectedKey = null;
|
||||
if (tvLinkedKeys.Selection.GetSelected(out model, out iter))
|
||||
{
|
||||
selectedSecret = (string) model.GetValue(iter,0);
|
||||
selectedSecret = (string)model.GetValue(iter, 0);
|
||||
// add NULL
|
||||
//selectedSecret = selectedSecret;
|
||||
selectedKey = (string) model.GetValue(iter,1);
|
||||
selectedKey = (string)model.GetValue(iter, 1);
|
||||
|
||||
LinkedKeyInfo lki = new LinkedKeyInfo(selectedSecret, selectedKey);
|
||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_REMOVE_LINKED_KEY, null, labelLinkSecretID.Text, labelLinkKeyID.Text, lki);
|
||||
@ -1421,7 +1429,7 @@ public class MiCasa : Store
|
||||
// display decode window
|
||||
TreeModel model;
|
||||
TreeIter iter;
|
||||
string selected=null;
|
||||
string selected = null;
|
||||
string value = null;
|
||||
|
||||
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
||||
@ -1432,7 +1440,7 @@ public class MiCasa : Store
|
||||
selected = (string)model.GetValue(iter, 0);
|
||||
value = (string)model.GetValue(iter, 1);
|
||||
|
||||
if ((value == null) || (value.Length <1))
|
||||
if ((value == null) || (value.Length < 1))
|
||||
{
|
||||
// read value from store
|
||||
SecretStore ss = GetMiCasaStore();
|
||||
@ -1446,7 +1454,7 @@ public class MiCasa : Store
|
||||
baTarget = new byte[baValue.Length - 16];
|
||||
Array.Copy(baValue, 13, baTarget, 0, baValue.Length - 16);
|
||||
}
|
||||
/* try
|
||||
/* try
|
||||
{
|
||||
baValue = Convert.FromBase64String(System.Text.Encoding.ASCII.GetString(baTarget));
|
||||
value = System.Text.Encoding.ASCII.GetString(baValue);
|
||||
@ -1455,7 +1463,7 @@ public class MiCasa : Store
|
||||
{
|
||||
value = e.ToString();
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
if (selected != null && selected.Length > 0)
|
||||
@ -1556,7 +1564,7 @@ public class MiCasa : Store
|
||||
importSecrets.Run();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
///##################################################################
|
||||
/// END OF FILE
|
||||
|
Loading…
Reference in New Issue
Block a user