diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index aafb221f..5cf8e440 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -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(); + } + } /// /// ******************************************************************** diff --git a/CASA/gui/CommonGUI.cs b/CASA/gui/CommonGUI.cs index 9717cbd6..8681279a 100644 --- a/CASA/gui/CommonGUI.cs +++ b/CASA/gui/CommonGUI.cs @@ -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 /// 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 } } diff --git a/CASA/gui/FindAndReplace.cs b/CASA/gui/FindAndReplace.cs index f60cc09f..f5655315 100644 --- a/CASA/gui/FindAndReplace.cs +++ b/CASA/gui/FindAndReplace.cs @@ -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) diff --git a/CASA/gui/Firefox.cs b/CASA/gui/Firefox.cs index 9b29d5da..7675792e 100644 --- a/CASA/gui/Firefox.cs +++ b/CASA/gui/Firefox.cs @@ -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 { diff --git a/CASA/gui/GnomeKeyring.cs b/CASA/gui/GnomeKeyring.cs index 5854d5e0..293c4fe4 100644 --- a/CASA/gui/GnomeKeyring.cs +++ b/CASA/gui/GnomeKeyring.cs @@ -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 { diff --git a/CASA/gui/KdeWallet.cs b/CASA/gui/KdeWallet.cs index 1a8430a3..68d4dedb 100644 --- a/CASA/gui/KdeWallet.cs +++ b/CASA/gui/KdeWallet.cs @@ -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 { diff --git a/CASA/gui/MiCasa.cs b/CASA/gui/MiCasa.cs index b776dd3c..7f006053 100644 --- a/CASA/gui/MiCasa.cs +++ b/CASA/gui/MiCasa.cs @@ -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 { diff --git a/CASA/micasadk/c_micasadk.vcproj b/CASA/micasadk/c_micasadk.vcproj index cb685bc8..ebeefd36 100644 --- a/CASA/micasadk/c_micasadk.vcproj +++ b/CASA/micasadk/c_micasadk.vcproj @@ -178,7 +178,7 @@ diff --git a/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb b/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb index a8205ac6..e90bdbb6 100644 Binary files a/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb and b/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb differ diff --git a/CASA/package/windows/vs_solutions/CASA32-msi/CASA.suo b/CASA/package/windows/vs_solutions/CASA32-msi/CASA.suo index c2cd4715..249b1008 100644 Binary files a/CASA/package/windows/vs_solutions/CASA32-msi/CASA.suo and b/CASA/package/windows/vs_solutions/CASA32-msi/CASA.suo differ