Bug 150644. Prevent removal of secrets when store is locked.

This commit is contained in:
Jim Norman
2006-02-14 21:04:17 +00:00
parent 7e9883fe5e
commit 433961874f
3 changed files with 27 additions and 11 deletions

View File

@@ -53,6 +53,7 @@ namespace sscs.constants
internal static int SSCS_STORE_IS_NOT_PERSISTENT = -23;
internal static int SSCS_SECRET_IS_PERSISTENT = -24;
internal static int SSCS_SECRET_IS_NOT_PERSISTENT = -25;
internal static int SSCS_SECRET_STORE_IS_LOCKED = -26;
}

View File

@@ -97,25 +97,30 @@ namespace sscs.verbs
try
{
SecretStore ssStore = SessionManager.GetUserSecretStore(userId);
if( ssStore.CheckIfKeyChainExists(keyChainId) )
if (!ssStore.IsStoreLocked())
{
KeyChain keyChain = ssStore.GetKeyChain(keyChainId);
if( keyChain.CheckIfSecretExists(secretId) == false)
if (ssStore.CheckIfKeyChainExists(keyChainId))
{
retCode = IPCRetCodes.SSCS_E_SECRETID_DOES_NOT_EXIST;
KeyChain keyChain = ssStore.GetKeyChain(keyChainId);
if (keyChain.CheckIfSecretExists(secretId) == false)
{
retCode = IPCRetCodes.SSCS_E_SECRETID_DOES_NOT_EXIST;
}
else
{
// TODO: get the secret and remove linked keys
keyChain.RemoveSecret(secretId);
ssStore.UpdatePersistentStore();
}
}
else
{
// TODO: get the secret and remove linked keys
keyChain.RemoveSecret(secretId);
ssStore.UpdatePersistentStore();
retCode = IPCRetCodes.SSCS_E_KEYCHAIN_DOES_NOT_EXIST;
}
}
else
{
retCode = IPCRetCodes.SSCS_E_KEYCHAIN_DOES_NOT_EXIST;
}
retCode = IPCRetCodes.SSCS_SECRET_STORE_IS_LOCKED;
}
catch(UserNotInSessionException)
{