Find and Replace feature added. Resolve conflicts on Import added.
This commit is contained in:
parent
cf819ea918
commit
37f6bf2098
@ -1,3 +1,9 @@
|
|||||||
|
Mon Nov 06 11:41:13 MDT 2006 - jnorman@novell.com
|
||||||
|
|
||||||
|
- Find and Replace feature added. Resolve conflicts on Import
|
||||||
|
added.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
Thu Oct 12 16:26:13 MDT 2006 - jnorman@novell.com
|
Thu Oct 12 16:26:13 MDT 2006 - jnorman@novell.com
|
||||||
|
|
||||||
- Copy feature added. Users can copy secrets from one store
|
- Copy feature added. Users can copy secrets from one store
|
||||||
|
@ -178,6 +178,7 @@
|
|||||||
<Compile Include="FileChooser.cs">
|
<Compile Include="FileChooser.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="FindAndReplace.cs" />
|
||||||
<Compile Include="Firefox.cs">
|
<Compile Include="Firefox.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -2249,6 +2249,14 @@ namespace Novell.CASA.GUI
|
|||||||
ppd.ShowDialog();
|
ppd.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void on_mmiFindAndReplace_activate(object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
objMiCasa.FindAndReplaceValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ********************************************************************
|
/// ********************************************************************
|
||||||
/// private void HandleQuit()
|
/// private void HandleQuit()
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using Glade;
|
using Glade;
|
||||||
|
|
||||||
@ -152,8 +154,12 @@ namespace Novell.CASA.GUI
|
|||||||
{
|
{
|
||||||
// unlock it
|
// unlock it
|
||||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
|
||||||
|
m_bPasswordVerified = true;
|
||||||
dialogLogin.Destroy();
|
dialogLogin.Destroy();
|
||||||
|
|
||||||
|
//signal now
|
||||||
|
m_bIsVerifing = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -215,6 +221,8 @@ namespace Novell.CASA.GUI
|
|||||||
else
|
else
|
||||||
mTrayInstance.UpdateTrayIcon(false);
|
mTrayInstance.UpdateTrayIcon(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_bIsVerifing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember MP until functions
|
// remember MP until functions
|
||||||
@ -282,7 +290,12 @@ namespace Novell.CASA.GUI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// VerifyMasterPasswordWithUser dialog
|
/// VerifyMasterPasswordWithUser dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void VerifyMasterPasswordWithUser()
|
///
|
||||||
|
|
||||||
|
private bool m_bPasswordVerified = false;
|
||||||
|
private bool m_bIsVerifing = true;
|
||||||
|
|
||||||
|
public bool VerifyMasterPasswordWithUser()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
|
//Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
|
||||||
@ -304,6 +317,15 @@ namespace Novell.CASA.GUI
|
|||||||
dialogLogin.Destroyed += new EventHandler(dialogLogin_Destroyed);
|
dialogLogin.Destroyed += new EventHandler(dialogLogin_Destroyed);
|
||||||
dialogLogin.Modal = true;
|
dialogLogin.Modal = true;
|
||||||
dialogLogin.Show();
|
dialogLogin.Show();
|
||||||
|
|
||||||
|
while (m_bIsVerifing)
|
||||||
|
{
|
||||||
|
// Flush pending events to keep the GUI reponsive
|
||||||
|
while (Gtk.Application.EventsPending())
|
||||||
|
Gtk.Application.RunIteration();
|
||||||
|
Thread.Sleep(100);
|
||||||
|
}
|
||||||
|
return m_bPasswordVerified;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DisplayMessage(Gtk.MessageType messageType, String sMessage)
|
public static void DisplayMessage(Gtk.MessageType messageType, String sMessage)
|
||||||
|
@ -28,8 +28,6 @@ namespace Novell.CASA.GUI
|
|||||||
public const int ACTION_SAVE = 2;
|
public const int ACTION_SAVE = 2;
|
||||||
public const int ACTION_CHOOSE_DIR = 3;
|
public const int ACTION_CHOOSE_DIR = 3;
|
||||||
|
|
||||||
Thread tChooserThread = null;
|
|
||||||
|
|
||||||
|
|
||||||
#region Glade Widgets
|
#region Glade Widgets
|
||||||
|
|
||||||
|
397
CASA/gui/FindAndReplace.cs
Normal file
397
CASA/gui/FindAndReplace.cs
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
using Glade;
|
||||||
|
|
||||||
|
namespace Novell.CASA.GUI
|
||||||
|
{
|
||||||
|
class FindAndReplace
|
||||||
|
{
|
||||||
|
#region Glade Widgets
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.TreeView tvResults;
|
||||||
|
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.Dialog dialogFindAndReplace,
|
||||||
|
dialogLogin;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.Button bttnFind,
|
||||||
|
bttnReplaceAll,
|
||||||
|
bttnApply,
|
||||||
|
bttnCancel,
|
||||||
|
bttnRevert,
|
||||||
|
bttnOk;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.Entry entryFind,
|
||||||
|
entryNewValue,
|
||||||
|
entryMasterPassword3,
|
||||||
|
entryMasterPassword4;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.CheckButton cbShowValues;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.Label label86,
|
||||||
|
label88,
|
||||||
|
labelRememberFor,
|
||||||
|
labelSeconds;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.SpinButton spinbuttonRememberFor;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TreeModel m_tmCASA;
|
||||||
|
private TreeStore m_tsCASA;
|
||||||
|
private TreeStore tsResults;
|
||||||
|
private Store m_store;
|
||||||
|
|
||||||
|
private int m_iRememberSeconds = 5;
|
||||||
|
|
||||||
|
public FindAndReplace(Store store, TreeModel tmCASA, TreeStore tsCASA)
|
||||||
|
{
|
||||||
|
m_store = store;
|
||||||
|
m_tmCASA = tmCASA;
|
||||||
|
m_tsCASA = tsCASA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowDialog()
|
||||||
|
{
|
||||||
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogFindAndReplace", null);
|
||||||
|
gxmlTemp.Autoconnect(this);
|
||||||
|
|
||||||
|
dialogFindAndReplace.SetPosition(WindowPosition.CenterOnParent);
|
||||||
|
|
||||||
|
tvResults.AppendColumn("SecretID", new Gtk.CellRendererText(), "text", 0);
|
||||||
|
tvResults.AppendColumn("Key", new Gtk.CellRendererText(), "text", 1);
|
||||||
|
tvResults.AppendColumn("Value", new Gtk.CellRendererText(), "text", 2);
|
||||||
|
|
||||||
|
tvResults.Selection.Mode = SelectionMode.Multiple;
|
||||||
|
|
||||||
|
// 0:secretID, 1:Key, 2:Value****, 3:ValueClear, 4:dirtyBit
|
||||||
|
tsResults = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool));
|
||||||
|
tvResults.Model = tsResults;
|
||||||
|
|
||||||
|
// hook up event handles
|
||||||
|
bttnApply.Clicked += new EventHandler(bttnApply_Clicked);
|
||||||
|
bttnCancel.Clicked += new EventHandler(bttnCancel_Clicked);
|
||||||
|
bttnRevert.Clicked += new EventHandler(bttnRevert_Clicked);
|
||||||
|
bttnFind.Clicked += new EventHandler(bttnFind_Clicked);
|
||||||
|
bttnOk.Clicked += new EventHandler(bttnOk_Clicked);
|
||||||
|
bttnReplaceAll.Clicked += new EventHandler(bttnReplaceAll_Clicked);
|
||||||
|
|
||||||
|
cbShowValues.Toggled += new EventHandler(cbShowValues_Toggled);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void okbuttonLogin_clicked(object abj, EventArgs args)
|
||||||
|
{
|
||||||
|
TreeViewColumn tvCol;
|
||||||
|
|
||||||
|
if (0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text))
|
||||||
|
{
|
||||||
|
tvResults.RemoveColumn(tvResults.GetColumn(2));
|
||||||
|
tvCol = new TreeViewColumn("Value", new CellRendererText(), "text", 3);
|
||||||
|
tvResults.InsertColumn(tvCol, 2);
|
||||||
|
|
||||||
|
// get seconds to remember
|
||||||
|
//m_sRememberFor = spinbuttonRememberFor.Text;
|
||||||
|
|
||||||
|
//if (m_sRememberFor != null)
|
||||||
|
//{
|
||||||
|
// DateTime dtNow = DateTime.Now;
|
||||||
|
// m_iRememberSeconds = int.Parse(m_sRememberFor);
|
||||||
|
// CommonGUI.SetRememberMPUntil(dtNow.AddSeconds(m_iRememberSeconds));
|
||||||
|
//}
|
||||||
|
|
||||||
|
// save off remember time if user changed it
|
||||||
|
//string sSaveTimed = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, "5");
|
||||||
|
//if (!sSaveTimed.Equals(m_sRememberFor))
|
||||||
|
// {
|
||||||
|
// m_config.SetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||||
|
// m_config.WriteConfig();
|
||||||
|
//}
|
||||||
|
|
||||||
|
dialogLogin.Destroy();
|
||||||
|
|
||||||
|
//if (m_iRememberSeconds > 0)
|
||||||
|
// StartRememberTimer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// warn user
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Warning, "Master Password incorrect");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void on_entryMasterPassword3_activate(object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
if ("" != entryMasterPassword3.Text)
|
||||||
|
okbuttonLogin_clicked(obj, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void on_entryMasterPassword4_activate(object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
okbuttonLogin_clicked(obj, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void on_helpbuttonAuthentication_clicked(object obj, EventArgs args)
|
||||||
|
{
|
||||||
|
Common.ShowHelpUrl("CASAMasterPasswordAuthentication.htm");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cbShowValues_Toggled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TreeViewColumn tvCol;
|
||||||
|
|
||||||
|
if ((true == cbShowValues.Active)
|
||||||
|
&& (CommonGUI.GetRememberMPUntil().CompareTo(DateTime.Now) > 0))
|
||||||
|
{
|
||||||
|
// set and start the timer if needed
|
||||||
|
TimeSpan ts = CommonGUI.GetRememberMPUntil().Subtract(DateTime.Now);
|
||||||
|
m_iRememberSeconds = ts.Seconds;
|
||||||
|
//StartRememberTimer();
|
||||||
|
|
||||||
|
// display the values
|
||||||
|
tvResults.RemoveColumn(tvResults.GetColumn(2));
|
||||||
|
tvCol = new TreeViewColumn("Value", new CellRendererText(), "text", 3);
|
||||||
|
tvResults.InsertColumn(tvCol, 2);
|
||||||
|
}
|
||||||
|
else if (true == cbShowValues.Active)
|
||||||
|
{
|
||||||
|
// prompt user for MasterPassword
|
||||||
|
|
||||||
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
|
||||||
|
gxmlTemp.Autoconnect(this);
|
||||||
|
dialogLogin.TransientFor = dialogFindAndReplace;
|
||||||
|
|
||||||
|
label86.Text = "Enter your Master Password to view values";
|
||||||
|
entryMasterPassword3.Text = "";
|
||||||
|
entryMasterPassword3.HasFocus = true;
|
||||||
|
label88.Hide();
|
||||||
|
entryMasterPassword4.Hide();
|
||||||
|
|
||||||
|
labelRememberFor.Visible = false;
|
||||||
|
labelSeconds.Visible = false;
|
||||||
|
spinbuttonRememberFor.Visible = false;
|
||||||
|
//spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
|
||||||
|
|
||||||
|
//dialogLogin.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tvResults.RemoveColumn(tvResults.GetColumn(2));
|
||||||
|
tvCol = new TreeViewColumn("Value", new CellRendererText(), "text", 2);
|
||||||
|
tvResults.InsertColumn(tvCol, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closebuttonLogin_clicked(object abj, EventArgs args)
|
||||||
|
{
|
||||||
|
cbShowValues.Active = false;
|
||||||
|
dialogLogin.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OnDialogLoginDeleted(object obj, DeleteEventArgs args)
|
||||||
|
{
|
||||||
|
cbShowValues.Active = false;
|
||||||
|
dialogLogin.Destroy();
|
||||||
|
args.RetVal = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void bttnOk_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (bttnApply.Sensitive)
|
||||||
|
{
|
||||||
|
bttnApply_Clicked(sender, e);
|
||||||
|
}
|
||||||
|
CloseDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnFind_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (entryFind.Text != null && entryFind.Text.Length > 0)
|
||||||
|
{
|
||||||
|
DoFind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Error, "You must enter a value to find");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnRevert_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// show cancel
|
||||||
|
bttnCancel.Visible = true;
|
||||||
|
|
||||||
|
// hide revert
|
||||||
|
bttnRevert.Visible = false;
|
||||||
|
|
||||||
|
bttnApply.Sensitive = bttnOk.Sensitive = false;
|
||||||
|
|
||||||
|
// reload
|
||||||
|
DoFind();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnCancel_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
CloseDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnApply_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TreeIter iter;
|
||||||
|
|
||||||
|
// iterate thru store, update all values with dirtybit=true
|
||||||
|
if (tsResults.GetIterFirst(out iter))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
bool bDirty = (bool)tsResults.GetValue(iter, 4);
|
||||||
|
if (bDirty)
|
||||||
|
{
|
||||||
|
String sID = (string)tsResults.GetValue(iter, 0);
|
||||||
|
String sKey = (string)tsResults.GetValue(iter, 1);
|
||||||
|
String sValue = (string)tsResults.GetValue(iter, 3);
|
||||||
|
|
||||||
|
if (StoreDataInterface.ModifyCASASecretKey(sID, sKey, sValue))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Updating {0} : {1} : {2}", sID, sKey, sValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update CASAManager view
|
||||||
|
m_store.AggregateStore();
|
||||||
|
|
||||||
|
}
|
||||||
|
} while (tsResults.IterNext(ref iter));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// hide revert
|
||||||
|
bttnRevert.Visible = false;
|
||||||
|
bttnCancel.Visible = true;
|
||||||
|
|
||||||
|
bttnApply.Sensitive = false;
|
||||||
|
bttnOk.Sensitive = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseDialog()
|
||||||
|
{
|
||||||
|
if (dialogFindAndReplace != null)
|
||||||
|
{
|
||||||
|
dialogFindAndReplace.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoFind()
|
||||||
|
{
|
||||||
|
|
||||||
|
string selected = null;
|
||||||
|
string[] keys = null,
|
||||||
|
values = null;
|
||||||
|
|
||||||
|
// clear current vies
|
||||||
|
tsResults.Clear();
|
||||||
|
|
||||||
|
// iterate thru CASA TreeStore, finding matches
|
||||||
|
TreeIter iter;
|
||||||
|
|
||||||
|
if (m_tsCASA.GetIterFirst(out iter))
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
selected = (string)m_tmCASA.GetValue(iter, 0);
|
||||||
|
keys = (string[])m_tmCASA.GetValue(iter, 1);
|
||||||
|
values = (string[])m_tmCASA.GetValue(iter, 2);
|
||||||
|
|
||||||
|
// add matches to the results
|
||||||
|
for (int i = 0; i < keys.Length; i++)
|
||||||
|
{
|
||||||
|
if ((entryFind.Text.Equals("*")) ||
|
||||||
|
(values[i].IndexOf(entryFind.Text) > -1))
|
||||||
|
{
|
||||||
|
tsResults.AppendValues(selected, keys[i], "*******", values[i], false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (m_tsCASA.IterNext(ref iter));
|
||||||
|
|
||||||
|
//tvResults.Selection.SelectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnReplaceAll_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TreePath[] treePaths = tvResults.Selection.GetSelectedRows();
|
||||||
|
TreeIter iter;
|
||||||
|
|
||||||
|
if (entryNewValue.Text == null || entryNewValue.Text.Length == 0)
|
||||||
|
{
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Warning, "Enter a new value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (treePaths.Length == 0)
|
||||||
|
{
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Warning, "You must select at least one row");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entryNewValue.Text != null && entryNewValue.Text.Length > 0)
|
||||||
|
{
|
||||||
|
// iterate thru those to change
|
||||||
|
for (int i = 0; i < treePaths.Length; i++)
|
||||||
|
{
|
||||||
|
if (tsResults.GetIter(out iter, treePaths[i]))
|
||||||
|
{
|
||||||
|
string sCurrentValue = (string)tsResults.GetValue(iter, 3);
|
||||||
|
|
||||||
|
// change if newValue is different
|
||||||
|
if (!sCurrentValue.Equals(entryNewValue.Text))
|
||||||
|
{
|
||||||
|
tsResults.SetValue(iter, 2, entryNewValue.Text);
|
||||||
|
tsResults.SetValue(iter, 3, entryNewValue.Text);
|
||||||
|
|
||||||
|
// set the dirty bit
|
||||||
|
tsResults.SetValue(iter, 4, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bttnApply.Sensitive = bttnOk.Sensitive = true;
|
||||||
|
|
||||||
|
bttnRevert.Visible = true;
|
||||||
|
bttnCancel.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private bool bTimerActive = false;
|
||||||
|
public void StartRememberTimer()
|
||||||
|
{
|
||||||
|
if (!bTimerActive)
|
||||||
|
{
|
||||||
|
GLib.Timeout.Add((uint)(m_iRememberSeconds * 1000), new GLib.TimeoutHandler(update_gui));
|
||||||
|
bTimerActive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
* */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
|
||||||
|
using Gtk;
|
||||||
|
|
||||||
using Novell.CASA.MiCasa.Communication;
|
using Novell.CASA.MiCasa.Communication;
|
||||||
using Novell.CASA.MiCasa.Common;
|
using Novell.CASA.MiCasa.Common;
|
||||||
@ -15,13 +18,30 @@ namespace Novell.CASA.GUI
|
|||||||
public MiCasa m_objMiCasa = null;
|
public MiCasa m_objMiCasa = null;
|
||||||
string sFile = null;
|
string sFile = null;
|
||||||
byte[] buffer = null;
|
byte[] buffer = null;
|
||||||
|
TreeStore tsConflicts;
|
||||||
|
|
||||||
|
SecretStore m_ss = null;
|
||||||
|
StringCollection m_scConflicts;
|
||||||
|
|
||||||
|
#region GladeWidgets
|
||||||
[Glade.Widget]
|
[Glade.Widget]
|
||||||
Gtk.Entry entryMasterPassword;
|
Gtk.Entry entryMasterPassword;
|
||||||
|
|
||||||
[Glade.Widget]
|
[Glade.Widget]
|
||||||
Gtk.Dialog dialogImport,
|
Gtk.Dialog dialogImport,
|
||||||
dialogLogin;
|
dialogLogin,
|
||||||
|
dialogResolveConflict;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.TreeView tvConflicts;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.Button bttnImport,
|
||||||
|
bttnIgnore;
|
||||||
|
|
||||||
|
[Glade.Widget]
|
||||||
|
Gtk.CheckButton cbShowValues;
|
||||||
|
#endregion
|
||||||
|
|
||||||
public ImportSecrets(Config config, MiCasa objMiCasa)
|
public ImportSecrets(Config config, MiCasa objMiCasa)
|
||||||
{
|
{
|
||||||
@ -75,7 +95,20 @@ namespace Novell.CASA.GUI
|
|||||||
{
|
{
|
||||||
ImportXMLSecrets addSecrets = new ImportXMLSecrets(null, null, sFile);
|
ImportXMLSecrets addSecrets = new ImportXMLSecrets(null, null, sFile);
|
||||||
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_ADD_XML_SECRETS, null, null, null, addSecrets);
|
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_ADD_XML_SECRETS, null, null, null, addSecrets);
|
||||||
|
|
||||||
|
// check for conflicts
|
||||||
|
if (m_ss == null)
|
||||||
|
m_ss = SecretStore.getInstance();
|
||||||
|
|
||||||
|
m_scConflicts = m_ss.enumerateSecretIDs(SecretStore.SSCS_CONFLICT_KEYCHAIN);
|
||||||
|
if (m_scConflicts.Count > 0)
|
||||||
|
{
|
||||||
|
HandleConficts(m_ss, m_scConflicts);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Import complete");
|
CommonGUI.DisplayMessage(Gtk.MessageType.Info, "Import complete");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -167,5 +200,217 @@ namespace Novell.CASA.GUI
|
|||||||
dialogImport.Destroy();
|
dialogImport.Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleConficts(SecretStore store, StringCollection scConflicts)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool bShowConflictDialog = false;
|
||||||
|
|
||||||
|
// 0:secretID, 1:keyID, 2:importValue, 3:currentValue
|
||||||
|
tsConflicts = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||||
|
|
||||||
|
StringEnumerator sEnum = scConflicts.GetEnumerator();
|
||||||
|
{
|
||||||
|
while (sEnum.MoveNext())
|
||||||
|
{
|
||||||
|
string sSecretID = sEnum.Current;
|
||||||
|
Secret currentSecret = store.getSecret(sSecretID);
|
||||||
|
|
||||||
|
string sConflictSecretID;
|
||||||
|
if (sSecretID.StartsWith("SS_CredSet"))
|
||||||
|
{
|
||||||
|
sConflictSecretID = sSecretID.Substring(11);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sConflictSecretID = sSecretID;
|
||||||
|
}
|
||||||
|
Secret conflictSecret = store.getSecret(SecretStore.SSCS_CONFLICT_KEYCHAIN, 0, sConflictSecretID, Secret.SS_CREDSET, "");
|
||||||
|
|
||||||
|
// add this conflict to the treestore
|
||||||
|
NameValueCollection nvcConflict = conflictSecret.getKeyValueCollection();
|
||||||
|
NameValueCollection nvcCurrent = currentSecret.getKeyValueCollection();
|
||||||
|
for (int i = 0; i < nvcConflict.Count; i++)
|
||||||
|
{
|
||||||
|
String sConflictKey = nvcConflict.GetKey(i);
|
||||||
|
String sConflictValue = nvcConflict.Get(sConflictKey);
|
||||||
|
String sCurrentValue = nvcCurrent.Get(sConflictKey);
|
||||||
|
|
||||||
|
if (sCurrentValue != null)
|
||||||
|
{
|
||||||
|
if (sCurrentValue != sConflictValue)
|
||||||
|
{
|
||||||
|
tsConflicts.AppendValues(sSecretID, sConflictKey, sConflictValue, sCurrentValue, "*********");
|
||||||
|
bShowConflictDialog = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tsConflicts.AppendValues(sSecretID, sConflictKey, sConflictValue, "", "*********");
|
||||||
|
bShowConflictDialog = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bShowConflictDialog == true)
|
||||||
|
{
|
||||||
|
// show dialog
|
||||||
|
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogResolveConflict", null);
|
||||||
|
gxmlTemp.Autoconnect(this);
|
||||||
|
|
||||||
|
dialogResolveConflict.SetPosition(WindowPosition.CenterOnParent);
|
||||||
|
|
||||||
|
tvConflicts.AppendColumn("SecretID", new Gtk.CellRendererText(), "text", 0);
|
||||||
|
tvConflicts.AppendColumn("Key", new Gtk.CellRendererText(), "text", 1);
|
||||||
|
if (cbShowValues.Active)
|
||||||
|
{
|
||||||
|
tvConflicts.AppendColumn("Import value", new Gtk.CellRendererText(), "text", 2);
|
||||||
|
tvConflicts.AppendColumn("Current value", new Gtk.CellRendererText(), "text", 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tvConflicts.AppendColumn("Import value", new Gtk.CellRendererText(), "text", 4);
|
||||||
|
tvConflicts.AppendColumn("Current value", new Gtk.CellRendererText(), "text", 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
tvConflicts.Selection.Mode = SelectionMode.Multiple;
|
||||||
|
|
||||||
|
// hook up event handlers
|
||||||
|
bttnImport.Clicked += new EventHandler(bttnImport_Clicked);
|
||||||
|
bttnIgnore.Clicked += new EventHandler(bttnIgnore_Clicked);
|
||||||
|
cbShowValues.Toggled += new EventHandler(cbShowValues_Toggled);
|
||||||
|
|
||||||
|
tvConflicts.Model = tsConflicts;
|
||||||
|
dialogResolveConflict.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClearConflicts();
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Info, "Import complete");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cbShowValues_Toggled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TreeViewColumn tvCol;
|
||||||
|
|
||||||
|
if (cbShowValues.Active)
|
||||||
|
{
|
||||||
|
// verify MasterPassword
|
||||||
|
CommonGUI cg = new CommonGUI();
|
||||||
|
if (cg.VerifyMasterPasswordWithUser())
|
||||||
|
{
|
||||||
|
tvConflicts.RemoveColumn(tvConflicts.GetColumn(3));
|
||||||
|
tvConflicts.RemoveColumn(tvConflicts.GetColumn(2));
|
||||||
|
|
||||||
|
// add columns
|
||||||
|
tvCol = new TreeViewColumn("Import value", new CellRendererText(), "text", 2);
|
||||||
|
tvConflicts.InsertColumn(tvCol, 2);
|
||||||
|
|
||||||
|
tvCol = new TreeViewColumn("Current value", new CellRendererText(), "text", 3);
|
||||||
|
tvConflicts.InsertColumn(tvCol, 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cbShowValues.Active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tvConflicts.RemoveColumn(tvConflicts.GetColumn(3));
|
||||||
|
tvConflicts.RemoveColumn(tvConflicts.GetColumn(2));
|
||||||
|
|
||||||
|
// add columns
|
||||||
|
tvCol = new TreeViewColumn("Import value", new CellRendererText(), "text", 4);
|
||||||
|
tvConflicts.InsertColumn(tvCol, 2);
|
||||||
|
|
||||||
|
tvCol = new TreeViewColumn("Current value", new CellRendererText(), "text", 4);
|
||||||
|
tvConflicts.InsertColumn(tvCol, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnIgnore_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ClearConflicts();
|
||||||
|
dialogResolveConflict.Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bttnImport_Clicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DoImport();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoImport()
|
||||||
|
{
|
||||||
|
// get selected rows
|
||||||
|
TreePath[] treePaths = tvConflicts.Selection.GetSelectedRows();
|
||||||
|
TreeIter iter;
|
||||||
|
|
||||||
|
if (treePaths.Length > 0)
|
||||||
|
{
|
||||||
|
// iterate thru those to change
|
||||||
|
for (int i = 0; i < treePaths.Length; i++)
|
||||||
|
{
|
||||||
|
if (tsConflicts.GetIter(out iter, treePaths[i]))
|
||||||
|
{
|
||||||
|
string sSecretID = (string)tsConflicts.GetValue(iter, 0);
|
||||||
|
string sKey = (string)tsConflicts.GetValue(iter, 1);
|
||||||
|
string sNewValue = (string)tsConflicts.GetValue(iter, 2);
|
||||||
|
string sCurValue = (string)tsConflicts.GetValue(iter, 3);
|
||||||
|
|
||||||
|
if ((sCurValue == null) || (sCurValue.Length == 0))
|
||||||
|
{
|
||||||
|
StoreDataInterface.AddCASASecretKey(sSecretID, sKey, sNewValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StoreDataInterface.ModifyCASASecretKey(sSecretID, sKey, sNewValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
tsConflicts.SetValue(iter, 3, sNewValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < treePaths.Length; i++)
|
||||||
|
{
|
||||||
|
if (tsConflicts.GetIter(out iter, treePaths[i]))
|
||||||
|
{
|
||||||
|
tsConflicts.Remove(ref iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// refresh the store
|
||||||
|
//ClearConflicts();
|
||||||
|
m_objMiCasa.AggregateStore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CommonGUI.DisplayMessage(MessageType.Error, "Select the values you want to import");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearConflicts()
|
||||||
|
{
|
||||||
|
// enumerate thru conflicts, clearing each one
|
||||||
|
if (m_ss != null)
|
||||||
|
{
|
||||||
|
if (m_scConflicts != null)
|
||||||
|
{
|
||||||
|
StringEnumerator sEnum = m_scConflicts.GetEnumerator();
|
||||||
|
while (sEnum.MoveNext())
|
||||||
|
{
|
||||||
|
string sSecretID = (string)sEnum.Current;
|
||||||
|
if (sSecretID.StartsWith("SS_CredSet"))
|
||||||
|
{
|
||||||
|
sSecretID = sSecretID.Substring(11);
|
||||||
|
}
|
||||||
|
m_ss.removeSecret(0, SecretStore.SSCS_CONFLICT_KEYCHAIN, null, sSecretID, Secret.SS_CREDSET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tsConflicts.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ CSFILES =$(srcdir)/AssemblyInfo.cs \
|
|||||||
$(srcdir)/ExportSecrets.cs \
|
$(srcdir)/ExportSecrets.cs \
|
||||||
$(srcdir)/FileChooser.cs \
|
$(srcdir)/FileChooser.cs \
|
||||||
$(srcdir)/ImportSecrets.cs \
|
$(srcdir)/ImportSecrets.cs \
|
||||||
|
$(srcdir)/FindAndReplace.cs \
|
||||||
$(srcdir)/Firefox.cs \
|
$(srcdir)/Firefox.cs \
|
||||||
$(srcdir)/GnomeKeyring.cs \
|
$(srcdir)/GnomeKeyring.cs \
|
||||||
$(srcdir)/KdeWallet.cs \
|
$(srcdir)/KdeWallet.cs \
|
||||||
|
@ -988,6 +988,12 @@ public class MiCasa : Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal void FindAndReplaceValues()
|
||||||
|
{
|
||||||
|
FindAndReplace fr = new FindAndReplace(this, tvSecretIDMiCasa.Model, tsSecretIDMiCasa);
|
||||||
|
fr.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
///#######################################################################
|
///#######################################################################
|
||||||
// DELETE SECRET
|
// DELETE SECRET
|
||||||
|
|
||||||
|
@ -988,8 +988,6 @@ namespace Novell.CASA.GUI {
|
|||||||
ad.SetSecret(lastChild,operation,storeIDentifier); //and set it
|
ad.SetSecret(lastChild,operation,storeIDentifier); //and set it
|
||||||
}
|
}
|
||||||
}//STORE_KDEWALLET
|
}//STORE_KDEWALLET
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( Common.OPERATION_ADD_KEY == operation )
|
else if( Common.OPERATION_ADD_KEY == operation )
|
||||||
{
|
{
|
||||||
@ -1017,6 +1015,65 @@ namespace Novell.CASA.GUI {
|
|||||||
return( Common.STATUS_SUCCESS );
|
return( Common.STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool ModifyCASASecretKey(string SecretID, string keyID, string sValue)
|
||||||
|
{
|
||||||
|
return ModifySecretKey(Common.STORE_MICASA, "Default", SecretID, keyID, sValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ModifySecretKey(int StoreID, string keyChainID, string SecretID, string keyID, string sValue)
|
||||||
|
{
|
||||||
|
string ccfSecretPath = "//CCF/miCASA/Keychain[@ID='" + keyChainID + "']/Secret[@ID='" + SecretID + "']/Key[@ID='" + keyID + "']";
|
||||||
|
|
||||||
|
//For Modify operation get to the Node in the tree which needs to be modified
|
||||||
|
XmlNode root = ccfDoc.DocumentElement;
|
||||||
|
XmlNodeList keylist = root.SelectNodes(ccfSecretPath);
|
||||||
|
foreach ( XmlNode key in keylist )
|
||||||
|
{
|
||||||
|
key.ChildNodes[0].InnerText = sValue;
|
||||||
|
ad.SetSecret(key.ParentNode, Common.OPERATION_MODIFY_KEY, StoreID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Make this store independant
|
||||||
|
public static bool AddCASASecretKey(string SecretID, string keyID, string sValue)
|
||||||
|
{
|
||||||
|
XmlElement newKeyElement;
|
||||||
|
string ccfKeyChainPath = "//CCF/miCASA/Keychain[@ID='Default']/Secret[@ID='" + SecretID + "']";
|
||||||
|
string ccfSecretPath = "";
|
||||||
|
|
||||||
|
//Create the Key element
|
||||||
|
newKeyElement = ccfDoc.CreateElement(CCFXML_ELEMENT_KEY);
|
||||||
|
newKeyElement.SetAttribute(CCFXML_ATTRIBUTE_ID, keyID);
|
||||||
|
XmlElement newValue = ccfDoc.CreateElement(CCFXML_ELEMENT_VALUE);
|
||||||
|
newValue.InnerText = sValue;
|
||||||
|
newKeyElement.AppendChild(newValue);
|
||||||
|
|
||||||
|
XmlNode root = ccfDoc.DocumentElement;
|
||||||
|
XmlNodeList keyNodeList = root.SelectNodes(ccfKeyChainPath);
|
||||||
|
XmlNode keyNode = keyNodeList.Item(0);
|
||||||
|
XmlNode lastChild = keyNode.LastChild;
|
||||||
|
keyNode.InsertBefore(newKeyElement, lastChild);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int errcode = ad.SetSecret(keyNode, Common.OPERATION_ADD_KEY, Common.STORE_MICASA);
|
||||||
|
if (errcode == Common.STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///#######################################################################
|
///#######################################################################
|
||||||
/// DUMP THE XML CCF ON CONSOLE
|
/// DUMP THE XML CCF ON CONSOLE
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -85,6 +85,8 @@ namespace sscs.constants
|
|||||||
internal static string SSCS_REMOTE_KEYCHAIN_ID = "SSCS_REMOTE_KEYCHAIN_ID";
|
internal static string SSCS_REMOTE_KEYCHAIN_ID = "SSCS_REMOTE_KEYCHAIN_ID";
|
||||||
internal static string SSCS_LOCAL_REMOTE_KEYCHAIN_ID = "SSCS_LOCAL_REMOTE_KEYCHAIN_ID";
|
internal static string SSCS_LOCAL_REMOTE_KEYCHAIN_ID = "SSCS_LOCAL_REMOTE_KEYCHAIN_ID";
|
||||||
|
|
||||||
|
internal static string SSCS_CONFLICT_KEYCHAIN = "SSCS_CONFLICT_KEYCHAIN_ID";
|
||||||
|
|
||||||
//TBD , Need to look at Novell standard for the desktop
|
//TBD , Need to look at Novell standard for the desktop
|
||||||
internal static string SSCS_WIN_ENGINELOG = "c:\\CSSS.log";
|
internal static string SSCS_WIN_ENGINELOG = "c:\\CSSS.log";
|
||||||
internal static string SSCS_WIN_DEBUGLOG = "c:\\CSSSDEBUG.log";
|
internal static string SSCS_WIN_DEBUGLOG = "c:\\CSSSDEBUG.log";
|
||||||
|
@ -363,6 +363,18 @@ namespace sscs.lss
|
|||||||
|
|
||||||
internal static void AddXMLSecretsToStore(SecretStore userStore, XmlDocument doc)
|
internal static void AddXMLSecretsToStore(SecretStore userStore, XmlDocument doc)
|
||||||
{
|
{
|
||||||
|
// get the conflict keychain
|
||||||
|
KeyChain kcConflict;
|
||||||
|
if (!userStore.CheckIfKeyChainExists(ConstStrings.SSCS_CONFLICT_KEYCHAIN + '\0'))
|
||||||
|
{
|
||||||
|
kcConflict = new KeyChain(ConstStrings.SSCS_CONFLICT_KEYCHAIN + '\0');
|
||||||
|
userStore.AddKeyChain(kcConflict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kcConflict = userStore.GetKeyChain(ConstStrings.SSCS_CONFLICT_KEYCHAIN + '\0');
|
||||||
|
}
|
||||||
|
|
||||||
string xpath = "";
|
string xpath = "";
|
||||||
xpath = "//" + XmlConsts.miCASANode;
|
xpath = "//" + XmlConsts.miCASANode;
|
||||||
XmlNode miCASANode = doc.SelectSingleNode(xpath);
|
XmlNode miCASANode = doc.SelectSingleNode(xpath);
|
||||||
@ -380,8 +392,6 @@ namespace sscs.lss
|
|||||||
{
|
{
|
||||||
keyChain = new KeyChain(keyChainId);
|
keyChain = new KeyChain(keyChainId);
|
||||||
userStore.AddKeyChain(keyChain);
|
userStore.AddKeyChain(keyChain);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -453,15 +463,15 @@ namespace sscs.lss
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( keyChain.CheckIfSecretExists(secretId) == false)
|
//if (keyChain.CheckIfSecretExists(secretId) == false)
|
||||||
{
|
{
|
||||||
keyChain.AddSecret(secret);
|
//keyChain.AddSecret(secret);
|
||||||
XmlNode secretValNode = (secretNode.SelectSingleNode(xpath));
|
XmlNode secretValNode = (secretNode.SelectSingleNode(xpath));
|
||||||
xpath = "descendant::" + XmlConsts.keyNode;
|
xpath = "descendant::" + XmlConsts.keyNode;
|
||||||
|
|
||||||
XmlNodeList keyNodeList = secretValNode.SelectNodes(xpath);
|
XmlNodeList keyNodeList = secretValNode.SelectNodes(xpath);
|
||||||
|
|
||||||
secret = keyChain.GetSecret(secretId);
|
//secret = keyChain.GetSecret(secretId);
|
||||||
foreach (XmlNode keyNode in keyNodeList)
|
foreach (XmlNode keyNode in keyNodeList)
|
||||||
{
|
{
|
||||||
attrColl = keyNode.Attributes;
|
attrColl = keyNode.Attributes;
|
||||||
@ -502,6 +512,21 @@ namespace sscs.lss
|
|||||||
|
|
||||||
}
|
}
|
||||||
}//if ends
|
}//if ends
|
||||||
|
|
||||||
|
// if SecretID already exists, add to the conflict keychain
|
||||||
|
if (keyChain.CheckIfSecretExists(secretId) == false)
|
||||||
|
{
|
||||||
|
keyChain.AddSecret(secret);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (kcConflict.CheckIfSecretExists(secretId))
|
||||||
|
{
|
||||||
|
kcConflict.RemoveSecret(secretId);
|
||||||
|
}
|
||||||
|
kcConflict.AddSecret(secret);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//end of traversing keyChainNodeList
|
}//end of traversing keyChainNodeList
|
||||||
|
@ -105,6 +105,7 @@ namespace sscs.verbs
|
|||||||
byte[] secretIdArr = new byte[secretIdLen];
|
byte[] secretIdArr = new byte[secretIdLen];
|
||||||
Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen);
|
Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen);
|
||||||
secretId = Encoding.UTF8.GetString(secretIdArr);
|
secretId = Encoding.UTF8.GetString(secretIdArr);
|
||||||
|
|
||||||
// Message Format decipher - End
|
// Message Format decipher - End
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -119,20 +120,25 @@ namespace sscs.verbs
|
|||||||
}
|
}
|
||||||
|
|
||||||
SecretStore ssStore;
|
SecretStore ssStore;
|
||||||
|
CSSSLogger.DbgLog("Reading Secret ID: " + secretId);
|
||||||
|
|
||||||
if (extId == 1)
|
if (extId == 1)
|
||||||
{
|
{
|
||||||
#if W32
|
#if W32
|
||||||
|
CSSSLogger.DbgLog("LUID ExtID found");
|
||||||
WinUserIdentifier test = (WinUserIdentifier)userId;
|
WinUserIdentifier test = (WinUserIdentifier)userId;
|
||||||
// NOTE: ONLY ALLOW THE SWITCH IF THE CALLER IS "SYSTEM"
|
// NOTE: ONLY ALLOW THE SWITCH IF THE CALLER IS "SYSTEM"
|
||||||
if ((test.GetUIDLow() == 999) && (test.GetUIDHigh() == 0))
|
if ((test.GetUIDLow() == 999) && (test.GetUIDHigh() == 0))
|
||||||
{
|
{
|
||||||
|
|
||||||
// WINDOWS LUID
|
// WINDOWS LUID
|
||||||
// System Services, like DLU create fake UIDs, store credentials and then want to read that data.
|
// System Services, like DLU create fake UIDs, store credentials and then want to read that data.
|
||||||
luidLow = BitConverter.ToInt32(inBuf, 18 + ((int)keyChainIdLen)+((int)secretIdLen) + 8);
|
luidLow = BitConverter.ToInt32(inBuf, 18 + ((int)keyChainIdLen)+((int)secretIdLen) + 8);
|
||||||
luidHigh = BitConverter.ToInt32(inBuf, 18 + ((int)keyChainIdLen)+((int)secretIdLen) + 12);
|
luidHigh = BitConverter.ToInt32(inBuf, 18 + ((int)keyChainIdLen)+((int)secretIdLen) + 12);
|
||||||
tempUserId = new WinUserIdentifier(luidLow, luidHigh);
|
tempUserId = new WinUserIdentifier(luidLow, luidHigh);
|
||||||
SecretStore ss = SessionManager.CreateUserSession(tempUserId);
|
SecretStore ss = SessionManager.CreateUserSession(tempUserId);
|
||||||
|
|
||||||
|
CSSSLogger.DbgLog("Switching LUID to [" + luidHigh.ToString() + "][" + luidLow.ToString() + "]");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,8 @@ namespace sscs.verbs
|
|||||||
Array.Copy(inBuf,(22+keyChainIdLen+secretIdLen+keyLen),val,0,valLen);
|
Array.Copy(inBuf,(22+keyChainIdLen+secretIdLen+keyLen),val,0,valLen);
|
||||||
valStr = Encoding.UTF8.GetString(val);
|
valStr = Encoding.UTF8.GetString(val);
|
||||||
|
|
||||||
|
CSSSLogger.DbgLog("Writing Secret:Key [" + secretId + ":" + key + "]");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get extension ID
|
// get extension ID
|
||||||
@ -134,6 +136,7 @@ namespace sscs.verbs
|
|||||||
if (extId == 1)
|
if (extId == 1)
|
||||||
{
|
{
|
||||||
#if W32
|
#if W32
|
||||||
|
CSSSLogger.DbgLog("LUID ExtID found");
|
||||||
|
|
||||||
// WINDOWS LUID
|
// WINDOWS LUID
|
||||||
// This is how the Login Capture module on windows, running as System, sets the Desktop Credential.
|
// This is how the Login Capture module on windows, running as System, sets the Desktop Credential.
|
||||||
@ -143,6 +146,9 @@ namespace sscs.verbs
|
|||||||
luidHigh = BitConverter.ToInt32(inBuf, 26 + ((int)keyChainIdLen)+((int)secretIdLen) +((int)keyLen) + (int)valLen + 12);
|
luidHigh = BitConverter.ToInt32(inBuf, 26 + ((int)keyChainIdLen)+((int)secretIdLen) +((int)keyLen) + (int)valLen + 12);
|
||||||
tempUserId = new WinUserIdentifier(luidLow, luidHigh);
|
tempUserId = new WinUserIdentifier(luidLow, luidHigh);
|
||||||
SecretStore ss = SessionManager.CreateUserSession(tempUserId);
|
SecretStore ss = SessionManager.CreateUserSession(tempUserId);
|
||||||
|
|
||||||
|
CSSSLogger.DbgLog("Switching LUID to [" + luidHigh.ToString() + "][" + luidLow.ToString() + "]");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ss.AddKeyChain(new KeyChain("SSCS_SESSION_KEY_CHAIN_ID\0"));
|
ss.AddKeyChain(new KeyChain("SSCS_SESSION_KEY_CHAIN_ID\0"));
|
||||||
|
Loading…
Reference in New Issue
Block a user