diff --git a/CASA/gui/CasaMain.cs b/CASA/gui/CasaMain.cs index 5cf8e440..2fc47a1e 100644 --- a/CASA/gui/CasaMain.cs +++ b/CASA/gui/CasaMain.cs @@ -114,29 +114,30 @@ namespace Novell.CASA.GUI [Glade.Widget] Gtk.Button okbuttonPersistentStorage, - buttonChooseDirectory; - - [Glade.Widget] - Gtk.MenuItem mmiNew, - mmiNewKey, - mmiImportSecrets, - mmiExportSecrets, - mmiView, - mmiLink, - mmiCopy, - mmiDelete, - mmiRefresh, - mmiLockSecrets, - mmiUnlockSecrets, - mmiDestroySecrets, - mmiEdit, - mmiOptions, - mmiDebug, - mmiApplicationSSO, - mmiKonquerer, - mmiKopete, - mmiNetworkManager, - mmiGaim; + buttonChooseDirectory; + + [Glade.Widget] + Gtk.MenuItem mmiNew, + mmiNewKey, + mmiImportSecrets, + mmiExportSecrets, + mmiView, + mmiLink, + mmiCopy, + mmiDelete, + mmiRefresh, + mmiLockSecrets, + mmiUnlockSecrets, + mmiDestroySecrets, + mmiEdit, + mmiOptions, + mmiDebug, + mmiApplicationSSO, + mmiKonquerer, + mmiKopete, + mmiNetworkManager, + mmiGaim, + mmiChangeMP; [Glade.Widget] Gtk.RadioButton radiobutton1, @@ -365,7 +366,17 @@ namespace Novell.CASA.GUI else (notebookStores.GetNthPage(Common.STORE_GNOMEKEYRING)).Visible = Common.IS_GNOMEKEYRING; - notebookStores.CurrentPage = Common.STORE_MICASA; + notebookStores.CurrentPage = Common.STORE_MICASA; + + if (CommonGUI.UseMasterPassword()) + { + mmiChangeMP.Visible = true; + } + else + { + mmiChangeMP.Visible = false; + } + if (MiCASAStore.IsLocked()) LockGUI(); @@ -439,7 +450,7 @@ namespace Novell.CASA.GUI // 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 (true == DoPersistentFilesExist()) + if ((false == miCASA.IsSecretPersistent(1,"")) && (true == DoPersistentFilesExist())) { Glade.XML gxmlTemp = new Glade.XML(Common.GladeFile, "dialogDesktopPassword", null); gxmlTemp.Autoconnect(this); @@ -479,7 +490,7 @@ namespace Novell.CASA.GUI if (entryDesktopPassword1.Text.Equals(entryDesktopPassword2.Text)) { - if (miCASA.ValidateDesktopPwd(entryDesktopPassword1.Text)) + if (miCASA.ValidateDesktopPwd(entryDesktopPassword1.Text + '\0')) { // set the desktop password in micasa try @@ -498,9 +509,16 @@ namespace Novell.CASA.GUI } if (dialogDesktopPassword != null) - dialogDesktopPassword.Destroy(); - - MasterPasswordAuthentication(); + dialogDesktopPassword.Destroy(); + + if (CommonGUI.UseMasterPassword()) + { + MasterPasswordAuthentication(); + } + else + { + InitializeGUI(); + } } else { @@ -2213,10 +2231,8 @@ namespace Novell.CASA.GUI public void on_exportSecrets_activate(object obj, EventArgs args) { - ExportSecrets es = new ExportSecrets(config); es.Run(); - } public void on_importSecrets_activate(object obj, EventArgs args) diff --git a/CASA/gui/CommonGUI.cs b/CASA/gui/CommonGUI.cs index 8681279a..3aff1603 100644 --- a/CASA/gui/CommonGUI.cs +++ b/CASA/gui/CommonGUI.cs @@ -43,10 +43,13 @@ namespace Novell.CASA.GUI public static string HINT_DIR = "Export Directory"; public static string HINT_FILENAME = "Export Filename"; - public static string REMEMBER_SETTING = "Remember_Master_Password_Time"; + public static string REMEMBER_SETTING = "Remember_Master_Password_Time"; + private static string CASA_REG_KEY = "SOFTWARE\\Novell\\CASA"; [Glade.Widget] - Gtk.Label label86, + Gtk.Label label85, + label86, + label87, label88; [Glade.Widget] @@ -86,8 +89,21 @@ namespace Novell.CASA.GUI 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"); + if (CommonGUI.UseMasterPassword()) + { + dialogLogin.Title = "CASA - Master Password"; + label85.Markup = "Master Password Authentication"; + label86.Text = "Enter your Master Password to unlock your secrets."; + label87.Text = "Master Password:"; + } + else + { + dialogLogin.Title = "CASA - Desktop Password"; + label85.Markup = "Password Authentication"; + label86.Text = "Enter your Desktop Password to unlock your secrets."; + label87.Text = "Desktop Password:"; + } entryMasterPassword3.Text=""; label88.Hide(); @@ -393,11 +409,36 @@ namespace Novell.CASA.GUI internal static bool UseMasterPassword() { +#if W32 + return IsRegKeySet(CASA_REG_KEY, "UseMasterPassword"); +#else return true; +#endif } -#if W32 +#if W32 + + private static bool IsRegKeySet(string sPath, string sValue) + { + Microsoft.Win32.RegistryKey key; + + try + { + key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sPath); + int iValue = (int)key.GetValue(sValue); + key.Close(); + if (iValue > 0) + { + return true; + } + } + catch (Exception e) + { + + } + return false; + } public static bool IsGTKSharpInstalled() { diff --git a/CASA/gui/ExportSecrets.cs b/CASA/gui/ExportSecrets.cs index 7089606d..5ff66744 100644 --- a/CASA/gui/ExportSecrets.cs +++ b/CASA/gui/ExportSecrets.cs @@ -18,7 +18,10 @@ namespace Novell.CASA.GUI private Config m_config = null; [Glade.Widget] - Gtk.Label label86, + Gtk.Label labelExportDialogDesc1, + labelExportDialogDesc2, + labelExportDialogPrompt, + label86, label88; [Glade.Widget] @@ -49,13 +52,22 @@ namespace Novell.CASA.GUI Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogExport", null); #endif - gxmlTemp.Autoconnect (this); - dialogExport.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain");; - + gxmlTemp.Autoconnect (this); + + if (CommonGUI.UseMasterPassword()) + { + labelExportDialogDesc1.Visible = true; + } + else + { + labelExportDialogDesc2.Visible = true; + labelExportDialogPrompt.Text = "Encryption string:"; + } + dialogExport.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("windowMain"); dialogExport.Destroyed += new EventHandler(dialogExport_Destroyed); - dialogExport.Modal = true; - dialogExport.Show(); + dialogExport.Modal = true; + dialogExport.Show(); } private void dialogExport_Destroyed(object sender, EventArgs e) { @@ -77,14 +89,22 @@ namespace Novell.CASA.GUI } private void on_buttonOkExportSecrets_clicked(object sender, EventArgs args) - { - if( 0 == miCASA.SetMasterPassword(0, entryMasterPassword.Text) ) + { + bool bUseMasterPassword = CommonGUI.UseMasterPassword(); + + if ( ((bUseMasterPassword) && (0 == miCASA.SetMasterPassword(0, entryMasterPassword.Text) )) + || (!bUseMasterPassword)) { string sMasterPWD = entryMasterPassword.Text; string sEncryptString = entryMasterPassword.Text; if (checkbuttonNoEncrypt.Active) - sEncryptString = null; + sEncryptString = null; + + if (entryMasterPassword.Text.Length < 1) + { + sEncryptString = null; + } if (dialogExport != null) { diff --git a/CASA/gui/images/casa.glade b/CASA/gui/images/casa.glade index 09476592..b0332efb 100644 --- a/CASA/gui/images/casa.glade +++ b/CASA/gui/images/casa.glade @@ -56,7 +56,7 @@ True - + True gtk-new 1 @@ -78,7 +78,7 @@ - + True gtk-new 1 @@ -99,7 +99,7 @@ - + True gtk-new 1 @@ -125,7 +125,7 @@ - + True gtk-refresh 1 @@ -152,7 +152,7 @@ - + True gtk-dialog-authentication 1 @@ -173,7 +173,7 @@ - + True gtk-open 1 @@ -194,7 +194,7 @@ - + True gtk-delete 1 @@ -221,7 +221,7 @@ - + True gtk-floppy 1 @@ -242,7 +242,7 @@ - + True gtk-open 1 @@ -270,7 +270,7 @@ - + True gtk-quit 1 @@ -306,7 +306,7 @@ - + True gtk-zoom-fit 1 @@ -327,7 +327,7 @@ - + True gtk-jump-to 1 @@ -348,7 +348,7 @@ - + True gtk-copy 1 @@ -376,7 +376,7 @@ - + True gtk-find-and-replace 1 @@ -404,7 +404,7 @@ - + True gtk-delete 1 @@ -438,7 +438,7 @@ True - + True gtk-execute 1 @@ -460,7 +460,7 @@ - + True gtk-execute 1 @@ -481,7 +481,7 @@ - + True gtk-execute 1 @@ -502,7 +502,7 @@ - + True gtk-execute 1 @@ -523,7 +523,7 @@ - + True gtk-execute 1 @@ -541,14 +541,14 @@ - + True _Change Master Password True - + True gtk-revert-to-saved 1 @@ -575,7 +575,7 @@ - + True gtk-preferences 1 @@ -603,7 +603,7 @@ - + True gtk-properties 1 @@ -637,7 +637,7 @@ - + True gtk-add 1 @@ -658,7 +658,7 @@ - + True gtk-remove 1 @@ -724,7 +724,7 @@ - + True gtk-help 1 @@ -751,7 +751,7 @@ - + True gtk-dialog-info 1 @@ -12364,27 +12364,68 @@ the following characters - + True - Your Master Password is required to + False + 0 + + + + Your Master Password is required to export your secrets. Your secrets will be encrypted using your Master Password. If you wish, you can export your secrets in clear text. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + Enter a string to encrypt your secrets. The +same string will be required when you import +them. + +If you wish, you can export your secrets +in clear text. + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + 4 @@ -12438,7 +12479,7 @@ in clear text. 6 - + True Master Password : False @@ -12685,7 +12726,7 @@ in clear text. True The file you selected appears to be encypted. Please enter -the Master Password used +the Encryption String used to encrypt this file False False @@ -12755,7 +12796,7 @@ to encrypt this file True - Master Password : + Encryption String : False False GTK_JUSTIFY_LEFT diff --git a/CASA/micasad/cache/SecretStore.cs b/CASA/micasad/cache/SecretStore.cs index 88bb0d8c..3f6d3626 100644 --- a/CASA/micasad/cache/SecretStore.cs +++ b/CASA/micasad/cache/SecretStore.cs @@ -157,14 +157,25 @@ namespace sscs.cache if (sDesktopPassword != null) { // verify Desktop password - //state = STATE_OK; - //return true; + if (IsDesktopPassword(sDesktopPassword)) + { + state = STATE_OK; + return true; + } } if (sMasterPassword != null) - { - // verify MasterPassword - if (SetMasterPassword(sMasterPassword)) + { + if (common.CSSSUtils.UseMasterPassword()) + { + // verify MasterPassword + if (SetMasterPassword(sMasterPassword)) + { + state = STATE_OK; + return true; + } + } + else if (IsDesktopPassword(sMasterPassword)) { state = STATE_OK; return true; diff --git a/CASA/micasad/common/CSSSUtils.cs b/CASA/micasad/common/CSSSUtils.cs index f0b6fbbe..1be15960 100644 --- a/CASA/micasad/common/CSSSUtils.cs +++ b/CASA/micasad/common/CSSSUtils.cs @@ -91,6 +91,16 @@ namespace sscs.common return true; #else return IsRegKeySet(CASA_REG_KEY, "CacheDesktopPassword"); +#endif + } + + public static bool UseMasterPassword() + { +#if LINUX + return true; +#else + //return false; + return IsRegKeySet(CASA_REG_KEY, "UseMasterPassword"); #endif } diff --git a/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb b/CASA/package/windows/vs_solutions/CASA32-msi/CASA.ncb index e90bdbb6..7977d4f5 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 249b1008..1bfb46a8 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