From: Jan Cybulski Date: Fri, 22 Nov 2013 17:14:24 +0000 (+0100) Subject: Flush files with security server passwords data X-Git-Tag: accepted/tizen/generic/20140307.163312~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66338a9ad316152fa2f2be6a064467dc22dbcf39;p=platform%2Fcore%2Fsecurity%2Fsecurity-server.git Flush files with security server passwords data [Issue#] SSDWSSP-683 [Bug/Feature] Information about putting password attempts was not flushed. [Solution] Flush that information to file. Test shown, that only using fsynch gives proper result. [Veryfication] Build, install, run tests. Change-Id: I96ee50186253d3efd1c74f3e2821dbc4f845a056 --- diff --git a/src/server/service/password-file-buffer.cpp b/src/server/service/password-file-buffer.cpp index eb97897..d52f447 100644 --- a/src/server/service/password-file-buffer.cpp +++ b/src/server/service/password-file-buffer.cpp @@ -32,6 +32,8 @@ #include #include +#include + namespace SecurityServer { PasswordFileBuffer::PasswordFileBuffer(): m_bufferReadBytes(0) {} @@ -78,6 +80,8 @@ namespace SecurityServer LogError("Failed to write data."); Throw(PasswordException::FStreamWriteError); } + file.close(); + int fd = open(path.c_str(), O_WRONLY | O_APPEND); fsync(fd); close(fd); } void PasswordFileBuffer::Load(const std::string &path) diff --git a/src/server/service/password-file.cpp b/src/server/service/password-file.cpp index 5f20fc2..1532e3f 100644 --- a/src/server/service/password-file.cpp +++ b/src/server/service/password-file.cpp @@ -37,6 +37,8 @@ #include #include +#include + const std::string DATA_DIR = "/opt/data/security-server"; const std::string PASSWORD_FILE = "password.pwd"; const std::string ATTEMPT_FILE = "attempt"; @@ -190,6 +192,8 @@ namespace SecurityServer LogError("Failed to write attempt count."); Throw(PasswordException::FStreamWriteError); } + attemptFile.close(); + int fd = open((DATA_DIR + "/" + ATTEMPT_FILE).c_str(), O_WRONLY | O_APPEND); fsync(fd); close(fd); } bool PasswordFile::isPasswordActive() const