Bug 150644. Prevent removal of secrets when store is locked.
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user