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.
 | 
							// from/to a human-readable .xml and an encrypted.seb file format.
 | 
				
			||||||
		public static DictObj settingsDefault = new DictObj();
 | 
							public static DictObj settingsDefault = new DictObj();
 | 
				
			||||||
		public static DictObj settingsCurrent = new DictObj();
 | 
							public static DictObj settingsCurrent = new DictObj();
 | 
				
			||||||
 | 
							public static DictObj settingsCurrentOriginal = new DictObj();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static int     permittedProcessIndex;
 | 
							public static int     permittedProcessIndex;
 | 
				
			||||||
		public static ListObj permittedProcessList          = new ListObj();
 | 
							public static ListObj permittedProcessList          = new ListObj();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,11 +257,15 @@ namespace SebWindowsConfig.Utilities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Get preferences dictionary from decrypted data
 | 
								// Get preferences dictionary from decrypted data
 | 
				
			||||||
			DictObj sebPreferencesDict = GetPreferencesDictFromConfigData(sebData, forEditing);
 | 
								DictObj sebPreferencesDict = GetPreferencesDictFromConfigData(sebData, forEditing);
 | 
				
			||||||
 | 
								DictObj sebPreferencesDictOriginal = GetPreferencesDictFromConfigData(sebData, false);
 | 
				
			||||||
			// If we didn't get a preferences dict back, we abort reading settings
 | 
								// If we didn't get a preferences dict back, we abort reading settings
 | 
				
			||||||
			if (sebPreferencesDict == null) return null;
 | 
								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
 | 
								// 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;
 | 
								sebPreferencesDict[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeStartingExam;
 | 
				
			||||||
 | 
								sebPreferencesDictOriginal[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeStartingExam;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								SEBSettings.settingsCurrentOriginal = sebPreferencesDictOriginal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Reading preferences was successful!
 | 
								// Reading preferences was successful!
 | 
				
			||||||
			return sebPreferencesDict;
 | 
								return sebPreferencesDict;
 | 
				
			||||||
| 
						 | 
					@ -289,6 +293,7 @@ namespace SebWindowsConfig.Utilities
 | 
				
			||||||
			// We use always uppercase letters in the base16 hashed admin password used for encrypting
 | 
								// We use always uppercase letters in the base16 hashed admin password used for encrypting
 | 
				
			||||||
			hashedAdminPassword = hashedAdminPassword.ToUpper();
 | 
								hashedAdminPassword = hashedAdminPassword.ToUpper();
 | 
				
			||||||
			DictObj sebPreferencesDict = null;
 | 
								DictObj sebPreferencesDict = null;
 | 
				
			||||||
 | 
								DictObj sebPreferencesDictOriginal = null;
 | 
				
			||||||
			byte[] decryptedSebData = SEBProtectionController.DecryptDataWithPassword(sebData, hashedAdminPassword);
 | 
								byte[] decryptedSebData = SEBProtectionController.DecryptDataWithPassword(sebData, hashedAdminPassword);
 | 
				
			||||||
			if (decryptedSebData == null)
 | 
								if (decryptedSebData == null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -344,6 +349,7 @@ namespace SebWindowsConfig.Utilities
 | 
				
			||||||
			try
 | 
								try
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				sebPreferencesDict = (DictObj)Plist.readPlist(decryptedSebData);
 | 
									sebPreferencesDict = (DictObj)Plist.readPlist(decryptedSebData);
 | 
				
			||||||
 | 
									sebPreferencesDictOriginal = (DictObj)Plist.readPlist(decryptedSebData);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			catch (Exception readPlistException)
 | 
								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
 | 
								// 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;
 | 
								sebPreferencesDict[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient;
 | 
				
			||||||
 | 
								sebPreferencesDictOriginal[SEBSettings.KeySebConfigPurpose] = (int)SEBSettings.sebConfigPurposes.sebConfigPurposeConfiguringClient;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								SEBSettings.settingsCurrentOriginal = sebPreferencesDictOriginal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Reading preferences was successful!
 | 
								// Reading preferences was successful!
 | 
				
			||||||
			return sebPreferencesDict;
 | 
								return sebPreferencesDict;
 | 
				
			||||||
| 
						 | 
					@ -653,6 +662,8 @@ namespace SebWindowsConfig.Utilities
 | 
				
			||||||
			// Get current settings dictionary and clean it from empty arrays and dictionaries
 | 
								// Get current settings dictionary and clean it from empty arrays and dictionaries
 | 
				
			||||||
			//DictObj cleanedCurrentSettings = SEBSettings.CleanSettingsDictionary();
 | 
								//DictObj cleanedCurrentSettings = SEBSettings.CleanSettingsDictionary();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								SEBSettings.settingsCurrentOriginal = SEBSettings.settingsCurrent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Serialize preferences dictionary to an XML string
 | 
								// Serialize preferences dictionary to an XML string
 | 
				
			||||||
			string sebXML = Plist.writeXml(SEBSettings.settingsCurrent);
 | 
								string sebXML = Plist.writeXml(SEBSettings.settingsCurrent);
 | 
				
			||||||
			string cleanedSebXML = sebXML.Replace("<array />", "<array></array>");
 | 
								string cleanedSebXML = sebXML.Replace("<array />", "<array></array>");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -599,7 +599,7 @@ namespace SebWindowsConfig.Utilities
 | 
				
			||||||
			using (var stream = new MemoryStream())
 | 
								using (var stream = new MemoryStream())
 | 
				
			||||||
			using (var writer = new StreamWriter(stream))
 | 
								using (var writer = new StreamWriter(stream))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				Serialize(SEBSettings.settingsCurrent, writer);
 | 
									Serialize(SEBSettings.settingsCurrentOriginal, writer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				writer.Flush();
 | 
									writer.Flush();
 | 
				
			||||||
				stream.Seek(0, SeekOrigin.Begin);
 | 
									stream.Seek(0, SeekOrigin.Begin);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue