Disallow * in SecretId names
This commit is contained in:
		| @@ -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();  | ||||||
| 		} | 		} | ||||||
|  | 						 | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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 | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -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 | ||||||
|             { |             { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user