Bug 135387, 135393
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user