return locked on EnumerateSecretIds when the store is locked.

This commit is contained in:
Jim Norman 2006-10-17 22:06:37 +00:00
parent 39fdc355c7
commit ce68c1352a

View File

@ -83,34 +83,41 @@ namespace sscs.verbs
byte[] keyChainIdArr = new byte[keyChainIdLen]; byte[] keyChainIdArr = new byte[keyChainIdLen];
Array.Copy(inBuf,10,keyChainIdArr,0,keyChainIdLen); Array.Copy(inBuf,10,keyChainIdArr,0,keyChainIdLen);
keyChainId = Encoding.UTF8.GetString(keyChainIdArr); keyChainId = Encoding.UTF8.GetString(keyChainIdArr);
// Message Format decipher - End // Message Format decipher - End
try try
{ {
SecretStore ssStore = SessionManager.GetUserSecretStore(userId); SecretStore ssStore = SessionManager.GetUserSecretStore(userId);
if( ssStore.CheckIfKeyChainExists(keyChainId) ) if (!ssStore.IsStoreLocked())
{ {
KeyChain keyChain = ssStore.GetKeyChain(keyChainId); if( ssStore.CheckIfKeyChainExists(keyChainId) )
int numSecrets = keyChain.GetNumSecrets(); {
int index = 0; KeyChain keyChain = ssStore.GetKeyChain(keyChainId);
IDictionaryEnumerator etor = (IDictionaryEnumerator)keyChain.GetAllSecrets(); int numSecrets = keyChain.GetNumSecrets();
while(etor.MoveNext()) int index = 0;
{ IDictionaryEnumerator etor = (IDictionaryEnumerator)keyChain.GetAllSecrets();
index++; while(etor.MoveNext())
secretIds.Append((string)etor.Key,0,(((string)(etor.Key)).Length)-1); {
secretIdsLen += ((string)(etor.Key)).Length-1; index++;
if( index != numSecrets ) secretIds.Append((string)etor.Key,0,(((string)(etor.Key)).Length)-1);
{ secretIdsLen += ((string)(etor.Key)).Length-1;
secretIds.Append("*"); if( index != numSecrets )
secretIdsLen += 1; {
} secretIds.Append("*");
} secretIdsLen += 1;
} }
else }
{ }
retCode = IPCRetCodes.SSCS_E_KEYCHAIN_DOES_NOT_EXIST; else
} {
retCode = IPCRetCodes.SSCS_E_KEYCHAIN_DOES_NOT_EXIST;
}
}
else
{
retCode = IPCRetCodes.SSCS_SECRET_STORE_IS_LOCKED;
}
} }
catch(UserNotInSessionException) catch(UserNotInSessionException)
{ {