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] [STAThread]
public static void Main(string[] args) public static void Main(string[] args)
{ {
Logger.DbgLog("GUI:CasaMain.Main() - BEGIN"); Logger.DbgLog("GUI:CasaMain.Main() - BEGIN");
Common.ParseArgs(args); Common.ParseArgs(args);
Common.ReadPlatform(); 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, Gtk.MessageType.Error,
buttonType, buttonType,
message); message);
@ -244,9 +244,16 @@ namespace Novell.CASA.GUI
// setup the users policy directory // setup the users policy directory
MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CREATE_POLICY_DIR); MiCasaRequestReply.Send(MiCasaRequestReply.VERB_CREATE_POLICY_DIR);
if (CommonGUI.UseMasterPassword())
MasterPasswordAuthentication(); {
MasterPasswordAuthentication();
}
else
{
StartWithoutMasterPassword();
}
if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) if (Common.IsTrayAvailable()) // && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON))
{ {
try try
@ -254,13 +261,13 @@ namespace Novell.CASA.GUI
if (Common.bArgShowTrayIcon) if (Common.bArgShowTrayIcon)
{ {
if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true)) if (config.GetConfigSetting(Common.CONFIG_RUN_IN_TRAY, true))
{ {
if (mCasaTray == null) if (mCasaTray == null)
{ {
mCasaTray = new CasaTray(this, config); mCasaTray = new CasaTray(this, config);
if (Common.bArgStartMinimized) if (Common.bArgStartMinimized)
mCasaTray.CasaManagerQuit(); mCasaTray.CasaManagerQuit();
} }
} }
} }
@ -373,8 +380,26 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.InitializeGUI() - END"); 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> /// <summary>
/// ******************************************************************** /// ********************************************************************

View File

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

View File

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

View File

@ -767,21 +767,31 @@ public class Firefox : Store
tvKeyValue.InsertColumn(tvCol, 1); tvKeyValue.InsertColumn(tvCol, 1);
} }
else if (true == cbuttonShowPassword.Active) else if (true == cbuttonShowPassword.Active)
{ {
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); if (CommonGUI.UseMasterPassword())
gxmlTemp.Autoconnect (this); {
dialogLogin.TransientFor = dialogManageSecret; Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
label86.Text = "Enter your Master Password to view passwords"; dialogLogin.TransientFor = dialogManageSecret;
entryMasterPassword3.Text="";
entryMasterPassword3.HasFocus = true; label86.Text = "Enter your Master Password to view passwords";
label88.Hide(); entryMasterPassword3.Text = "";
entryMasterPassword4.Hide(); entryMasterPassword3.HasFocus = true;
labelRememberFor.Visible = true; label88.Hide();
labelSeconds.Visible = true; entryMasterPassword4.Hide();
spinbuttonRememberFor.Visible = true; labelRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); labelSeconds.Visible = true;
dialogLogin.Show(); 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 else
{ {

View File

@ -499,21 +499,32 @@ public class GnomeKeyring : Store
tvKeyValue.InsertColumn(tvCol, 1); tvKeyValue.InsertColumn(tvCol, 1);
} }
else if (true == cbuttonShowPassword.Active) else if (true == cbuttonShowPassword.Active)
{ {
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); if (CommonGUI.UseMasterPassword())
gxmlTemp.Autoconnect (this); {
dialogLogin.TransientFor = dialogManageSecret;
Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
label86.Text = "Enter your Master Password to view passwords"; gxmlTemp.Autoconnect(this);
entryMasterPassword3.Text=""; dialogLogin.TransientFor = dialogManageSecret;
entryMasterPassword3.HasFocus = true;
label88.Hide(); label86.Text = "Enter your Master Password to view passwords";
entryMasterPassword4.Hide(); entryMasterPassword3.Text = "";
labelRememberFor.Visible = true; entryMasterPassword3.HasFocus = true;
labelSeconds.Visible = true; label88.Hide();
spinbuttonRememberFor.Visible = true; entryMasterPassword4.Hide();
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); labelRememberFor.Visible = true;
dialogLogin.Show(); 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 else
{ {

View File

@ -499,21 +499,31 @@ public class KdeWallet : Store
tvKeyValue.InsertColumn(tvCol, 1); tvKeyValue.InsertColumn(tvCol, 1);
} }
else if (true == cbuttonShowPassword.Active) else if (true == cbuttonShowPassword.Active)
{ {
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogLogin", null); if (CommonGUI.UseMasterPassword())
gxmlTemp.Autoconnect (this); {
dialogLogin.TransientFor = dialogManageSecret; Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this);
label86.Text = "Enter your Master Password to view passwords"; dialogLogin.TransientFor = dialogManageSecret;
entryMasterPassword3.Text="";
entryMasterPassword3.HasFocus = true; label86.Text = "Enter your Master Password to view passwords";
label88.Hide(); entryMasterPassword3.Text = "";
entryMasterPassword4.Hide(); entryMasterPassword3.HasFocus = true;
labelRememberFor.Visible = true; label88.Hide();
labelSeconds.Visible = true; entryMasterPassword4.Hide();
spinbuttonRememberFor.Visible = true; labelRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); labelSeconds.Visible = true;
dialogLogin.Show(); 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 else
{ {

View File

@ -568,24 +568,35 @@ namespace Novell.CASA.GUI
} }
else if (true == cbuttonShowPassword.Active) 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); Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogLogin", null);
gxmlTemp.Autoconnect(this); gxmlTemp.Autoconnect(this);
dialogLogin.TransientFor = dialogManageSecret; dialogLogin.TransientFor = dialogManageSecret;
label86.Text = "Enter your Master Password to view values"; label86.Text = "Enter your Master Password to view values";
entryMasterPassword3.Text = ""; entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true; entryMasterPassword3.HasFocus = true;
label88.Hide(); label88.Hide();
entryMasterPassword4.Hide(); entryMasterPassword4.Hide();
labelRememberFor.Visible = true; labelRememberFor.Visible = true;
labelSeconds.Visible = true; labelSeconds.Visible = true;
spinbuttonRememberFor.Visible = true; spinbuttonRememberFor.Visible = true;
spinbuttonRememberFor.Text = m_config.GetConfigSetting(CommonGUI.REMEMBER_SETTING, m_sRememberFor); 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 else
{ {

View File

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