+### SW-BACKEND ############################################################################
PKG_CHECK_MODULES(SW_BACKEND_DEP
REQUIRED
openssl
TARGET_LINK_LIBRARIES(${TARGET_SW_BACKEND} ${SW_BACKEND_DEP_LIBRARIES} ${TARGET_COMMON})
INSTALL(TARGETS ${TARGET_SW_BACKEND} DESTINATION ${PLUGIN_DIR})
+
+### TZ-BACKEND ############################################################################
+PKG_CHECK_MODULES(TZ_BACKEND_DEP
+ REQUIRED
+ )
+
+INCLUDE_DIRECTORIES(
+ SYSTEM
+ ${TZ_BACKEND_DEP_INCLUDE_DIRS}
+ ${COMMON_PATH}/include
+ ${SERVER_PATH}/service/include
+ ${DPL_PATH}/core/include
+ ${DPL_PATH}/log/include
+ ${PLUGIN_PATH}
+ )
+
+SET(TZ_BACKEND_SOURCES
+ tz-backend/password-file.cpp
+ )
+
+ADD_LIBRARY(${TARGET_TZ_BACKEND} SHARED ${TZ_BACKEND_SOURCES})
+
+SET_TARGET_PROPERTIES(
+ ${TARGET_TZ_BACKEND}
+ PROPERTIES
+ COMPILE_FLAGS "-D_GNU_SOURCE -fPIC -fvisibility=default"
+ SOVERSION ${API_VERSION}
+ VERSION ${VERSION}
+ )
+
+TARGET_LINK_LIBRARIES(${TARGET_TZ_BACKEND} ${TZ_BACKEND_DEP_LIBRARIES} ${TARGET_COMMON})
+
+#INSTALL(TARGETS ${TARGET_TZ_BACKEND} DESTINATION ${PLUGIN_DIR})
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+#include <tz-backend/password-file.h>
+
+#include <stdexcept>
+
+#include <generic-backend/password-file-buffer.h>
+
+extern "C" {
+
+AuthPasswd::IPasswordFile* PasswordFileFactory(unsigned int user)
+{
+ return new AuthPasswd::TZBackend::PasswordFile(user);
+}
+
+} // extern "C"
+
+namespace AuthPasswd {
+namespace TZBackend {
+
+PasswordFile::PasswordFile(unsigned int)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+void PasswordFile::writeMemoryToFile() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+void PasswordFile::writeAttemptToFile() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+void PasswordFile::setPassword(unsigned int, const std::string &)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+bool PasswordFile::checkPassword(unsigned int,
+ const std::string &) const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+void PasswordFile::setMaxHistorySize(unsigned int)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+unsigned int PasswordFile::getMaxHistorySize() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return -1;
+}
+
+unsigned int PasswordFile::getExpireTime() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return -1;
+}
+
+void PasswordFile::setExpireTime(unsigned int)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+void PasswordFile::setExpireTimeLeft(time_t)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+unsigned int PasswordFile::getExpireTimeLeft() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return -1;
+}
+
+unsigned int PasswordFile::getAttempt() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return -1;
+}
+
+void PasswordFile::resetAttempt()
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+void PasswordFile::incrementAttempt()
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+int PasswordFile::getMaxAttempt() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return -1;
+}
+
+void PasswordFile::setMaxAttempt(unsigned int)
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+}
+
+bool PasswordFile::isPasswordActive(unsigned int) const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+bool PasswordFile::isPasswordReused(const std::string &) const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+bool PasswordFile::checkExpiration() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+bool PasswordFile::checkIfAttemptsExceeded() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+bool PasswordFile::isIgnorePeriod() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+bool PasswordFile::isHistoryActive() const
+{
+ std::runtime_error("TZ-Backend is not implemented.");
+ return false;
+}
+
+} //namespace TZBackend
+} //namespace AuthPasswd
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+#ifndef _TZ_BACKEND_PASSWORD_FILE_H_
+#define _TZ_BACKEND_PASSWORD_FILE_H_
+
+#include <string>
+#include <generic-backend/ipassword-file.h>
+
+namespace AuthPasswd {
+namespace TZBackend {
+
+class PasswordFile : public IPasswordFile {
+public:
+ PasswordFile(unsigned int user);
+
+ void writeMemoryToFile() const override;
+ void writeAttemptToFile() const override;
+
+ void setPassword(unsigned int passwdType, const std::string &password) override;
+ bool checkPassword(unsigned int passwdType,
+ const std::string &password) const override;
+
+ void setMaxHistorySize(unsigned int history) override;
+ unsigned int getMaxHistorySize() const override;
+
+ unsigned int getExpireTime() const override;
+ void setExpireTime(unsigned int expireTime) override;
+
+ unsigned int getExpireTimeLeft() const override;
+ void setExpireTimeLeft(time_t expireTimeLeft) override;
+
+ unsigned int getAttempt() const override;
+ void resetAttempt() override;
+ void incrementAttempt() override;
+ int getMaxAttempt() const override;
+ void setMaxAttempt(unsigned int maxAttempt) override;
+
+ bool isPasswordActive(unsigned int passwdType) const override;
+ bool isPasswordReused(const std::string &password) const override;
+
+ bool checkExpiration() const override;
+ bool checkIfAttemptsExceeded() const override;
+ bool isIgnorePeriod() const override;
+
+ bool isHistoryActive() const override;
+};
+
+} // namespace TZBackend
+} // namespace AuthPasswd
+
+#endif