Bug 142183. Do not add GKPassword to gnome-keyring. Provided by Manohar

This commit is contained in:
Jim Norman 2006-01-25 21:24:37 +00:00
parent 85b8d6d5ff
commit ada9ed5d86
3 changed files with 431 additions and 397 deletions

View File

@ -1,8 +1,14 @@
-------------------------------------------------------------------
Wed Jan 25 14:18:52 MST 2006 - jnorman@novell.com
- Bug 142183. Do not add GKPassword to gnome-keyring
Provided by Manohar
-------------------------------------------------------------------
Wed Jan 25 14:12:52 MST 2006 - jnorman@novell.com
- Bug 136784. Prevent multiple instances of GUI
Provided by Manojna
Provided by Manohar
-------------------------------------------------------------------
Wed Jan 25 21:43:52 CET 2006 - mls@suse.de

View File

@ -101,15 +101,22 @@ namespace Novell.CASA.DataEngines
typeAttr.Value = itemInfo.itemType.ToString();
secretElem.SetAttributeNode(typeAttr);
XmlElement keyElem = doc.CreateElement(ConstStrings.CCF_KEY);
XmlAttribute keyIdAttr = doc.CreateAttribute(ConstStrings.CCF_ID);
XmlElement keyElem = null;
XmlAttribute keyIdAttr = null;
XmlElement valueElem = null;
if ((itemInfo.secret != null) && (itemInfo.secret.Length != 0))
{
keyElem = doc.CreateElement(ConstStrings.CCF_KEY);
keyIdAttr = doc.CreateAttribute(ConstStrings.CCF_ID);
keyIdAttr.Value = "GKPassword";
keyElem.SetAttributeNode(keyIdAttr);
XmlElement valueElem = doc.CreateElement(ConstStrings.CCF_VALUE);
valueElem = doc.CreateElement(ConstStrings.CCF_VALUE);
valueElem.InnerText = itemInfo.secret;
keyElem.AppendChild(valueElem);
secretElem.AppendChild(keyElem);
}
IEnumerator attrEtor = (IEnumerator)(attrList.GetEnumerator());
while(attrEtor.MoveNext())
@ -192,7 +199,7 @@ namespace Novell.CASA.DataEngines
public int SetSecret(XmlNode secret, int opnType)
{
string password = null;
string password = "";
int retValue;
try
@ -226,24 +233,22 @@ namespace Novell.CASA.DataEngines
return(GnomeKeyring.CreateSecret(keyringname, strItemType, secretName, password, newNVC));
}
//Modify secret Opn
if ( password != null)
{
retValue = GnomeKeyring.SetPassword(keyringname, itemid, password);
if (retValue != 0)
{
return retValue;
}
}
if (newNVC.Count != 0)
{
return (GnomeKeyring.SetAttributes( keyringname, itemid, newNVC));
}
return 0;
}
catch(NullReferenceException n)
@ -284,6 +289,26 @@ namespace Novell.CASA.DataEngines
}
}
public static Boolean IsStoreAvailable()
{
try
{
System.Runtime.InteropServices.Marshal.PrelinkAll(typeof(GnomeKeyring));
return true;
}
catch(DllNotFoundException d)
{
Console.WriteLine("Store Not Available Exception = " + d.ToString());
return false;
}
catch(Exception e)
{
Console.WriteLine("Store Not Available Exception = " + e.ToString());
return false;
}
}
int ExtractSecretId(XmlNode secret)
{
XmlAttributeCollection atcol = secret.Attributes;
@ -352,7 +377,8 @@ namespace Novell.CASA.DataEngines
Console.WriteLine("* 3. Set secret *");
Console.WriteLine("* 4. Remove secret *");
Console.WriteLine("* 5. Refresh *");
Console.WriteLine("* 6. Quit *");
Console.WriteLine("* 6. Is Store Avail *");
Console.WriteLine("* 7. Quit *");
Console.WriteLine("***************************");
Console.WriteLine("For all options the input is the file /root/gktest.xml");
@ -365,8 +391,13 @@ namespace Novell.CASA.DataEngines
char[] c = line.Substring(0, 1).ToCharArray();
if (c.Length > 0)
{
if (c[0].Equals('6'))
if (c[0].Equals('7'))
return;
if (c[0].Equals('6'))
{
Console.WriteLine("Store Available is = " + GKEngine.IsStoreAvailable());
return;
}
if (c[0].Equals('5'))
{
XmlNode node = gk.Aggregate ();
@ -383,13 +414,14 @@ namespace Novell.CASA.DataEngines
XmlTextReader tr = new XmlTextReader("/root/gktest.xml");
tr.Read();
xmlDoc.Load(tr);
XmlNode root = xmlDoc.FirstChild;
XmlNode root = xmlDoc.LastChild;
if (root == null)
{
Console.WriteLine("Root is null");
}
XmlNode secret = root.ChildNodes[0].ChildNodes[0];
Console.WriteLine("secret Name \n" + secret.Name);
if (c[0].Equals('4'))
res =gk.Remove(secret);
else if (c[0].Equals('1'))

View File

@ -412,7 +412,7 @@ public class GnomeKeyring : Store
TreeIter iterKey;
if(tvKeyValue.Selection.GetSelected (out modelKey, out iterKey))
if( "GKPassword" != (string)tsKeyValue.GetValue(iterKey,0) && false == (bool)tsKeyValue.GetValue(iterKey,3) )
if( false == (bool)tsKeyValue.GetValue(iterKey,3) )
arrDeletedKeys.Add(tsKeyValue.GetValue(iterKey,0));
if( 0 != tvKeyValue.Selection.CountSelectedRows() )
@ -421,12 +421,9 @@ public class GnomeKeyring : Store
TreeIter iter;
tvKeyValue.Selection.GetSelected (out model, out iter);
if( "GKPassword" != (string)tsKeyValue.GetValue(iter,0) )
{
tsKeyValue.Remove(ref iter);
tvKeyValue.ColumnsAutosize();
}
}
Logger.DbgLog("GUI:GnomeKeyring.on_buttonNewRemove_clicked() - END");
}
@ -659,7 +656,6 @@ public class GnomeKeyring : Store
tvKeyValue.AppendColumn("Linked",new CellRendererText(),"text",4);
tvKeyValue.Model = tsKeyValue;
tsKeyValue.Clear();
tsKeyValue.AppendValues("GKPassword", "novell", "********", true, "No");
entrySecretID.HasFocus = true;
entrySecretID.Text = "";