[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
#include <security-server.h>
#include <password-exception.h>
+#include <fcntl.h>
+
namespace SecurityServer
{
PasswordFileBuffer::PasswordFileBuffer(): m_bufferReadBytes(0) {}
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)
#include <password-exception.h>
#include <password-file-buffer.h>
+#include <fcntl.h>
+
const std::string DATA_DIR = "/opt/data/security-server";
const std::string PASSWORD_FILE = "password.pwd";
const std::string ATTEMPT_FILE = "attempt";
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