Fix for Zen/Security issue, MasterPassword on Windows is optional by a setting in the Registry.

This commit is contained in:
Jim Norman 2008-03-31 19:16:02 +00:00
parent 8b3f9ade47
commit b83f659d48
8 changed files with 235 additions and 96 deletions

View File

@ -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)

View File

@ -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 = "<b>Master Password Authentication</b>";
label86.Text = "Enter your Master Password to unlock your secrets.";
label87.Text = "Master Password:";
}
else
{
dialogLogin.Title = "CASA - Desktop Password";
label85.Markup = "<b>Password Authentication</b>";
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()
{

View File

@ -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)
{

View File

@ -56,7 +56,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image4481">
<widget class="GtkImage" id="image4507">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -78,7 +78,7 @@
<signal name="activate" handler="OnNewSecretActivated" last_modification_time="Tue, 27 Sep 2005 06:02:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4482">
<widget class="GtkImage" id="image4508">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -99,7 +99,7 @@
<signal name="activate" handler="OnNewKeyActivated" last_modification_time="Tue, 27 Sep 2005 06:02:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4483">
<widget class="GtkImage" id="image4509">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -125,7 +125,7 @@
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4484">
<widget class="GtkImage" id="image4510">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -152,7 +152,7 @@
<signal name="activate" handler="OnLockMiCASASecrets" last_modification_time="Mon, 10 Oct 2005 19:51:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4485">
<widget class="GtkImage" id="image4511">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
<property name="icon_size">1</property>
@ -173,7 +173,7 @@
<signal name="activate" handler="OnUnLockMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4486">
<widget class="GtkImage" id="image4512">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -194,7 +194,7 @@
<signal name="activate" handler="OnDestroyMiCASASecrets" last_modification_time="Tue, 11 Oct 2005 20:12:35 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4487">
<widget class="GtkImage" id="image4513">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -221,7 +221,7 @@
<signal name="activate" handler="on_exportSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4488">
<widget class="GtkImage" id="image4514">
<property name="visible">True</property>
<property name="stock">gtk-floppy</property>
<property name="icon_size">1</property>
@ -242,7 +242,7 @@
<signal name="activate" handler="on_importSecrets_activate" last_modification_time="Mon, 07 Aug 2006 19:38:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4489">
<widget class="GtkImage" id="image4515">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -270,7 +270,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4490">
<widget class="GtkImage" id="image4516">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -306,7 +306,7 @@
<accelerator key="F2" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4491">
<widget class="GtkImage" id="image4517">
<property name="visible">True</property>
<property name="stock">gtk-zoom-fit</property>
<property name="icon_size">1</property>
@ -327,7 +327,7 @@
<signal name="activate" handler="LinkKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4492">
<widget class="GtkImage" id="image4518">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -348,7 +348,7 @@
<signal name="activate" handler="CopyKeyValue" last_modification_time="Fri, 19 Aug 2005 06:23:15 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4493">
<widget class="GtkImage" id="image4519">
<property name="visible">True</property>
<property name="stock">gtk-copy</property>
<property name="icon_size">1</property>
@ -376,7 +376,7 @@
<accelerator key="f" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4494">
<widget class="GtkImage" id="image4520">
<property name="visible">True</property>
<property name="stock">gtk-find-and-replace</property>
<property name="icon_size">1</property>
@ -404,7 +404,7 @@
<accelerator key="Delete" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4495">
<widget class="GtkImage" id="image4521">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -438,7 +438,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image4496">
<widget class="GtkImage" id="image4522">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -460,7 +460,7 @@
<signal name="activate" handler="on_konquerer_activate" last_modification_time="Thu, 02 Mar 2006 07:08:06 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4497">
<widget class="GtkImage" id="image4523">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -481,7 +481,7 @@
<signal name="activate" handler="on_kopete_activate" last_modification_time="Thu, 02 Mar 2006 07:08:44 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4498">
<widget class="GtkImage" id="image4524">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -502,7 +502,7 @@
<signal name="activate" handler="on_networkmanager_activate" last_modification_time="Thu, 02 Mar 2006 07:07:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4499">
<widget class="GtkImage" id="image4525">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -523,7 +523,7 @@
<signal name="activate" handler="on_gaim_activate" last_modification_time="Thu, 02 Mar 2006 07:07:29 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4500">
<widget class="GtkImage" id="image4526">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@ -541,14 +541,14 @@
</child>
<child>
<widget class="GtkImageMenuItem" id="reset_master_password1">
<widget class="GtkImageMenuItem" id="mmiChangeMP">
<property name="visible">True</property>
<property name="label" translatable="yes">_Change Master Password</property>
<property name="use_underline">True</property>
<signal name="activate" handler="ResetMasterPassword" last_modification_time="Wed, 02 Nov 2005 15:28:00 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4501">
<widget class="GtkImage" id="image4527">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -575,7 +575,7 @@
<signal name="activate" handler="Preferences" last_modification_time="Fri, 19 Aug 2005 06:40:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4502">
<widget class="GtkImage" id="image4528">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -603,7 +603,7 @@
<accelerator key="F3" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4503">
<widget class="GtkImage" id="image4529">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="icon_size">1</property>
@ -637,7 +637,7 @@
<signal name="activate" handler="on_create_sample_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:58:41 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4504">
<widget class="GtkImage" id="image4530">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -658,7 +658,7 @@
<signal name="activate" handler="on_remove_test_secrets1_activate" last_modification_time="Fri, 30 Sep 2005 12:59:05 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4505">
<widget class="GtkImage" id="image4531">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -724,7 +724,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image4506">
<widget class="GtkImage" id="image4532">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -751,7 +751,7 @@
<signal name="activate" handler="About" last_modification_time="Thu, 01 Sep 2005 15:30:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4507">
<widget class="GtkImage" id="image4533">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">1</property>
@ -12364,27 +12364,68 @@ the following characters
</child>
<child>
<widget class="GtkLabel" id="label264">
<widget class="GtkVBox" id="vbox197">
<property name="visible">True</property>
<property name="label" translatable="yes">Your Master Password is required to
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="labelExportDialogDesc1">
<property name="label" translatable="yes">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. </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="labelExportDialogDesc2">
<property name="label" translatable="yes">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. </property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">4</property>
@ -12438,7 +12479,7 @@ in clear text. </property>
<property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label265">
<widget class="GtkLabel" id="labelExportDialogPrompt">
<property name="visible">True</property>
<property name="label" translatable="yes">Master Password :</property>
<property name="use_underline">False</property>
@ -12685,7 +12726,7 @@ in clear text. </property>
<property name="visible">True</property>
<property name="label" translatable="yes">The file you selected appears
to be encypted. Please enter
the Master Password used
the Encryption String used
to encrypt this file</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
@ -12755,7 +12796,7 @@ to encrypt this file</property>
<child>
<widget class="GtkLabel" id="label268">
<property name="visible">True</property>
<property name="label" translatable="yes">Master Password :</property>
<property name="label" translatable="yes">Encryption String :</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>

View File

@ -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;

View File

@ -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
}