SEBWIN-351: Implemented utter hack in attempt to make legacy configuration tool calculate the same configuration key in versions 2.x and 3.x.
This commit is contained in:
		
							parent
							
								
									f1d8e14719
								
							
						
					
					
						commit
						7bf4e0308f
					
				
					 3 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -445,6 +445,7 @@ namespace SebWindowsConfig
 | 
			
		|||
		// from/to a human-readable .xml and an encrypted.seb file format.
 | 
			
		||||
		public static DictObj settingsDefault = new DictObj();
 | 
			
		||||
		public static DictObj settingsCurrent = new DictObj();
 | 
			
		||||
		public static DictObj settingsCurrentOriginal = new DictObj();
 | 
			
		||||
 | 
			
		||||
		public static int     permittedProcessIndex;
 | 
			
		||||
		public static ListObj permittedProcessList          = new ListObj();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -257,11 +257,15 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
 | 
			
		||||
			// Get preferences dictionary from decrypted data
 | 
			
		||||
			DictObj sebPreferencesDict = GetPreferencesDictFromConfigData(sebData, forEditing);
 | 
			
		||||
			DictObj sebPreferencesDictOriginal = GetPreferencesDictFromConfigData(sebData, false);
 | 
			
		||||
			// If we didn't get a preferences dict back, we abort reading settings
 | 
			
		||||
			if (sebPreferencesDict == null) return null;
 | 
			
		||||
 | 
			
		||||
			// We need to set the right value for the key sebConfigPurpose to know later where to store the new settings
 | 
			
		||||
			sebPreferencesDict[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeStartingExam;
 | 
			
		||||
			sebPreferencesDictOriginal[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeStartingExam;
 | 
			
		||||
 | 
			
		||||
			SEBSettings.settingsCurrentOriginal = sebPreferencesDictOriginal;
 | 
			
		||||
 | 
			
		||||
			// Reading preferences was successful!
 | 
			
		||||
			return sebPreferencesDict;
 | 
			
		||||
| 
						 | 
				
			
			@ -289,6 +293,7 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
			// We use always uppercase letters in the base16 hashed admin password used for encrypting
 | 
			
		||||
			hashedAdminPassword = hashedAdminPassword.ToUpper();
 | 
			
		||||
			DictObj sebPreferencesDict = null;
 | 
			
		||||
			DictObj sebPreferencesDictOriginal = null;
 | 
			
		||||
			byte[] decryptedSebData = SEBProtectionController.DecryptDataWithPassword(sebData, hashedAdminPassword);
 | 
			
		||||
			if (decryptedSebData == null)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -344,6 +349,7 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
			try
 | 
			
		||||
			{
 | 
			
		||||
				sebPreferencesDict = (DictObj)Plist.readPlist(decryptedSebData);
 | 
			
		||||
				sebPreferencesDictOriginal = (DictObj)Plist.readPlist(decryptedSebData);
 | 
			
		||||
			}
 | 
			
		||||
			catch (Exception readPlistException)
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -419,6 +425,9 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
 | 
			
		||||
			// We need to set the right value for the key sebConfigPurpose to know later where to store the new settings
 | 
			
		||||
			sebPreferencesDict[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient;
 | 
			
		||||
			sebPreferencesDictOriginal[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient;
 | 
			
		||||
 | 
			
		||||
			SEBSettings.settingsCurrentOriginal = sebPreferencesDictOriginal;
 | 
			
		||||
 | 
			
		||||
			// Reading preferences was successful!
 | 
			
		||||
			return sebPreferencesDict;
 | 
			
		||||
| 
						 | 
				
			
			@ -653,6 +662,8 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
			// Get current settings dictionary and clean it from empty arrays and dictionaries
 | 
			
		||||
			//DictObj cleanedCurrentSettings = SEBSettings.CleanSettingsDictionary();
 | 
			
		||||
 | 
			
		||||
			SEBSettings.settingsCurrentOriginal = SEBSettings.settingsCurrent;
 | 
			
		||||
 | 
			
		||||
			// Serialize preferences dictionary to an XML string
 | 
			
		||||
			string sebXML = Plist.writeXml(SEBSettings.settingsCurrent);
 | 
			
		||||
			string cleanedSebXML = sebXML.Replace("<array />", "<array></array>");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -599,7 +599,7 @@ namespace SebWindowsConfig.Utilities
 | 
			
		|||
			using (var stream = new MemoryStream())
 | 
			
		||||
			using (var writer = new StreamWriter(stream))
 | 
			
		||||
			{
 | 
			
		||||
				Serialize(SEBSettings.settingsCurrent, writer);
 | 
			
		||||
				Serialize(SEBSettings.settingsCurrentOriginal, writer);
 | 
			
		||||
 | 
			
		||||
				writer.Flush();
 | 
			
		||||
				stream.Seek(0, SeekOrigin.Begin);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue