Bug 193933. Fix Desktop capture problem.
This commit is contained in:
parent
65b1bbbfc4
commit
8f19a3798b
5
CASA/micasad/cache/SecretStore.cs
vendored
5
CASA/micasad/cache/SecretStore.cs
vendored
@ -88,9 +88,14 @@ namespace sscs.cache
|
||||
|
||||
// start a MPFileWatcher if necessary
|
||||
if (mpWatcher == null)
|
||||
{
|
||||
// make sure HomeDirectory exists
|
||||
String sHomeDir = GetUserHomeDirectory();
|
||||
if (sHomeDir != null && sHomeDir.Length > 0)
|
||||
{
|
||||
mpWatcher = new MPFileWatcher(GetUserHomeDirectory(), ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ namespace sscs.init
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("Running: " + sProcess + " " + sArgs);
|
||||
Process myProcess = new Process();
|
||||
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(sProcess);
|
||||
|
||||
|
@ -227,7 +227,7 @@ namespace sscs.lss
|
||||
doc.LoadXml(xmlToLoad);
|
||||
|
||||
#if false
|
||||
XmlTextWriter writer = new XmlTextWriter("/home/poorna/.miCASA.xml",null);
|
||||
XmlTextWriter writer = new XmlTextWriter("d:/persist.xml",null);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
doc.Save(writer);
|
||||
writer.Close();
|
||||
@ -357,7 +357,57 @@ namespace sscs.lss
|
||||
//userStore.DumpSecretstore();
|
||||
try
|
||||
{
|
||||
MemoryStream ms1 = GetSecretsAsXMLStream();
|
||||
//byte[] key = CASACrypto.GetKeySetFromFile(CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath()),userStore.GetKeyFilePath());
|
||||
byte[] key = CASACrypto.GetKeySetFromFile(m_baGeneratedKey, userStore.GetKeyFilePath());
|
||||
|
||||
string fileName = userStore.GetPersistenceFilePath();
|
||||
string tempFile = fileName;
|
||||
int count=0;
|
||||
|
||||
// rename existing file
|
||||
if(File.Exists(fileName))
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if (File.Exists(tempFile+".tmp"))
|
||||
{
|
||||
if(IsOwnedByRoot(tempFile+".tmp"))
|
||||
{
|
||||
File.Delete(tempFile+".tmp");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
tempFile = fileName + count.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
File.Move(fileName, tempFile+".tmp");
|
||||
}
|
||||
|
||||
CASACrypto.EncryptDataAndWriteToFile(ms1.ToArray(),key,fileName);
|
||||
|
||||
//remove temp
|
||||
if(File.Exists(tempFile+".tmp"))
|
||||
{
|
||||
if(IsOwnedByRoot(tempFile+".tmp"))
|
||||
File.Delete(tempFile+".tmp");
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
CSSSLogger.ExpLog(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
internal MemoryStream GetSecretsAsXMLStream()
|
||||
{
|
||||
try
|
||||
{
|
||||
MemoryStream ms1 = new MemoryStream();
|
||||
XmlTextWriter writer = new XmlTextWriter(ms1,null);
|
||||
writer.Formatting = Formatting.Indented;
|
||||
@ -366,7 +416,6 @@ namespace sscs.lss
|
||||
writer.WriteStartElement(XmlConsts.miCASANode);
|
||||
writer.WriteAttributeString(XmlConsts.versionAttr,"1.5");
|
||||
|
||||
{
|
||||
IDictionaryEnumerator iter = (IDictionaryEnumerator)userStore.GetKeyChainEnumerator();
|
||||
char [] tmpId;
|
||||
string sTmpId;
|
||||
@ -465,55 +514,16 @@ namespace sscs.lss
|
||||
}
|
||||
writer.WriteEndElement(); //keychain
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteEndElement(); //miCASA node
|
||||
writer.WriteEndDocument();
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
|
||||
//byte[] key = CASACrypto.GetKeySetFromFile(CASACrypto.GetMasterPasscode(userStore.GetDesktopPasswd(),userStore.GetPasscodeByDesktopFilePath()),userStore.GetKeyFilePath());
|
||||
byte[] key = CASACrypto.GetKeySetFromFile(m_baGeneratedKey, userStore.GetKeyFilePath());
|
||||
|
||||
string fileName = userStore.GetPersistenceFilePath();
|
||||
string tempFile = fileName;
|
||||
int count=0;
|
||||
|
||||
// rename existing file
|
||||
if(File.Exists(fileName))
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
if (File.Exists(tempFile+".tmp"))
|
||||
{
|
||||
if(IsOwnedByRoot(tempFile+".tmp"))
|
||||
{
|
||||
File.Delete(tempFile+".tmp");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
tempFile = fileName + count.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
File.Move(fileName, tempFile+".tmp");
|
||||
}
|
||||
|
||||
CASACrypto.EncryptDataAndWriteToFile(ms1.ToArray(),key,fileName);
|
||||
|
||||
//remove temp
|
||||
if(File.Exists(tempFile+".tmp"))
|
||||
{
|
||||
if(IsOwnedByRoot(tempFile+".tmp"))
|
||||
File.Delete(tempFile+".tmp");
|
||||
}
|
||||
return ms1;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CSSSLogger.ExpLog(e.ToString());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user