diff --git a/CASA.changes b/CASA.changes
index d8f6d3e2..f554b806 100644
--- a/CASA.changes
+++ b/CASA.changes
@@ -1,3 +1,18 @@
+-------------------------------------------------------------------
+Thu May 4 21:30:25 IST 2006 - smanojna@novell.com
+
+- Description:
+ 1. Fixed Bug 152929: Secret with special characters in name causing
+ unexpected behaviour.
+
+- Modified files:
+ c_gui/images/casa.glade
+ c_gui/Common.cs
+ c_gui/MiCasa.cs
+ c_gui/KdeWallet.cs
+ c_gui/GnomeKeyring.cs
+ c_gui/Firefox.cs
+
-------------------------------------------------------------------
Thu May 4 17:38:25 IST 2006 - smanojna@novell.com
diff --git a/c_gui/Common.cs b/c_gui/Common.cs
index 780ae8fc..fa743f53 100644
--- a/c_gui/Common.cs
+++ b/c_gui/Common.cs
@@ -61,6 +61,13 @@ public class Common
public static int MAX_LEN = 512;
+ static Char[] SpecialCharacters = new Char[]{ '`', '~', '@', '#', '$', '%',
+ '^', '&', '*', '(', ')',
+ '_', '=', '+', '|', '\\',
+ '{', '}', '[', ']', ':',
+ ';', '\"', '\'', '<', '>',
+ ',', '.', '?', '/', '!'};
+
///##############################################################
/// SPI CONSTANTS
///
@@ -383,6 +390,27 @@ public class Common
}
}
}
+
+ ///#######################################################################
+ /// VALIDATE STRINGS FOR SPECIAL CHARACTERS
+
+ ///
+ /// Validate strings for special characters
+ ///
+ public static bool ValidateString(string sString)
+ {
+ Console.WriteLine("ValidateString(): " + sString);
+ if( -1 == sString.IndexOfAny(SpecialCharacters) )
+ {
+ //Console.WriteLine("VS: true");
+ return true;
+ }
+ else
+ {
+ //Console.WriteLine("VS: false");
+ return false;
+ }
+ }
}
}
diff --git a/c_gui/Firefox.cs b/c_gui/Firefox.cs
index 9725c5d0..62436634 100644
--- a/c_gui/Firefox.cs
+++ b/c_gui/Firefox.cs
@@ -56,7 +56,8 @@ public class Firefox : Store
Gtk.Dialog dialogNewSecret,
dialogManageSecret,
dialogLogin,
- dialogConfirmDelete;
+ dialogConfirmDelete,
+ dialogSpecialCharacter;
[Glade.Widget]
Gtk.Menu menuRightClick;
@@ -303,7 +304,8 @@ public class Firefox : Store
if( false == entrySecretID.Editable )
{
- if( ("" != args.NewText) && (KeyValue != args.NewText) )
+ if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) && true == Common.ValidateString(args.NewText) )
+ {
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_FIREFOX, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
{
Logger.DbgLog("GUI:Firefox.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
@@ -327,13 +329,19 @@ public class Firefox : Store
}
else
Logger.DbgLog("GUI:Firefox.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
+ }
+ else if( false == Common.ValidateString(args.NewText) )
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ }
}
- else
+ else if( (Common.MAX_LEN >= args.NewText.Length) )
{
tvKeyValue.Selection.GetSelected (out model, out iter);
tsKeyValue.SetValue(iter, 1, args.NewText);
tsKeyValue.SetValue(iter, 2, "********");
- }
+ }
}
catch(Exception exp)
{
@@ -351,6 +359,11 @@ public class Firefox : Store
{
}
+ public void on_buttonSCClose_clicked(object obj, EventArgs args)
+ {
+ dialogSpecialCharacter.Destroy();
+ }
+
///
/// REMOVE BUTTON CLICKED
///
diff --git a/c_gui/GnomeKeyring.cs b/c_gui/GnomeKeyring.cs
index 2511078b..6697f4ac 100644
--- a/c_gui/GnomeKeyring.cs
+++ b/c_gui/GnomeKeyring.cs
@@ -66,7 +66,8 @@ public class GnomeKeyring : Store
dialogConfirmDelete,
dialogLogin,
dialogNetworkManager,
- dialogGaim;
+ dialogGaim,
+ dialogSpecialCharacter;
[Glade.Widget]
Gtk.Menu menuRightClick;
@@ -338,7 +339,8 @@ public class GnomeKeyring : Store
if( false == entrySecretID.Editable )
{
- if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) )
+ if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) && true == Common.ValidateString(args.NewText) )
+ {
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_GNOMEKEYRING, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
{
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
@@ -362,8 +364,14 @@ public class GnomeKeyring : Store
}
else
Logger.DbgLog("GUI:GnomeKeyring.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
+ }
+ else if( false == Common.ValidateString(args.NewText) )
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ }
}
- else
+ else if( (Common.MAX_LEN >= args.NewText.Length) )
{
tvKeyValue.Selection.GetSelected (out model, out iter);
tsKeyValue.SetValue(iter, 1, args.NewText);
@@ -408,17 +416,30 @@ public class GnomeKeyring : Store
}
while( tsKeyValue.IterNext(ref iterKey) );
}
- if( -1 == (arrKeys.IndexOf(entryKey.Text)) )
+ if( -1 == arrKeys.IndexOf(entryKey.Text) )
+ if( true == Common.ValidateString(entryKey.Text) && true == Common.ValidateString(entryValue.Text) )
+ {
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
-
+ entryKey.Text = entryValue.Text = "";
+ }
+ else
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ //dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
+ }
//tvKeyValue.Selection.SelectIter(iterKey);
- entryKey.Text = entryValue.Text = "";
entryKey.HasFocus = true;
}
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewAdd_clicked() - END");
}
+ public void on_buttonSCClose_clicked(object obj, EventArgs args)
+ {
+ dialogSpecialCharacter.Destroy();
+ }
+
///
/// REMOVE BUTTON CLICKED
///
@@ -715,9 +736,9 @@ public class GnomeKeyring : Store
ArrayList arrKeys = null,
arrValues = null;
- if ((true == entrySecretID.Editable) && (entrySecretID.Text.IndexOf("*") > -1))
+ if ( true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text) )
{
- // prompt user
+ /*// prompt user
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
@@ -726,7 +747,10 @@ public class GnomeKeyring : Store
md.Response += new ResponseHandler(md_Response);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
- md.Show();
+ md.Show();*/
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ entrySecretID.HasFocus = true;
return;
}
diff --git a/c_gui/KdeWallet.cs b/c_gui/KdeWallet.cs
index 1dd9991b..65f187c8 100644
--- a/c_gui/KdeWallet.cs
+++ b/c_gui/KdeWallet.cs
@@ -71,7 +71,8 @@ public class KdeWallet : Store
dialogConfirmDelete,
dialogLogin,
dialogKonquerer,
- dialogKopete;
+ dialogKopete,
+ dialogSpecialCharacter;
[Glade.Widget]
Gtk.Menu menuRightClick;
@@ -338,7 +339,8 @@ public class KdeWallet : Store
if( false == entrySecretID.Editable )
{
- if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) )
+ if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) && true == Common.ValidateString(args.NewText) )
+ {
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_KDEWALLET, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
{
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
@@ -362,8 +364,14 @@ public class KdeWallet : Store
}
else
Logger.DbgLog("GUI:KdeWallet.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
+ }
+ else if( false == Common.ValidateString(args.NewText) )
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ }
}
- else
+ else if( (Common.MAX_LEN >= args.NewText.Length) )
{
tvKeyValue.Selection.GetSelected (out model, out iter);
tsKeyValue.SetValue(iter, 1, args.NewText);
@@ -407,17 +415,30 @@ public class KdeWallet : Store
}
while( tsKeyValue.IterNext(ref iterKey) );
}
- if( -1 == (arrKeys.IndexOf(entryKey.Text)) )
+ if( -1 == arrKeys.IndexOf(entryKey.Text) )
+ if( true == Common.ValidateString(entryKey.Text) && true == Common.ValidateString(entryValue.Text) )
+ {
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
-
+ entryKey.Text = entryValue.Text = "";
+ }
+ else
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ //dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
+ }
//tvKeyValue.Selection.SelectIter(iterKey);
- entryKey.Text = entryValue.Text = "";
entryKey.HasFocus = true;
}
Logger.DbgLog("GUI:KdeWallet.on_buttonNewAdd_clicked() - END");
}
+ public void on_buttonSCClose_clicked(object obj, EventArgs args)
+ {
+ dialogSpecialCharacter.Destroy();
+ }
+
///
/// REMOVE BUTTON CLICKED
///
@@ -714,9 +735,9 @@ public class KdeWallet : Store
ArrayList arrKeys = null,
arrValues = null;
- if ((true == entrySecretID.Editable) && (entrySecretID.Text.IndexOf("*") > -1))
+ if ( true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text) )
{
- // prompt user
+ /*// prompt user
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
@@ -725,7 +746,10 @@ public class KdeWallet : Store
md.Response += new ResponseHandler(md_Response);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
- md.Show();
+ md.Show();*/
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ entrySecretID.HasFocus = true;
return;
}
diff --git a/c_gui/MiCasa.cs b/c_gui/MiCasa.cs
index 300a3675..959a10e7 100644
--- a/c_gui/MiCasa.cs
+++ b/c_gui/MiCasa.cs
@@ -73,7 +73,8 @@ public class MiCasa : Store
dialogManageSecret,
dialogConfirmDelete,
dialogLogin,
- dialogLinkKeyValue;
+ dialogLinkKeyValue,
+ dialogSpecialCharacter;
[Glade.Widget]
Gtk.Menu menuRightClick;
@@ -364,7 +365,8 @@ public class MiCasa : Store
if( false == entrySecretID.Editable )
{
- if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) )
+ if( ("" != args.NewText) && (Common.MAX_LEN >= args.NewText.Length) && (KeyValue != args.NewText) && true == Common.ValidateString(args.NewText) )
+ {
if( Common.STATUS_SUCCESS == StoreDataInterface.UpdateStore(Common.STORE_MICASA, Common.OPERATION_MODIFY_KEY, KeyName, args.NewText, ref model, ref iter) )
{
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - StoreDataInterface.UpdateStore() succeeded");
@@ -388,8 +390,14 @@ public class MiCasa : Store
}
else
Logger.DbgLog("GUI:MiCasa.OnKeyValueEdited() - ERROR: STATUS_STORE_UPDATEFAILED");
+ }
+ else if( false == Common.ValidateString(args.NewText) )
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ }
}
- else
+ else if( (Common.MAX_LEN >= args.NewText.Length) )
{
tvKeyValue.Selection.GetSelected (out model, out iter);
tsKeyValue.SetValue(iter, 1, args.NewText);
@@ -416,14 +424,12 @@ public class MiCasa : Store
{
Logger.DbgLog("GUI:MiCasa.on_buttonNewAdd_clicked() - BEGIN");
- if( ("" != entryKey.Text) && ("" != entryValue.Text) )
+ if( ("" != entryKey.Text) && ("" != entryValue.Text) )
{
TreeIter iterKey;
- ArrayList arrKeys = null,
- arrValues = null;
object val = null;
- arrKeys = new ArrayList();
- arrValues = new ArrayList();
+ ArrayList arrKeys = new ArrayList();
+ ArrayList arrValues = new ArrayList();
if(tsKeyValue.GetIterFirst(out iterKey))
{
@@ -436,17 +442,29 @@ public class MiCasa : Store
}
while( tsKeyValue.IterNext(ref iterKey) );
}
- if( -1 == (arrKeys.IndexOf(entryKey.Text)) )
+ if( -1 == arrKeys.IndexOf(entryKey.Text) )
+ if( true == Common.ValidateString(entryKey.Text) && true == Common.ValidateString(entryValue.Text) )
+ {
iterKey = tsKeyValue.AppendValues(entryKey.Text, entryValue.Text, "********", true, "No");
-
+ entryKey.Text = entryValue.Text = "";
+ }
+ else
+ {
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ //dialogSpecialCharacter.TransientFor = (Gtk.Window)CasaMain.gxmlMain.GetWidget("dialogNewSecret");
+ }
//tvKeyValue.Selection.SelectIter(iterKey);
- entryKey.Text = entryValue.Text = "";
entryKey.HasFocus = true;
}
Logger.DbgLog("GUI:MiCasa.on_buttonNewAdd_clicked() - END");
}
+ public void on_buttonSCClose_clicked(object obj, EventArgs args)
+ {
+ dialogSpecialCharacter.Destroy();
+ }
///
/// REMOVE BUTTON CLICKED
@@ -809,9 +827,9 @@ public class MiCasa : Store
ArrayList arrKeys = null,
arrValues = null;
- if ((true == entrySecretID.Editable) && (entrySecretID.Text.IndexOf("*") > -1))
+ if ( true == entrySecretID.Editable && false == Common.ValidateString(entrySecretID.Text) )
{
- // prompt user
+ /*// prompt user
MessageDialog md=new MessageDialog(this.windowMain,Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.Ok,
@@ -820,7 +838,10 @@ public class MiCasa : Store
md.Response += new ResponseHandler(md_Response);
md.SetPosition(Gtk.WindowPosition.CenterOnParent);
md.Modal = true;
- md.Show();
+ md.Show();*/
+ Glade.XML gxmlTemp = new Glade.XML (Common.GladeFile, "dialogSpecialCharacter", null);
+ gxmlTemp.Autoconnect (this);
+ entrySecretID.HasFocus = true;
return;
}
diff --git a/c_gui/images/casa.glade b/c_gui/images/casa.glade
index 9ffd20cc..aa0731b1 100644
--- a/c_gui/images/casa.glade
+++ b/c_gui/images/casa.glade
@@ -5647,7 +5647,7 @@ prompted for the Master Password at startup.
GTK_WIN_POS_NONE
False
True
- False
+ True
CASAicons.ico
True
False
@@ -7061,7 +7061,7 @@ and try running CASAManager again.
GTK_WIN_POS_CENTER_ON_PARENT
True
False
- False
+ True
CASAicons.ico
True
False
@@ -11176,4 +11176,166 @@ password to view the secrets.
+
+ 4
+ True
+ Warning
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_CENTER_ON_PARENT
+ True
+ False
+ True
+ CASAicons.ico
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+ True
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+
+ True
+ True
+ True
+ gtk-close
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -7
+
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ gtk-dialog-warning
+ 6
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+ 0
+ False
+ True
+
+
+
+
+ 4
+ True
+ True
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ <b>Secret ID, Key and Value names cannot have these special characters.</b>
+ False
+ True
+ GTK_JUSTIFY_LEFT
+ True
+ False
+ 0
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 5
+ False
+ False
+
+
+
+
+
+ True
+ Special characters:
+~!@#$%^&*()_+=[]{}|\;':"<>,.?/
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ True
+ False
+ 0
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 4
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
+
+