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
|
// start a MPFileWatcher if necessary
|
||||||
if (mpWatcher == null)
|
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);
|
mpWatcher = new MPFileWatcher(GetUserHomeDirectory(), ConstStrings.MICASA_PASSCODE_BY_MASTERPASSWD_FILE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ namespace sscs.init
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
System.Diagnostics.Trace.WriteLine("Running: " + sProcess + " " + sArgs);
|
||||||
Process myProcess = new Process();
|
Process myProcess = new Process();
|
||||||
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(sProcess);
|
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(sProcess);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ namespace sscs.lss
|
|||||||
doc.LoadXml(xmlToLoad);
|
doc.LoadXml(xmlToLoad);
|
||||||
|
|
||||||
#if false
|
#if false
|
||||||
XmlTextWriter writer = new XmlTextWriter("/home/poorna/.miCASA.xml",null);
|
XmlTextWriter writer = new XmlTextWriter("d:/persist.xml",null);
|
||||||
writer.Formatting = Formatting.Indented;
|
writer.Formatting = Formatting.Indented;
|
||||||
doc.Save(writer);
|
doc.Save(writer);
|
||||||
writer.Close();
|
writer.Close();
|
||||||
@ -357,7 +357,57 @@ namespace sscs.lss
|
|||||||
//userStore.DumpSecretstore();
|
//userStore.DumpSecretstore();
|
||||||
try
|
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();
|
MemoryStream ms1 = new MemoryStream();
|
||||||
XmlTextWriter writer = new XmlTextWriter(ms1,null);
|
XmlTextWriter writer = new XmlTextWriter(ms1,null);
|
||||||
writer.Formatting = Formatting.Indented;
|
writer.Formatting = Formatting.Indented;
|
||||||
@ -366,7 +416,6 @@ namespace sscs.lss
|
|||||||
writer.WriteStartElement(XmlConsts.miCASANode);
|
writer.WriteStartElement(XmlConsts.miCASANode);
|
||||||
writer.WriteAttributeString(XmlConsts.versionAttr,"1.5");
|
writer.WriteAttributeString(XmlConsts.versionAttr,"1.5");
|
||||||
|
|
||||||
{
|
|
||||||
IDictionaryEnumerator iter = (IDictionaryEnumerator)userStore.GetKeyChainEnumerator();
|
IDictionaryEnumerator iter = (IDictionaryEnumerator)userStore.GetKeyChainEnumerator();
|
||||||
char [] tmpId;
|
char [] tmpId;
|
||||||
string sTmpId;
|
string sTmpId;
|
||||||
@ -465,55 +514,16 @@ namespace sscs.lss
|
|||||||
}
|
}
|
||||||
writer.WriteEndElement(); //keychain
|
writer.WriteEndElement(); //keychain
|
||||||
}
|
}
|
||||||
}
|
|
||||||
writer.WriteEndElement(); //miCASA node
|
writer.WriteEndElement(); //miCASA node
|
||||||
writer.WriteEndDocument();
|
writer.WriteEndDocument();
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
|
return ms1;
|
||||||
//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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
CSSSLogger.ExpLog(e.ToString());
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user