Additional ZEN/security issue changes removing the MasterPassword (Work in progress)

This commit is contained in:
Jim Norman 2008-03-28 20:59:10 +00:00
parent f4a458536f
commit 8b3f9ade47
10 changed files with 270 additions and 156 deletions

View File

@ -162,8 +162,8 @@ namespace Novell.CASA.GUI
[STAThread]
public static void Main(string[] args)
{
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
Common.ParseArgs(args);
Common.ReadPlatform();
@ -211,7 +211,7 @@ namespace Novell.CASA.GUI
}
}
MessageDialog md=new MessageDialog(null,Gtk.DialogFlags.Modal,
MessageDialog md = new MessageDialog(null,Gtk.DialogFlags.Modal,
Gtk.MessageType.Error,
buttonType,
message);
@ -244,9 +244,16 @@ namespace Novell.CASA.GUI
// setup the users policy directory
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CREATE_POLICY_DIR);
MasterPasswordAuthentication();
if (CommonGUI.UseMasterPassword())
{
MasterPasswordAuthentication();
}
else
{
StartWithoutMasterPassword();
}
if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON))
{
try
@ -254,13 +261,13 @@ namespace Novell.CASA.GUI
if (Common.bArgShowTrayIcon)
{
if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true))
{
if (mCasaTray == null)
{
mCasaTray = new CasaTray(this, config);
if (Common.bArgStartMinimized)
mCasaTray.CasaManagerQuit();
{
if (mCasaTray == null)
{
mCasaTray = new CasaTray(this, config);
if (Common.bArgStartMinimized)
mCasaTray.CasaManagerQuit();
}
}
}
@ -373,8 +380,26 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - END");
}
public void StartWithoutMasterPassword()
{
Logger.DbgLog("GUI:LoadPersistence - BEGIN");
// did the daemon get restarted before the user created a master password?
// if so, let's ask the user for their desktop password and set it if there's a cache file
if (false == miCASA.IsSecretPersistent(1, ""))
{
if (true == DoPersistentFilesExist())
{
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogDesktopPassword", null);
gxmlTemp.Autoconnect(this);
}
}
else
{
InitializeGUI();
}
}
/// <summary>
/// ********************************************************************

View File

@ -47,7 +47,7 @@ namespace Novell.CASA.GUI
[Glade.Widget]
Gtk.Label label86,
label88;
label88;
[Glade.Widget]
Gtk.Entry entryMasterPassword3,
@ -72,12 +72,10 @@ namespace Novell.CASA.GUI
/// HandleUnlock dialog
/// </summary>
public void HandleUnlock(CasaMain managerInstance, CasaTray trayInstance)
{
{
mCasaInstance = managerInstance;
mTrayInstance = trayInstance;
//Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
#if W32
Glade.XML gxmlTemp = new Glade.XML ("../images/casa.glade", "dialogLogin", null);
@ -87,9 +85,10 @@ namespace Novell.CASA.GUI
#endif
gxmlTemp.Autoconnect (this);
dialogLogin.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");;
label86.Text = "Enter your Master Password to unlock your secrets.";
dialogLogin.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");;
label86.Text = "Enter your Master Password to unlock your secrets.";
entryMasterPassword3.Text="";
label88.Hide();
entryMasterPassword4.Hide();
@ -151,33 +150,65 @@ namespace Novell.CASA.GUI
}
public void okbuttonLogin_clicked(object abj, EventArgs args)
{
if( 0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text) )
{
// unlock it
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
m_bPasswordVerified = true;
dialogLogin.Destroy();
{
if (CommonGUI.UseMasterPassword())
{
if (0 == miCASA.SetMasterPassword(0, entryMasterPassword3.Text))
{
// unlock it
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
m_bPasswordVerified = true;
dialogLogin.Destroy();
//signal now
m_bIsVerifing = false;
}
else
{
// prompt user
MessageDialog md=new MessageDialog(
mainWindow,Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
"Master Password entered is incorrect");
md.Response +=new ResponseHandler(md_Response2);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
md.SetIconFromFile(Common.CASAICONS);
md.Show();
}
//signal now
m_bIsVerifing = false;
}
else
{
// prompt user
MessageDialog md = new MessageDialog(
mainWindow, Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
"Master Password entered is incorrect");
md.Response += new ResponseHandler(md_Response2);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
md.SetIconFromFile(Common.CASAICONS);
md.Show();
}
}
else
{
if (Novell.CASA.miCASA.ValidateDesktopPwd(entryMasterPassword3.Text))
{
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_UNLOCK_STORE, entryMasterPassword3.Text);
m_bPasswordVerified = true;
dialogLogin.Destroy();
//signal now
m_bIsVerifing = false;
}
else
{
// prompt user
MessageDialog md = new MessageDialog(
mainWindow, Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
"Password entered is incorrect");
md.Response += new ResponseHandler(md_Response2);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
md.SetIconFromFile(Common.CASAICONS);
md.Show();
}
}
}
public void closebuttonLogin_clicked(object abj, EventArgs args)
@ -298,36 +329,42 @@ namespace Novell.CASA.GUI
private bool m_bIsVerifing = true;
public bool VerifyMasterPasswordWithUser()
{
//Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
#if W32
Glade.XML gxmlTemp = new Glade.XML ("../images/casa.glade", "dialogLogin", null);
#endif
#if LINUX
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
#endif
gxmlTemp.Autoconnect (this);
dialogLogin.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");;
label86.Text = "Enter your Master Password to continue.";
entryMasterPassword3.Text="";
label88.Hide();
entryMasterPassword4.Hide();
//dialogLogin.SetPosition(Gtk.WindowPosition.Center);
dialogLogin.Destroyed += new EventHandler(dialogLogin_Destroyed);
dialogLogin.Modal = true;
dialogLogin.Show();
while (m_bIsVerifing)
{
if (UseMasterPassword())
{
// Flush pending events to keep the GUI reponsive
while (Gtk.Application.EventsPending())
Gtk.Application.RunIteration();
Thread.Sleep(100);
//Logger.DbgLog("GUI:CasaMain.Login() - IsMasterPasswordSet returned false");
#if W32
Glade.XML gxmlTemp = new Glade.XML("../images/casa.glade", "dialogLogin", null);
#endif
#if LINUX
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
#endif
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain"); ;
label86.Text = "Enter your Master Password to continue.";
entryMasterPassword3.Text = "";
label88.Hide();
entryMasterPassword4.Hide();
//dialogLogin.SetPosition(Gtk.WindowPosition.Center);
dialogLogin.Destroyed += new EventHandler(dialogLogin_Destroyed);
dialogLogin.Modal = true;
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;
}
return m_bPasswordVerified;
else
{
return true;
}
}
public static void DisplayMessage(Gtk.MessageType messageType, String sMessage)
@ -351,7 +388,13 @@ namespace Novell.CASA.GUI
{
md.Destroy();
}
}
}
internal static bool UseMasterPassword()
{
return true;
}
#if W32
@ -428,10 +471,7 @@ namespace Novell.CASA.GUI
//return null;
}
}
}
#endif
}
}

View File

@ -176,23 +176,31 @@ namespace Novell.CASA.GUI
else if (true == cbShowValues.Active)
{
// prompt user for MasterPassword
if (CommonGUI.UseMasterPassword())
{
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogFindAndReplace;
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();
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();
labelRememberFor.Visible = false;
labelSeconds.Visible = false;
spinbuttonRememberFor.Visible = false;
//spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
//dialogLogin.Show();
}
else
{
// display the values
tvResults.RemoveColumn(tvResults.GetColumn(2));
tvCol = new TreeViewColumn("Value", new CellRendererText(), "text", 3);
tvResults.InsertColumn(tvCol, 2);
}
}
else
{
@ -200,7 +208,6 @@ namespace Novell.CASA.GUI
tvCol = new TreeViewColumn("Value", new CellRendererText(), "text", 2);
tvResults.InsertColumn(tvCol, 2);
}
}
public void closebuttonLogin_clicked(object abj, EventArgs args)

View File

@ -767,21 +767,31 @@ public class Firefox : Store
tvKeyValue.InsertColumn(tvCol, 1);
}
else if (true == cbuttonShowPassword.Active)
{
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect (this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text="";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
{
if (CommonGUI.UseMasterPassword())
{
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
}
else
{
// display the values
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
tvKeyValue.InsertColumn(tvCol, 1);
}
}
else
{

View File

@ -499,21 +499,32 @@ public class GnomeKeyring : Store
tvKeyValue.InsertColumn(tvCol, 1);
}
else if (true == cbuttonShowPassword.Active)
{
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect (this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text="";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
{
if (CommonGUI.UseMasterPassword())
{
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
}
else
{
// display the values
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
tvKeyValue.InsertColumn(tvCol, 1);
}
}
else
{

View File

@ -499,21 +499,31 @@ public class KdeWallet : Store
tvKeyValue.InsertColumn(tvCol, 1);
}
else if (true == cbuttonShowPassword.Active)
{
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect (this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text="";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
{
if (CommonGUI.UseMasterPassword())
{
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
}
else
{
// display the values
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
tvKeyValue.InsertColumn(tvCol, 1);
}
}
else
{

View File

@ -568,24 +568,35 @@ namespace Novell.CASA.GUI
}
else if (true == cbuttonShowPassword.Active)
{
// prompt user for MasterPassword
if (CommonGUI.UseMasterPassword())
{
// prompt user for MasterPassword
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret;
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view values";
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
label86.Text = "Enter your Master Password to view values";
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
label88.Hide();
entryMasterPassword4.Hide();
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
labelRememberFor.Visible = true;
labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor);
dialogLogin.Show();
dialogLogin.Show();
}
else
{
// display the values
tvKeyValue.RemoveColumn(tvKeyValue.GetColumn(1));
tvCol = new TreeViewColumn("Value", cellEditable, "text", 1);
tvKeyValue.InsertColumn(tvCol, 1);
tvKeyValue.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnRightClickedKeyValue);
}
}
else
{

View File

@ -178,7 +178,7 @@
<References>
<ProjectReference
ReferencedProjectIdentifier="{B5DB4B53-AB02-4EDC-9C02-BF7DE68F91A3}"
RelativePathToProject="..\..\..\..\micasacache\c_micasacache.vcproj"
RelativePathToProject="..\..\..\micasacache\c_micasacache.vcproj"
/>
</References>
<Files>