Improve FileWatcher functionality.
This commit is contained in:
parent
0408acc206
commit
9fd0d5b8f0
16
CASA/micasad/cache/SecretStore.cs
vendored
16
CASA/micasad/cache/SecretStore.cs
vendored
@ -730,14 +730,26 @@ namespace sscs.cache
|
||||
byte[] baPasscode = CASACrypto.GetMasterPasscodeUsingMasterPasswd(sCurrentPWD, sMasterFilePath, false);
|
||||
if (baPasscode != null)
|
||||
{
|
||||
mpWatcher.pauseWatcher();
|
||||
PauseFileWatcher();
|
||||
CASACrypto.EncryptAndStoreMasterPasscodeUsingString(baPasscode, sNewPWD, sMasterFilePath);
|
||||
mpWatcher.resumeWatcher();
|
||||
ResumeFileWatcher();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void PauseFileWatcher()
|
||||
{
|
||||
if (mpWatcher != null)
|
||||
mpWatcher.pauseWatcher();
|
||||
}
|
||||
|
||||
internal void ResumeFileWatcher()
|
||||
{
|
||||
if (mpWatcher != null)
|
||||
mpWatcher.resumeWatcher();
|
||||
}
|
||||
|
||||
internal string GetDesktopPasswd()
|
||||
{
|
||||
try
|
||||
|
@ -432,9 +432,8 @@ namespace sscs.crypto
|
||||
CryptoStream csEncrypt = null;
|
||||
try
|
||||
{
|
||||
// NOTE: removed the delete call because the MPFileWatcher would replace it.
|
||||
//if(File.Exists(fileName))
|
||||
// File.Delete(fileName);
|
||||
if(File.Exists(fileName))
|
||||
File.Delete(fileName);
|
||||
byte[] baKey = Generate16ByteKeyFromString(passwd, null, false);
|
||||
|
||||
//Get an encryptor.
|
||||
@ -668,9 +667,8 @@ namespace sscs.crypto
|
||||
|
||||
try
|
||||
{
|
||||
// NOTE: removed the delete call because the MPFileWatcher would replace it.
|
||||
//if (File.Exists(sFileName + ".IV"))
|
||||
// File.Delete(sFileName + ".IV");
|
||||
if (File.Exists(sFileName + ".IV"))
|
||||
File.Delete(sFileName + ".IV");
|
||||
|
||||
// now save this
|
||||
FileStream fs = new FileStream(sFileName + ".IV", FileMode.Create);
|
||||
|
@ -122,6 +122,7 @@ namespace sscs.verbs
|
||||
{
|
||||
|
||||
SecretStore ssStore = SessionManager.CreateUserSession(userId);
|
||||
ssStore.PauseFileWatcher();
|
||||
|
||||
try
|
||||
{
|
||||
@ -230,7 +231,7 @@ namespace sscs.verbs
|
||||
wo.SetError(constants.RetCodes.FAILURE, e.ToString());
|
||||
}
|
||||
|
||||
|
||||
ssStore.ResumeFileWatcher();
|
||||
return wo;
|
||||
}
|
||||
|
||||
|
@ -87,10 +87,12 @@ namespace sscs.verbs
|
||||
{
|
||||
SecretStore ssStore = null;
|
||||
ssStore = SessionManager.GetUserSecretStore(userId);
|
||||
ssStore.PauseFileWatcher();
|
||||
if(ssStore.SetMasterPasscode(passcode))
|
||||
retCode = IPCRetCodes.SSCS_REPLY_SUCCESS;
|
||||
else
|
||||
retCode = IPCRetCodes.SSCS_E_SETTING_PASSCODE_FAILED;
|
||||
ssStore.ResumeFileWatcher();
|
||||
}
|
||||
catch(UserNotInSessionException)
|
||||
{
|
||||
|
@ -95,10 +95,14 @@ namespace sscs.verbs
|
||||
{
|
||||
SecretStore ssStore = null;
|
||||
ssStore = SessionManager.GetUserSecretStore(userId);
|
||||
ssStore.PauseFileWatcher();
|
||||
|
||||
if(ssStore.SetMasterPassword(passwd))
|
||||
retCode = IPCRetCodes.SSCS_REPLY_SUCCESS;
|
||||
else
|
||||
retCode = IPCRetCodes.SSCS_E_SETTING_PASSCODE_FAILED;
|
||||
|
||||
ssStore.ResumeFileWatcher();
|
||||
}
|
||||
catch(UserNotInSessionException)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user