-------------------------------------------------------------------

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

-------------------------------------------------------------------
This commit is contained in:
smanojna 2006-05-04 15:58:24 +00:00
parent 021e3b16e5
commit 855346769a
7 changed files with 325 additions and 38 deletions

View File

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

View File

@ -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
/// <summary>
/// Validate strings for special characters
/// </summary>
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;
}
}
}
}

View File

@ -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();
}
/// <summary>
/// REMOVE BUTTON CLICKED
/// </summary>

View File

@ -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();
}
/// <summary>
/// REMOVE BUTTON CLICKED
/// </summary>
@ -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;
}

View File

@ -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();
}
/// <summary>
/// REMOVE BUTTON CLICKED
/// </summary>
@ -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;
}

View File

@ -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();
}
/// <summary>
/// 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;
}

View File

@ -5647,7 +5647,7 @@ prompted for the Master Password at startup.</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="destroy_with_parent">True</property>
<property name="icon">CASAicons.ico</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
@ -7061,7 +7061,7 @@ and try running CASAManager again.</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="destroy_with_parent">True</property>
<property name="icon">CASAicons.ico</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
@ -11176,4 +11176,166 @@ password to view the secrets.</property>
</child>
</widget>
<widget class="GtkDialog" id="dialogSpecialCharacter">
<property name="border_width">4</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Warning</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">True</property>
<property name="icon">CASAicons.ico</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox140">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="hbuttonbox21">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button63">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
<signal name="clicked" handler="on_buttonSCClose_clicked" last_modification_time="Thu, 04 May 2006 14:39:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox81">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="vbox141">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkImage" id="image3758">
<property name="visible">True</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">4</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox142">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="label255">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Secret ID, Key and Value names cannot have these special characters.&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</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">5</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label256">
<property name="visible">True</property>
<property name="label" translatable="yes">Special characters:
~!@#$%^&amp;*()_+=[]{}|\;':&quot;&lt;&gt;,.?/</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</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">4</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>