Bug 175455. Prevent crash when entering MP that is too short and during an upgrade.

This commit is contained in:
Jim Norman 2006-06-05 21:33:03 +00:00
parent d0ecc6faef
commit 43fa2efaf3
3 changed files with 58 additions and 28 deletions

View File

@ -1,3 +1,8 @@
--------------------------------------------------------------------
Mon Jun 05 15:30:53 MST 2006 - jnorman@novell.com
- Bug 175455. Prevent crash when entering MP that is too short and
during an upgrade.
--------------------------------------------------------------------
Thursday May 25 16:15:53 MST 2006 - jnorman@novell.com
- Bug 178796: change the way we generate the new salt so that

View File

@ -133,7 +133,8 @@ namespace Novell.CASA.GUI
[Glade.Widget]
Gtk.DrawingArea drawingarea1;
Gtk.DrawingArea drawingarea1,
drawingarea2;
#endregion
@ -226,8 +227,11 @@ namespace Novell.CASA.GUI
{
try
{
if (mCasaTray == null)
mCasaTray = new CasaTray(this);
if (!Common.IsArgSet(args, Common.ARG_NO_TRAY_ICON))
{
if (mCasaTray == null)
mCasaTray = new CasaTray(this);
}
}
catch (Exception e)
{
@ -505,7 +509,7 @@ namespace Novell.CASA.GUI
private bool DeleteMiCasaFiles()
{
string[] faFiles = Directory.GetFiles(GetUserHomeDir(), ".miCASA*");
string[] faFiles = Directory.GetFiles(Common.GetUserHomeDir(), ".miCASA*");
bool bDeletedFiles = true;
for (int i=0; i<faFiles.Length; i++)
@ -611,9 +615,17 @@ namespace Novell.CASA.GUI
internal void on_buttonRetryShortPassword_clicked(object obj, EventArgs args)
{
dialogShortPassword.Destroy();
entryMasterPassword3.Text = "";
entryMasterPassword4.Text = "";
entryMasterPassword3.HasFocus = true;
if (entryMasterPassword4 != null)
{
entryMasterPassword4.Text = "";
}
if (entryMasterPassword3 != null)
{
entryMasterPassword3.Text = "";
entryMasterPassword3.HasFocus = true;
}
}
internal void on_buttonCloseReprompt_clicked(object obj, EventArgs args)
@ -671,7 +683,7 @@ namespace Novell.CASA.GUI
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - BEGIN");
string MICASA_PASSCODE_BY_MASTER_PASSWD_FILE = "/.miCASAPCByMPasswd";
string fileName = GetUserHomeDir() + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
string fileName = Common.GetUserHomeDir() + MICASA_PASSCODE_BY_MASTER_PASSWD_FILE;
Logger.DbgLog("GUI:CasaMain.IsMasterPasswordSet() - END");
return (File.Exists(fileName));
@ -693,28 +705,16 @@ namespace Novell.CASA.GUI
catch
{
// check for existence of persistent files
string MICASA_PASSCODE_BY_DESKTOP_FILE = "/.miCASAPCByDesktop";
string MICASA_KEY_FILE = "/.miCASAKey";
string MICASA_PERSISTENCE_FILE = "/.miCASA";
string MICASA_VALIDATION_FILE = "/.miCASAValidate";
string sHomeDir = GetUserHomeDir();
string sHomeDir = Common.GetUserHomeDir();
Logger.DbgLog("GUI:CasaMain.DoesPersistentFilesExist() - END");
return (File.Exists(sHomeDir + MICASA_PERSISTENCE_FILE)
&& File.Exists(sHomeDir + MICASA_KEY_FILE)
&& File.Exists(sHomeDir + MICASA_PASSCODE_BY_DESKTOP_FILE)
&& File.Exists(sHomeDir + MICASA_VALIDATION_FILE));
return (File.Exists(sHomeDir + Common.MICASA_PERSISTENCE_FILE)
&& File.Exists(sHomeDir + Common.MICASA_KEY_FILE)
&& File.Exists(sHomeDir + Common.MICASA_PASSCODE_BY_DESKTOP_FILE)
&& File.Exists(sHomeDir + Common.MICASA_VALIDATION_FILE));
}
}
private string GetUserHomeDir()
{
if (Common.IS_LINUX)
return Environment.GetEnvironmentVariable("HOME");
else
return Environment.GetEnvironmentVariable("USERPROFILE");
}
private string GetLocalUsername()
{
if (Common.IS_LINUX)
@ -1249,6 +1249,8 @@ namespace Novell.CASA.GUI
mmiOptions.Sensitive = false;
mmiEdit.Sensitive = false;
m_bGuiLocked = true;
}
internal void UnlockGUI()
@ -1835,6 +1837,10 @@ namespace Novell.CASA.GUI
Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogAbout", null);
gxmlTemp.Autoconnect (this);
Gdk.Color color = new Gdk.Color(90, 77, 189);
drawingarea2.ModifyBg(Gtk.StateType.Normal, color);
dialogAbout.TransientFor = windowMain;
Logger.DbgLog("GUI:CasaMain.About() - END");
}

View File

@ -60,6 +60,11 @@ public class Common
DebugLogFile = null;
public static int MAX_LEN = 512;
public static string MICASA_PASSCODE_BY_DESKTOP_FILE = "/.miCASAPCByDesktop";
public static string MICASA_PASSCODE_BY_MP_FILE = "/.miCASAPCByMPasswd";
public static string MICASA_KEY_FILE = "/.miCASAKey";
public static string MICASA_PERSISTENCE_FILE = "/.miCASA";
public static string MICASA_VALIDATION_FILE = "/.miCASAValidate";
static Char[] SpecialCharacters = new Char[]{ '*', ':', '\'', '\\', '&', '=', '<', '>' };
@ -70,6 +75,8 @@ public class Common
';', '\"', '\'', '<', '>',
',', '.', '?', '/', '!'};
*/
///##############################################################
/// SPI CONSTANTS
@ -120,9 +127,12 @@ public class Common
///##############################################################
/// ARG CONSTANTS
///
public static string ARG_NO_TRAY_ICON = "-notray";
public static string ARG_SHOW_TRAY_ICON = "-tray";
public static string ARG_DEBUG = "-debug";
///#############################################################
///CasaIcons path
#if W32
@ -407,6 +417,15 @@ public class Common
else
return false;
}
internal static string GetUserHomeDir()
{
if (Common.IS_LINUX)
return Environment.GetEnvironmentVariable("HOME");
else
return Environment.GetEnvironmentVariable("USERPROFILE");
}
}
}