Bug 135387, 135393

This commit is contained in:
Jim Norman 2005-11-23 23:27:29 +00:00
parent d1663432ee
commit 533bbabd87
13 changed files with 150 additions and 73 deletions

View File

@ -1,6 +1,16 @@
-------------------------------------------------------------------
Wed Nov 18 14:09:19 MST 2005 - jnorman@novell.com
- Bug fixes: 135387, 135393
-------------------------------------------------------------------
Wed Nov 23 16:09:19 MST 2005 - jnorman@novell.com
- changed PAM Capture to find libmicasa in path
-------------------------------------------------------------------
Wed Nov 18 14:09:19 MST 2005 - jnorman@novell.com
- Change GUI dependency from gtk2-devel to gtk2.
-------------------------------------------------------------------

View File

@ -89,6 +89,17 @@ class KeyChain : IKeychain
public void RemoveSecret(String secretID)
{
// remove all keyvalues first, as to unlink reverse links
try
{
Secret secret = GetSecret(secretID);
secret.RemoveAllKeyValuePairs(this);
}
catch
{
}
SecretList.Remove(secretID);
this.ModifiedTime = DateTime.Now;
}

View File

@ -2,6 +2,8 @@ using System;
using System.Text;
using System.Collections;
using Novell.CASA.MiCasa.Common;
namespace sscs.cache
{
class Secret : ISecret
@ -195,14 +197,51 @@ namespace sscs.cache
return null;
}
public void RemoveKeyValue(string key)
{
internal void RemoveAllKeyValuePairs(KeyChain kc)
{
if (htKeyValues != null)
{
IDictionaryEnumerator enumer = htKeyValues.GetEnumerator();
while (enumer.MoveNext())
{
String key = (String)enumer.Key;
RemoveKeyValue(kc, key);
}
}
}
public void RemoveKeyValue(KeyChain kc, string key)
{
if (htKeyValues.Contains(key))
{
// remove all reverse links first
RemoveReverseLinkedKeys(kc, key);
htKeyValues.Remove(key);
}
}
private void RemoveReverseLinkedKeys(KeyChain kc, string keyId)
{
Hashtable linkedKeys = GetLinkedKeys(keyId);
if (kc != null && linkedKeys != null)
{
IDictionaryEnumerator lkis = linkedKeys.GetEnumerator();
while (lkis.MoveNext())
{
LinkedKeyInfo lki = (LinkedKeyInfo)lkis.Value;
// look up reverse linked key
Secret secret = kc.GetSecret(lki.GetLinkedSecretID());
if (secret != null)
{
// look up linked key
KeyValue kv = secret.GetKeyValue(lki.GetLinkedKeyID());
kv.RemoveLink(secretID + ":" + keyId);
}
}
}
}
public DateTime GetKeyValueCreatedTime(string key)
{
if (htKeyValues.Contains(key))
@ -238,8 +277,9 @@ namespace sscs.cache
}
public void MergeSecret(Secret newSecret)
{
public void MergeSecret(SecretStore store, Secret newSecret)
{
IDictionaryEnumerator etor = (IDictionaryEnumerator)newSecret.htKeyValues.GetEnumerator();
while(etor.MoveNext())
{
@ -254,7 +294,7 @@ namespace sscs.cache
{
string sKey = (string)etor.Key;
if(!htKeyValues.Contains(sKey))
this.RemoveKeyValue(sKey);
this.RemoveKeyValue(store.GetKeyChainDefault(), sKey);
}
}

View File

@ -505,6 +505,12 @@ namespace sscs.cache
keyChainList.Remove(id);
return true;
}
internal KeyChain GetKeyChainDefault()
{
return GetKeyChain("SSCS_SESSION_KEY_CHAIN_ID\0");
}
internal KeyChain GetKeyChain(string id)
{
if(keyChainList.ContainsKey(id))
@ -519,9 +525,9 @@ namespace sscs.cache
CSSSLogger.DbgLog("In " + CSSSLogger.GetExecutionPath(this) + " Keychain doesnot exist.Returning null.");
throw new KeyChainDoesNotExistException(id);
}
}
internal bool CheckIfKeyChainExists(string id)
internal bool CheckIfKeyChainExists(string id)
{
if(keyChainList.ContainsKey(id))
return true;

View File

@ -26,7 +26,7 @@ using System.Runtime.CompilerServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.146.0")]
//
// In order to sign your assembly you must specify a key to use. Refer to the

View File

@ -300,7 +300,7 @@
/>
<File
RelPath = "init\ProjectInstaller.cs"
SubType = "Component"
SubType = "Code"
BuildAction = "Compile"
/>
<File
@ -310,7 +310,7 @@
/>
<File
RelPath = "init\WinSecretStoreClientService.cs"
SubType = "Component"
SubType = "Code"
BuildAction = "Compile"
/>
<File

View File

@ -248,7 +248,7 @@ namespace sscs.verbs
else
{
secret = keyChain.GetSecret(secretID);
secret.RemoveKeyValue(keyID);
secret.RemoveKeyValue(keyChain, keyID);
wo.SetError(constants.RetCodes.SUCCESS, null);
ssStore.UpdatePersistentStore();
}
@ -263,34 +263,39 @@ namespace sscs.verbs
private WrappedObject DoReadKey(SecretStore ssStore, WrappedObject wo)
{
try
if (!ssStore.IsStoreLocked())
{
string keychainID = wo.GetKeychainID();
string secretID = wo.GetSecretID();
string keyID = wo.GetKeyID();
// string sValue = (String)wo.GetObject();
KeyChain keyChain = ssStore.GetKeyChain(keychainID);
Secret secret = null;
if( keyChain.CheckIfSecretExists(secretID) == false)
try
{
wo.SetError(constants.RetCodes.FAILURE,"Secret does not exist");
string keychainID = wo.GetKeychainID();
string secretID = wo.GetSecretID();
string keyID = wo.GetKeyID();
// string sValue = (String)wo.GetObject();
KeyChain keyChain = ssStore.GetKeyChain(keychainID);
Secret secret = null;
if( keyChain.CheckIfSecretExists(secretID) == false)
{
wo.SetError(constants.RetCodes.FAILURE,"Secret does not exist");
}
else
{
secret = keyChain.GetSecret(secretID);
KeyValue kv = secret.GetKeyValue(keyID);
string value = kv.GetValue();
wo.SetObject(value);
wo.SetError(constants.RetCodes.SUCCESS, null);
}
}
else
catch (Exception e)
{
secret = keyChain.GetSecret(secretID);
KeyValue kv = secret.GetKeyValue(keyID);
string value = kv.GetValue();
wo.SetObject(value);
wo.SetError(constants.RetCodes.SUCCESS, null);
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
}
}
catch (Exception e)
{
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
}
else
wo.SetError(constants.RetCodes.FAILURE, "Store locked");
return wo;
}
@ -330,40 +335,46 @@ namespace sscs.verbs
private WrappedObject DoWriteKey(SecretStore ssStore, WrappedObject wo)
{
try
if (!ssStore.IsStoreLocked())
{
string keychainID = wo.GetKeychainID();
string secretID = wo.GetSecretID();
string keyID = wo.GetKeyID();
string sValue = (String)wo.GetObject();
if (secretID.IndexOf("*") < 0)
try
{
KeyChain keyChain = ssStore.GetKeyChain(keychainID);
Secret secret;
if( keyChain.CheckIfSecretExists(secretID) == false)
string keychainID = wo.GetKeychainID();
string secretID = wo.GetSecretID();
string keyID = wo.GetKeyID();
string sValue = (String)wo.GetObject();
if (secretID.IndexOf("*") < 0)
{
secret = new Secret(secretID);
keyChain.AddSecret(secret);
KeyChain keyChain = ssStore.GetKeyChain(keychainID);
Secret secret;
if( keyChain.CheckIfSecretExists(secretID) == false)
{
secret = new Secret(secretID);
keyChain.AddSecret(secret);
}
else
{
secret = keyChain.GetSecret(secretID);
}
secret.SetKeyValue(keyID, sValue);
ChangeLinkedKeys(keyChain, secret, keyID, sValue);
wo.SetError(constants.RetCodes.SUCCESS, null);
ssStore.UpdatePersistentStore();
}
else
{
secret = keyChain.GetSecret(secretID);
}
secret.SetKeyValue(keyID, sValue);
ChangeLinkedKeys(keyChain, secret, keyID, sValue);
wo.SetError(constants.RetCodes.SUCCESS, null);
ssStore.UpdatePersistentStore();
wo.SetError(constants.RetCodes.FAILURE, null);
}
else
wo.SetError(constants.RetCodes.FAILURE, null);
}
catch (Exception e)
{
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
catch (Exception e)
{
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
}
}
else
wo.SetError(constants.RetCodes.FAILURE, "Store locked");
return wo;
@ -626,8 +637,7 @@ namespace sscs.verbs
return wo;
}
private WrappedObject DoSetLinkedKey(SecretStore ssStore, WrappedObject wo)
{
@ -691,7 +701,7 @@ namespace sscs.verbs
return wo;
}
private WrappedObject DoPing(WrappedObject wo)
{
//Console.WriteLine("MICASAD received Ping from Client");

View File

@ -153,7 +153,7 @@ namespace sscs.verbs
{
Secret masterSecret = keyChain.GetSecret(secretId);
string oldPasswd = masterSecret.GetKeyValue(ConstStrings.MICASA_DESKTOP_PASSWD_KEYNAME).GetValue();
masterSecret.MergeSecret(secret);
masterSecret.MergeSecret(ssStore, secret);
//keyChain.RemoveSecret(secretId);
keyChain.AddSecret(secret);

Binary file not shown.

Binary file not shown.

View File

@ -15,8 +15,8 @@
{
"Entry"
{
"MsmKey" = "8:_0532B715CB414B478EF7F1C249E501E8"
"OwnerKey" = "8:_8A1A4BA980A9443DBCD4DE4ACDA8F19A"
"MsmKey" = "8:_0FF929AD04CF40BAB40A8CC3D03427A4"
"OwnerKey" = "8:_D1641051214046F78EDF37DC13C414ED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -27,8 +27,8 @@
}
"Entry"
{
"MsmKey" = "8:_88EF6178AF974BB3BA6BDD14F8FE5A23"
"OwnerKey" = "8:_D1641051214046F78EDF37DC13C414ED"
"MsmKey" = "8:_196F043FB1454E7F8C8EC7708C1D4097"
"OwnerKey" = "8:_8A1A4BA980A9443DBCD4DE4ACDA8F19A"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -250,13 +250,13 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:CASA"
"ProductCode" = "8:{B5628252-6539-4F60-943B-974088A26847}"
"PackageCode" = "8:{92C4EA00-0131-44CA-81A8-7CC0A258E667}"
"ProductCode" = "8:{8BD939C7-2610-4533-A7B5-BE33E78BDF1D}"
"PackageCode" = "8:{E856CC14-D8A7-4D09-B341-D46BD27D312D}"
"UpgradeCode" = "8:{DFD8B8A0-EA51-4202-831C-7CD2B90A63AE}"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"ProductVersion" = "8:1.5.146"
"ProductVersion" = "8:1.5.149"
"Manufacturer" = "8:Novell"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
@ -730,7 +730,7 @@
}
"MergeModule"
{
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_0532B715CB414B478EF7F1C249E501E8"
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_0FF929AD04CF40BAB40A8CC3D03427A4"
{
"UseDynamicProperties" = "11:TRUE"
"IsDependency" = "11:TRUE"
@ -741,7 +741,7 @@
"Feature" = "8:"
"IsolateTo" = "8:"
}
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_88EF6178AF974BB3BA6BDD14F8FE5A23"
"{35A69C6E-5BA4-440D-803D-762B59A45393}:_196F043FB1454E7F8C8EC7708C1D4097"
{
"UseDynamicProperties" = "11:TRUE"
"IsDependency" = "11:TRUE"

Binary file not shown.