Disallow * in SecretId names

This commit is contained in:
Jim Norman 2005-10-26 14:31:58 +00:00
parent a9e5a67876
commit b6039e1f9e
3 changed files with 190 additions and 175 deletions

View File

@ -184,10 +184,6 @@ namespace sscs.verbs
{ {
return DoGetKeyList(ssStore, wo); return DoGetKeyList(ssStore, wo);
} }
default: default:
{ {
wo.SetError(constants.RetCodes.FAILURE, "Verb Not Supported"); wo.SetError(constants.RetCodes.FAILURE, "Verb Not Supported");
@ -334,6 +330,9 @@ namespace sscs.verbs
string keyID = wo.GetKeyID(); string keyID = wo.GetKeyID();
string sValue = (String)wo.GetObject(); string sValue = (String)wo.GetObject();
if (secretID.IndexOf("*") < 0)
{
KeyChain keyChain = ssStore.GetKeyChain(keychainID); KeyChain keyChain = ssStore.GetKeyChain(keychainID);
Secret secret; Secret secret;
if( keyChain.CheckIfSecretExists(secretID) == false) if( keyChain.CheckIfSecretExists(secretID) == false)
@ -350,6 +349,9 @@ namespace sscs.verbs
ChangeLinkedKeys(keyChain, secret, keyID, sValue); ChangeLinkedKeys(keyChain, secret, keyID, sValue);
wo.SetError(constants.RetCodes.SUCCESS, null); wo.SetError(constants.RetCodes.SUCCESS, null);
} }
else
wo.SetError(constants.RetCodes.FAILURE, null);
}
catch (Exception e) catch (Exception e)
{ {
wo.SetError(constants.RetCodes.FAILURE, e.ToString()); wo.SetError(constants.RetCodes.FAILURE, e.ToString());
@ -784,5 +786,6 @@ namespace sscs.verbs
CSSSLogger.ExecutionTrace(this); CSSSLogger.ExecutionTrace(this);
return this.ToString(); return this.ToString();
} }
} }
} }

View File

@ -84,6 +84,8 @@ namespace sscs.verbs
Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen); Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen);
secretId = Encoding.UTF8.GetString(secretIdArr); secretId = Encoding.UTF8.GetString(secretIdArr);
if (secretId.IndexOf("*") < 0)
{
keyLen = BitConverter.ToUInt32(inBuf,(14+(int)keyChainIdLen+(int)secretIdLen)); keyLen = BitConverter.ToUInt32(inBuf,(14+(int)keyChainIdLen+(int)secretIdLen));
byte[] keyArr = new byte[keyLen]; byte[] keyArr = new byte[keyLen];
@ -208,6 +210,9 @@ namespace sscs.verbs
CSSSLogger.ExpLog(e.ToString()); CSSSLogger.ExpLog(e.ToString());
retCode = IPCRetCodes.SSCS_E_SYSTEM_ERROR; retCode = IPCRetCodes.SSCS_E_SYSTEM_ERROR;
} }
}
else
retCode = IPCRetCodes.SSCS_E_INVALID_SECRETID;
try try
{ {

View File

@ -76,6 +76,10 @@ namespace sscs.verbs
Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen); Array.Copy(inBuf,(10+keyChainIdLen+4),secretIdArr,0,secretIdLen);
secretId = Encoding.UTF8.GetString(secretIdArr); secretId = Encoding.UTF8.GetString(secretIdArr);
if (secretId.IndexOf("*") < 0)
{
secretValLen = BitConverter.ToUInt32(inBuf, secretValLen = BitConverter.ToUInt32(inBuf,
(14 + ((int)keyChainIdLen)+((int)secretIdLen))); (14 + ((int)keyChainIdLen)+((int)secretIdLen)));
//secretVal = new byte[secretValLen]; //secretVal = new byte[secretValLen];
@ -190,6 +194,9 @@ namespace sscs.verbs
CSSSLogger.ExpLog(e.ToString()); CSSSLogger.ExpLog(e.ToString());
retCode = IPCRetCodes.SSCS_E_SYSTEM_ERROR; retCode = IPCRetCodes.SSCS_E_SYSTEM_ERROR;
} }
}
else
retCode = IPCRetCodes.SSCS_E_INVALID_SECRETID;
try try
{ {