Bug 235624. Fix GUI hang on multiple file imports.
This commit is contained in:
parent
03c5d13eee
commit
ca7b9ebb9b
@ -2188,11 +2188,12 @@ namespace Novell.CASA.GUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void on_importSecrets_activate(object obj, EventArgs args)
|
public void on_importSecrets_activate(object obj, EventArgs args)
|
||||||
{
|
{
|
||||||
ImportSecrets importSecrets = new ImportSecrets(config, objMiCasa);
|
if (objMiCasa != null)
|
||||||
importSecrets.Run();
|
{
|
||||||
if (objMiCasa != null)
|
objMiCasa.DoFileImport(config);
|
||||||
objMiCasa.AggregateStore();
|
objMiCasa.AggregateStore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,8 +43,9 @@ namespace Novell.CASA.GUI
|
|||||||
Gtk.CheckButton cbShowValues;
|
Gtk.CheckButton cbShowValues;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public ImportSecrets(Config config, MiCasa objMiCasa)
|
public ImportSecrets(SecretStore ss, Config config, MiCasa objMiCasa)
|
||||||
{
|
{
|
||||||
|
m_ss = ss;
|
||||||
m_config = config;
|
m_config = config;
|
||||||
m_objMiCasa = objMiCasa;
|
m_objMiCasa = objMiCasa;
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1425,10 @@ public class MiCasa : Store
|
|||||||
string value = null;
|
string value = null;
|
||||||
|
|
||||||
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
if (tvKeyValue.Selection.GetSelected(out model, out iter))
|
||||||
{
|
{
|
||||||
|
byte[] baValue = new byte[0];
|
||||||
|
byte[] baTarget = new byte[0];
|
||||||
|
|
||||||
selected = (string)model.GetValue(iter, 0);
|
selected = (string)model.GetValue(iter, 0);
|
||||||
value = (string)model.GetValue(iter, 1);
|
value = (string)model.GetValue(iter, 1);
|
||||||
|
|
||||||
@ -1435,24 +1438,24 @@ public class MiCasa : Store
|
|||||||
SecretStore ss = GetMiCasaStore();
|
SecretStore ss = GetMiCasaStore();
|
||||||
Secret secret = ss.GetSecret(entrySecretID.Text);
|
Secret secret = ss.GetSecret(entrySecretID.Text);
|
||||||
value = secret.GetKeyValue(selected);
|
value = secret.GetKeyValue(selected);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// strip of header data
|
// strip of header data
|
||||||
byte[] baValue = System.Text.Encoding.ASCII.GetBytes(value);
|
baValue = System.Text.Encoding.ASCII.GetBytes(value);
|
||||||
byte[] baTarget = new byte[baValue.Length - 16];
|
if (baValue.Length > 16)
|
||||||
|
{
|
||||||
Array.Copy(baValue, 13, baTarget, 0, baValue.Length - 16);
|
baTarget = new byte[baValue.Length - 16];
|
||||||
try
|
Array.Copy(baValue, 13, baTarget, 0, baValue.Length - 16);
|
||||||
|
}
|
||||||
|
/* 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);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
value = e.ToString();
|
value = e.ToString();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected != null && selected.Length > 0)
|
if (selected != null && selected.Length > 0)
|
||||||
@ -1462,16 +1465,31 @@ public class MiCasa : Store
|
|||||||
|
|
||||||
// display decoded value
|
// display decoded value
|
||||||
//textviewClear.Buffer.Text = value;
|
//textviewClear.Buffer.Text = value;
|
||||||
char[] array = value.ToCharArray();
|
//char[] array = value.ToCharArray();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] bytes = Convert.FromBase64CharArray(array, 0, array.Length);
|
if (baTarget.Length > 0)
|
||||||
textviewClear.Buffer.Text = System.Text.Encoding.ASCII.GetString(bytes);
|
{
|
||||||
|
baValue = Convert.FromBase64String(System.Text.Encoding.ASCII.GetString(baTarget));
|
||||||
|
value = System.Text.Encoding.ASCII.GetString(baValue);
|
||||||
|
textviewClear.Buffer.Text = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textviewClear.Buffer.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//byte[] bytes = Convert.FromBase64CharArray(array, 0, array.Length);
|
||||||
|
//textviewClear.Buffer.Text = System.Text.Encoding.ASCII.GetString(bytes);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
// decode failed, open it all
|
||||||
textviewClear.Buffer.Text = e.ToString();
|
textviewClear.Buffer.Text = e.ToString();
|
||||||
|
|
||||||
|
bttnExpand_Clicked(null, null);
|
||||||
|
textviewEncoded.Buffer.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook up button handlers
|
// hook up button handlers
|
||||||
@ -1531,6 +1549,13 @@ public class MiCasa : Store
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void DoFileImport(Config config)
|
||||||
|
{
|
||||||
|
ImportSecrets importSecrets = new ImportSecrets(GetMiCasaStore(), config, this);
|
||||||
|
importSecrets.Run();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///##################################################################
|
///##################################################################
|
||||||
|
@ -46,6 +46,11 @@ namespace Novell.CASA
|
|||||||
DoSetup();
|
DoSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~SecretStore()
|
||||||
|
{
|
||||||
|
ReleaseInstance();
|
||||||
|
}
|
||||||
|
|
||||||
private void DoSetup()
|
private void DoSetup()
|
||||||
{
|
{
|
||||||
m_NativeCalls = new NativeCalls();
|
m_NativeCalls = new NativeCalls();
|
||||||
@ -61,8 +66,11 @@ namespace Novell.CASA
|
|||||||
|
|
||||||
public void ReleaseInstance()
|
public void ReleaseInstance()
|
||||||
{
|
{
|
||||||
if (m_hsc != IntPtr.Zero)
|
if (m_hsc != IntPtr.Zero)
|
||||||
m_NativeCalls.CloseSecretStore(m_hsc);
|
{
|
||||||
|
m_NativeCalls.CloseSecretStore(m_hsc);
|
||||||
|
m_hsc = IntPtr.Zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user