Bug 267542. Don't start persistent until user has a home directory.
This commit is contained in:
		
							
								
								
									
										31
									
								
								CASA/micasad/cache/MPFileWatcher.cs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								CASA/micasad/cache/MPFileWatcher.cs
									
									
									
									
										vendored
									
									
								
							| @@ -15,6 +15,7 @@ namespace sscs.cache | |||||||
| 		private string m_filename = null; | 		private string m_filename = null; | ||||||
| 		private byte[] m_baMP = new byte[32]; | 		private byte[] m_baMP = new byte[32]; | ||||||
| 		private byte[] m_baMPIV = new byte[32]; | 		private byte[] m_baMPIV = new byte[32]; | ||||||
|  |         private byte[] m_baMPSalt = null; | ||||||
| 		private bool m_bIgnoreFileDeletes = false; | 		private bool m_bIgnoreFileDeletes = false; | ||||||
|  |  | ||||||
| 		public MPFileWatcher(string MPFilePath, string MPFileName) | 		public MPFileWatcher(string MPFilePath, string MPFileName) | ||||||
| @@ -91,7 +92,18 @@ namespace sscs.cache | |||||||
| 				fs.Read(m_baMPIV, 0, m_baMPIV.Length); | 				fs.Read(m_baMPIV, 0, m_baMPIV.Length); | ||||||
| 				fs.Flush(); | 				fs.Flush(); | ||||||
| 				fs.Close(); | 				fs.Close(); | ||||||
|  |  | ||||||
|  |                 if (File.Exists(m_dir + m_filename + ".salt")) | ||||||
|  |                 { | ||||||
|  |                     m_baMPSalt = new byte[64]; | ||||||
|  |                     fs = new FileStream(m_dir + m_filename + ".salt", FileMode.Open, FileAccess.Read); | ||||||
|  |                     fs.Read(m_baMPSalt, 0, m_baMPSalt.Length); | ||||||
|  |                     fs.Flush(); | ||||||
|  |                     fs.Close(); | ||||||
|  |                 } | ||||||
|  |  | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			catch (Exception e) | 			catch (Exception e) | ||||||
| 			{ | 			{ | ||||||
| 				LogMessage(e.ToString()); | 				LogMessage(e.ToString()); | ||||||
| @@ -127,6 +139,25 @@ namespace sscs.cache | |||||||
| 			{ | 			{ | ||||||
| 				LogMessage(e.ToString()); | 				LogMessage(e.ToString()); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  |  | ||||||
|  |             if (m_baMPSalt != null) | ||||||
|  |             { | ||||||
|  |                 try | ||||||
|  |                 { | ||||||
|  |                     FileStream fs = new FileStream(m_dir + m_filename + ".salt", FileMode.Create); | ||||||
|  |                     fs.Write(m_baMPSalt, 0, m_baMPSalt.Length); | ||||||
|  |                     fs.Flush(); | ||||||
|  |                     fs.Close(); | ||||||
|  |  | ||||||
|  |                     File.SetAttributes(m_dir + m_filename + ".salt", FileAttributes.Hidden); | ||||||
|  |                 } | ||||||
|  |                 catch (Exception e) | ||||||
|  |                 { | ||||||
|  |                     LogMessage(e.ToString()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		private void LogMessage(string message) | 		private void LogMessage(string message) | ||||||
|   | |||||||
							
								
								
									
										27
									
								
								CASA/micasad/cache/SecretStore.cs
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										27
									
								
								CASA/micasad/cache/SecretStore.cs
									
									
									
									
										vendored
									
									
								
							| @@ -918,18 +918,29 @@ namespace sscs.cache | |||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 // the user might have set a different one |  | ||||||
|                 // load the policy file and check. |                 string sUserHomeDir = GetUserHomeDirectory(); | ||||||
|                 UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, GetUserHomeDirectory(), GetUserName()); |                 if (sUserHomeDir != null) | ||||||
|                 if (uiPolicy != null) |  | ||||||
|                 { |                 { | ||||||
|                     string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY); |  | ||||||
|                     if ((sDir != null) && (sDir.Length > 0)) |                     // the user might have set a different one | ||||||
|  |                     // load the policy file and check. | ||||||
|  |                     UIPol uiPolicy = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL, sUserHomeDir, GetUserName()); | ||||||
|  |                     if (uiPolicy != null) | ||||||
|                     { |                     { | ||||||
|                         m_persistenceDirectory = sDir; |                         string sDir = uiPolicy.GetConfigSetting(ConstStrings.CONFIG_PERSISTENT_DIRECTORY); | ||||||
|                         return m_persistenceDirectory; |                         if ((sDir != null) && (sDir.Length > 0)) | ||||||
|  |                         { | ||||||
|  |                             m_persistenceDirectory = sDir; | ||||||
|  |                             return m_persistenceDirectory; | ||||||
|  |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |                 else | ||||||
|  |                 { | ||||||
|  |                     // user not logged in yet | ||||||
|  |                     return null; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
| 			 | 			 | ||||||
| 			m_persistenceDirectory = MigrateMiCasaFiles(); | 			m_persistenceDirectory = MigrateMiCasaFiles(); | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ namespace sscs.common | |||||||
| { | { | ||||||
|     internal class WinUser : User |     internal class WinUser : User | ||||||
|     { |     { | ||||||
| 		private string m_sUserHome = ""; |         private string m_sUserHome = null; | ||||||
|  |  | ||||||
|         internal WinUser() |         internal WinUser() | ||||||
|         { |         { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user