Bugs 130336, and 130387
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| using System; | ||||
| using System.Text; | ||||
|  | ||||
| namespace Novell.CASA.MiCasa.Common | ||||
| { | ||||
| @@ -14,7 +15,7 @@ namespace Novell.CASA.MiCasa.Common | ||||
| 		private int m_verb = 0; | ||||
| 		private string m_KeychainID = null; | ||||
| 		private string m_SecretID = null; | ||||
| 		private string m_KeyID = null; | ||||
| 		private string m_KeyID = null;		 | ||||
|  | ||||
| 		private object m_object; | ||||
|  | ||||
| @@ -38,13 +39,13 @@ namespace Novell.CASA.MiCasa.Common | ||||
| 			if (sSecretID != null) | ||||
| 			{ | ||||
| 				if (sSecretID.StartsWith("SS_CredSet")) | ||||
| 					m_SecretID = sSecretID + '\0'; | ||||
| 					m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID.Substring(12)) + '\0'; | ||||
| 				else | ||||
| 					m_SecretID = "SS_CredSet:" + sSecretID + '\0'; | ||||
| 					m_SecretID = "SS_CredSet:" + EscapeReservedChars(sSecretID) + '\0'; | ||||
| 			} | ||||
| 	 | ||||
| 			if (sKeyID != null) | ||||
| 				m_KeyID = sKeyID; // + '\0'; | ||||
| 				m_KeyID = EscapeReservedChars(sKeyID); // + '\0'; | ||||
|  | ||||
| 			// serialize the object | ||||
| 			m_object = theObject;						 | ||||
| @@ -95,5 +96,34 @@ namespace Novell.CASA.MiCasa.Common | ||||
| 		{ | ||||
| 			return m_errorMsg; | ||||
| 		} | ||||
|  | ||||
| 		private string EscapeReservedChars(string origString) | ||||
| 		{ | ||||
| 			StringBuilder sb = new StringBuilder(); | ||||
| 			for (int i=0; i<origString.Length; i++) | ||||
| 			{ | ||||
| 				switch (origString[i]) | ||||
| 				{ | ||||
| 					case ':'  :	 | ||||
| 					{ | ||||
| 						sb.Append("\\"); | ||||
| 						break; | ||||
| 					} | ||||
| 					case '\\' :		 | ||||
| 					{ | ||||
| 						sb.Append("\\"); | ||||
| 						break; | ||||
| 					} | ||||
| 					case '='  : | ||||
| 					{ | ||||
| 						sb.Append("\\"); | ||||
| 						break; | ||||
| 					}					 | ||||
| 					 | ||||
| 				} | ||||
| 				sb.Append(origString[i]);				 | ||||
| 			} | ||||
| 			return sb.ToString(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user