diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9322df5e3c153a3e983245ff0dfb6c05aa57a3ef..63d6ae9721cfc5b520675ff67d9a48f8cc66f948 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,18 +16,19 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
+# 定义支持的语言列表
+set(LANGUAGES zh_CN) # 可以添加更多语言 # set(LANGUAGES zh_CN bo_CN ug_CN mn_MN ky_KG
+ # kk_KZ)
+
find_package(PkgConfig REQUIRED)
find_package(Qt5 COMPONENTS Core DBus Sql Concurrent LinguistTools)
pkg_search_module(KLOG_QT5 REQUIRED klog-qt5)
-pkg_search_module(SYSTEMD REQUIRED systemd)
-pkg_search_module(KIRAN_CC_DAEMON REQUIRED kiran-cc-daemon)
pkg_search_module(PAM QUIET pam)
if(NOT DEFINED ${PAM_FOUND})
set(PAM_INCLUDE_DIRS /usr/include/security)
set(PAM_LIBRARIES pam)
endif()
-pkg_search_module(LIBSYSTEMD REQUIRED libsystemd)
configure_file(config.h.in ${PROJECT_BINARY_DIR}/config.h)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 5a14187df6b19a25267d3ae167535e35cc5d11db..8dd1691c8a7c5ecc266c4b489c02218f023c9fa2 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -4,10 +4,49 @@ if(SYSTEMD_FOUND)
else()
set(SYSTEM_UNIT_DIR ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
endif()
+# initd service directory
+set(INITD_SERVICE_DIR "/etc/init.d/")
+
+# systemd service files
+file(GLOB SERVICE_IN_FILES services/systemd/*.service.in)
+foreach(SERVICE_IN_FILE IN LISTS SERVICE_IN_FILES)
+ string(REGEX REPLACE ".+/(.+)\\..*" "\\1" SERVICE_FILE ${SERVICE_IN_FILE})
+ configure_file(${SERVICE_IN_FILE}
+ ${PROJECT_BINARY_DIR}/data/services/systemd/${SERVICE_FILE})
+endforeach()
-# policy files
-file(GLOB POLICY_IN_FILES ${PROJECT_SOURCE_DIR}/data/*.policy.in)
+# install systemd service files
+install(FILES dbus/com.kylinsec.Kiran.Authentication.conf
+ DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1/system.d)
+install(
+ FILES
+ ${PROJECT_BINARY_DIR}/data/services/systemd/com.kylinsec.Kiran.Authentication.service
+ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/system-services)
+install(
+ FILES
+ ${PROJECT_BINARY_DIR}/data/services/systemd/kiran-authentication-daemon.service
+ DESTINATION ${SYSTEM_UNIT_DIR})
+install(
+ FILES
+ ${PROJECT_BINARY_DIR}/data/services/systemd/com.kylinsec.Kiran.AuthDevice.service
+ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/system-services)
+install(
+ FILES
+ ${PROJECT_BINARY_DIR}/data/services/systemd/kiran-authentication-devices.service
+ DESTINATION ${SYSTEM_UNIT_DIR})
+
+# install initd service files
+install(
+ FILES ${PROJECT_SOURCE_DIR}/data/services/initd/kiran-authentication-daemon
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ DESTINATION ${INITD_SERVICE_DIR})
+install(
+ FILES ${PROJECT_SOURCE_DIR}/data/services/initd/kiran-authentication-devices
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ DESTINATION ${INITD_SERVICE_DIR})
+# install policy files
+file(GLOB POLICY_IN_FILES ${PROJECT_SOURCE_DIR}/data/*.policy.in)
foreach(POLICY_IN_FILE IN LISTS POLICY_IN_FILES)
string(REGEX REPLACE ".+/(.+)\\..*" "\\1" POLICY_FILE ${POLICY_IN_FILE})
configure_file(${POLICY_IN_FILE} ${POLICY_FILE})
@@ -15,35 +54,8 @@ foreach(POLICY_IN_FILE IN LISTS POLICY_IN_FILES)
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/actions/)
endforeach()
-# .in files
-configure_file(
- com.kylinsec.Kiran.Authentication.service.in
- ${PROJECT_BINARY_DIR}/data/com.kylinsec.Kiran.Authentication.service)
-
-configure_file(kiran-authentication-daemon.service.in
- ${PROJECT_BINARY_DIR}/data/kiran-authentication-daemon.service)
-
-configure_file(kiran-authentication-devices.service.in
- ${PROJECT_BINARY_DIR}/data/kiran-authentication-devices.service)
-
-configure_file(com.kylinsec.Kiran.AuthDevice.service.in
- ${PROJECT_BINARY_DIR}/data/com.kylinsec.Kiran.AuthDevice.service)
-
-# install
-install(FILES com.kylinsec.Kiran.Authentication.conf
- DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/dbus-1/system.d)
-install(
- FILES ${PROJECT_BINARY_DIR}/data/com.kylinsec.Kiran.Authentication.service
- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/system-services)
-install(FILES ${PROJECT_BINARY_DIR}/data/kiran-authentication-daemon.service
- DESTINATION ${SYSTEM_UNIT_DIR})
-
-install(FILES ${PROJECT_BINARY_DIR}/data/com.kylinsec.Kiran.AuthDevice.service
- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/system-services)
-install(FILES ${PROJECT_BINARY_DIR}/data/kiran-authentication-devices.service
- DESTINATION ${SYSTEM_UNIT_DIR})
-
+# install config files
install(FILES kad.ini DESTINATION ${KAS_INSTALL_SYSCONFDIR})
-
+# install pam config files
install(FILES kiran-authentication-service
DESTINATION /${CMAKE_INSTALL_SYSCONFDIR}/pam.d/)
diff --git a/data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml b/data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml
deleted file mode 100644
index b6926c19fea9565a715a0d37a9c99c0225d94939..0000000000000000000000000000000000000000
--- a/data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml
+++ /dev/null
@@ -1,264 +0,0 @@
-
-
-
-
-
-
- The new username.
-
- Sets the users username. Note that it is usually not allowed to have multiple users with the same username.
-
-
-
-
- The new name, typically in the form "Firstname Lastname".
-
- Sets the users real name.
-
-
-
-
- The new email address.
-
- Sets the users email address.
-
-
-
-
- The new language, as a locale specification like "de_DE.UTF-8".
-
- Sets the users language.
-
-
-
-
- The new xsession to start (e.g. "gnome")
-
- Sets the users x session.
-
-
-
-
- The new session to start (e.g. "gnome-xorg")
-
- Sets the users wayland or x session.
-
-
-
-
- The type of the new session to start (e.g. "wayland" or "x11")
-
- Sets the session type of the users session.
-
-
-
-
- The new homedir as an absolute path.
-
- Sets the users home directory.
-
-
-
-
- The new user shell.
-
- Sets the users shell.
-
-
-
-
- The absolute filename of a png file to use as the users icon.
-
- Sets the users icon.
-
-
-
-
- Whether to lock or unlock the users account.
-
- Locks or unlocks a users account.
-
-
-
-
- The new account type, encoded as an integer. Refer to AccountsAccountType in accounts-i.h
-
- Changes the users account type.
-
-
-
-
- The new password mode, encoded as an integer:
-
- Changes the users password mode. Note that changing the password mode has the side-effect of unlocking the account.
-
-
-
-
- The crypted password.
-
-
- The password hint.
-
- Sets a new password for this user. Note that setting a password has the side-effect of unlocking the account.
-
-
-
-
- The current password is required when set the user itself. otherwise, the current password can be set to null.
- The password should be encrypted by rsa algorithm.
-
-
- The new password. The password should be encrypted by rsa algorithm.
-
- Sets a new password by passwd command for this user. Note that setting a password has the side-effect of unlocking the account.
-
-
-
-
- The password hint.
-
- Sets the users password hint.
-
-
-
-
- Whether to enable automatic login for this user.
-
- Enables or disables automatic login for a user.
- Note that usually only one user can have automatic login
- enabled, so turning it on for a user will disable it for
- the previously configured autologin user.
-
-
-
-
- The password expiration policy options that is a jason string which format refer to
- property password_expiration_policy.
-
- Set user password expiry information which contain expiration_time, last_change_time, min_days_between_changes,
- max_days_between_changes, days_to_warn, inactive_days_after_expiration
-
-
-
-
- The authentication mode which could be fingerprint, face, etc. Refer to AccountsAuthMode in accounts-i.h
-
-
- the name of the authentication item. For example fingerprint 1, fingerprint 2, etc.
-
-
- The identity of the collected data for the authentication item.
-
- Add an auth item for a mode. Return error if the name already exists or the method is unsupported.
-
-
-
-
-
- Delete an auth item by name. Return error if the name doesn't exist or the method is unsupported.
-
-
-
-
-
- The json string is an array that every item contains name and the identity of the collected data.
-
-
-
-
-
-
- Enable or disable the authentication mode.
-
-
-
-
- The uid of the user.
-
-
-
-
- The gid of the user.
-
-
-
- The username of the user.
-
-
-
- The users real name.
-
-
-
- The users account type, encoded as an integer. Refer to AccountsAccountType in accounts-i.h
-
-
-
- The users home directory.
-
-
-
- The users shell.
-
-
-
- The email address.
-
-
-
- The users language, as a locale specification like "de_DE.UTF-8".
-
-
-
- The users Wayland or X session.
-
-
-
- The type of session the user should use (e.g. "wayland" or "x11")
-
-
-
- The users x session.
-
-
-
- The filename of a png file containing the users icon.
-
-
-
- Whether the users account is locked.
-
-
-
- The password mode for the user account, encoded as an integer. Refer to AccountsPasswordMode in accounts-i.h
-
-
-
- The password hint for the user.
-
-
-
- Whether automatic login is enabled for the user.
-
-
-
- Whether this is a 'system' account, like 'root' or 'nobody'.
- System accounts should normally not appear in lists of users, and ListCachedUsers
- will not include such accounts.
-
-
-
- Bitwise OR the enabled authentication mode.
-
-
-
- The password expiration policy that is a jason string.
-
-
-
-
- Send this signal when the item of the authentication mode is added or deleted.
-
-
-
diff --git a/data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml b/data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml
deleted file mode 100644
index 2248466168b4a2135ea524404de4dc9f31b633a9..0000000000000000000000000000000000000000
--- a/data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
- Object paths of non system users
-
-
-
-
-
- The uid to look up
-
-
- Object path of user
-
-
-
-
-
- The username to look up
-
-
- Object path of user
-
-
-
-
-
- The authentication mode which could be fingerprint, face, etc. Refer to AccountsAuthMode in accounts-i.h
-
-
- The identity of the collected data for the authentication item.
-
-
- Object path of the new user.
-
-
-
-
-
- The username for the new user
-
-
- The real name for the new user
-
-
- The account type, encoded as an integer
-
-
- The user uid. If uid is less than zero, then auto to allocate one.
-
-
- Object path of the new user
-
-
-
-
-
- The uid to delete
-
-
- Whether to remove the users files
-
-
-
-
-
-
- The RSA public key.
-
-
-
-
- Object path of the user that was added.
-
-
-
-
-
- Object path of the user that was deleted.
-
-
-
-
-
\ No newline at end of file
diff --git a/data/com.kylinsec.Kiran.AuthDevice.Device.xml b/data/dbus/com.kylinsec.Kiran.AuthDevice.Device.xml
similarity index 100%
rename from data/com.kylinsec.Kiran.AuthDevice.Device.xml
rename to data/dbus/com.kylinsec.Kiran.AuthDevice.Device.xml
diff --git a/data/com.kylinsec.Kiran.AuthDevice.xml b/data/dbus/com.kylinsec.Kiran.AuthDevice.xml
similarity index 100%
rename from data/com.kylinsec.Kiran.AuthDevice.xml
rename to data/dbus/com.kylinsec.Kiran.AuthDevice.xml
diff --git a/data/com.kylinsec.Kiran.Authentication.Session.xml b/data/dbus/com.kylinsec.Kiran.Authentication.Session.xml
similarity index 100%
rename from data/com.kylinsec.Kiran.Authentication.Session.xml
rename to data/dbus/com.kylinsec.Kiran.Authentication.Session.xml
diff --git a/data/com.kylinsec.Kiran.Authentication.User.xml b/data/dbus/com.kylinsec.Kiran.Authentication.User.xml
similarity index 100%
rename from data/com.kylinsec.Kiran.Authentication.User.xml
rename to data/dbus/com.kylinsec.Kiran.Authentication.User.xml
diff --git a/data/com.kylinsec.Kiran.Authentication.conf b/data/dbus/com.kylinsec.Kiran.Authentication.conf
similarity index 100%
rename from data/com.kylinsec.Kiran.Authentication.conf
rename to data/dbus/com.kylinsec.Kiran.Authentication.conf
diff --git a/data/com.kylinsec.Kiran.Authentication.xml b/data/dbus/com.kylinsec.Kiran.Authentication.xml
similarity index 100%
rename from data/com.kylinsec.Kiran.Authentication.xml
rename to data/dbus/com.kylinsec.Kiran.Authentication.xml
diff --git a/data/services/initd/kiran-authentication-daemon b/data/services/initd/kiran-authentication-daemon
new file mode 100644
index 0000000000000000000000000000000000000000..313bf62f9d5879f2b291a5ed0fb8c94bd3651bdd
--- /dev/null
+++ b/data/services/initd/kiran-authentication-daemon
@@ -0,0 +1,142 @@
+#!/bin/sh
+#
+# kiran-authentication-daemon: start and stop the Kiran Authentication Daemon
+#
+# chkconfig: 2345 99 01
+# description: Kiran Authentication Daemon Service
+# processname: kiran-authentication-daemon
+# pidfile: /var/run/kiran-authentication-daemon.pid
+
+### BEGIN INIT INFO
+# Provides: kiran-authentication-daemon
+# Required-Start: $dbus
+# Required-Stop:
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Kiran Authentication Daemon
+### END INIT INFO
+
+DAEMON=/usr/bin/kiran-authentication-daemon
+PIDFILE=/var/run/kiran-authentication-daemon.pid
+NAME=kiran-authentication-daemon
+DESC="Kiran Authentication Daemon"
+
+start() {
+ echo "Starting $DESC..."
+ # Check if daemon executable exists
+ if [ ! -x "$DAEMON" ]; then
+ echo "Error: $DAEMON not found or not executable"
+ return 1
+ fi
+
+ if [ -f "$PIDFILE" ]; then
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID, removing..."
+ rm -f "$PIDFILE"
+ elif ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME already running (pid: $pid)"
+ return 0
+ else
+ echo "$NAME pid file exists but process not found, cleaning up..."
+ rm -f "$PIDFILE"
+ fi
+ fi
+
+ echo "$NAME not running, starting..."
+ $DAEMON &
+ daemon_pid=$!
+
+ # Wait a moment to check if process is still running
+ sleep 1
+ if ps -p "$daemon_pid" > /dev/null 2>&1; then
+ echo "$daemon_pid" > "$PIDFILE"
+ echo "Started."
+ return 0
+ else
+ echo "Error: Failed to start $NAME"
+ return 1
+ fi
+}
+
+stop() {
+ echo "Stopping $DESC..."
+ if [ ! -f "$PIDFILE" ]; then
+ echo "$NAME not running"
+ return 1
+ fi
+
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID, removing..."
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ if ! ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME process not found (stale pid file)"
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ # Try SIGTERM first, then SIGKILL
+ if kill "$pid" 2>/dev/null; then
+ # Wait for process to terminate
+ count=0
+ while [ $count -lt 10 ] && ps -p "$pid" > /dev/null 2>&1; do
+ sleep 1
+ count=$((count + 1))
+ done
+
+ if ps -p "$pid" > /dev/null 2>&1; then
+ echo "Process did not terminate, forcing kill..."
+ kill -9 "$pid" 2>/dev/null
+ sleep 1
+ fi
+ else
+ echo "Error: Failed to send signal to process $pid"
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ rm -f "$PIDFILE"
+ echo "Stopped."
+ return 0
+}
+
+status() {
+ if [ -f "$PIDFILE" ]; then
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID"
+ return 1
+ elif ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME running (pid $pid)"
+ return 0
+ else
+ echo "$NAME pid file exists but process not found"
+ return 1
+ fi
+ else
+ echo "$NAME not running"
+ return 3
+ fi
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+ return $?
+}
+
+case "$1" in
+ start) start ;;
+ stop) stop ;;
+ restart) restart ;;
+ status) status ;;
+ *) echo "Usage: $0 {start|stop|restart|status}" ;;
+esac
\ No newline at end of file
diff --git a/data/services/initd/kiran-authentication-devices b/data/services/initd/kiran-authentication-devices
new file mode 100644
index 0000000000000000000000000000000000000000..83fbbb9508e647473c3fe4672fe3fd3cf4126cc7
--- /dev/null
+++ b/data/services/initd/kiran-authentication-devices
@@ -0,0 +1,142 @@
+#!/bin/sh
+#
+# kiran-authentication-devices: start and stop the Kiran Authentication Devices
+#
+# chkconfig: 2345 99 01
+# description: Kiran Authentication Devices Service
+# processname: kiran-authentication-devices
+# pidfile: /var/run/kiran-authentication-devices.pid
+
+### BEGIN INIT INFO
+# Provides: kiran-authentication-devices
+# Required-Start: $dbus
+# Required-Stop:
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Kiran Authentication Devices
+### END INIT INFO
+
+DAEMON=/usr/bin/kiran-authentication-devices
+PIDFILE=/var/run/kiran-authentication-devices.pid
+NAME=kiran-authentication-devices
+DESC="Kiran Authentication Devices"
+
+start() {
+ echo "Starting $DESC..."
+ # Check if daemon executable exists
+ if [ ! -x "$DAEMON" ]; then
+ echo "Error: $DAEMON not found or not executable"
+ return 1
+ fi
+
+ if [ -f "$PIDFILE" ]; then
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID, removing..."
+ rm -f "$PIDFILE"
+ elif ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME already running (pid: $pid)"
+ return 0
+ else
+ echo "$NAME pid file exists but process not found, cleaning up..."
+ rm -f "$PIDFILE"
+ fi
+ fi
+
+ echo "$NAME not running, starting..."
+ $DAEMON &
+ daemon_pid=$!
+
+ # Wait a moment to check if process is still running
+ sleep 1
+ if ps -p "$daemon_pid" > /dev/null 2>&1; then
+ echo "$daemon_pid" > "$PIDFILE"
+ echo "Started."
+ return 0
+ else
+ echo "Error: Failed to start $NAME"
+ return 1
+ fi
+}
+
+stop() {
+ echo "Stopping $DESC..."
+ if [ ! -f "$PIDFILE" ]; then
+ echo "$NAME not running"
+ return 1
+ fi
+
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID, removing..."
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ if ! ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME process not found (stale pid file)"
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ # Try SIGTERM first, then SIGKILL
+ if kill "$pid" 2>/dev/null; then
+ # Wait for process to terminate
+ count=0
+ while [ $count -lt 10 ] && ps -p "$pid" > /dev/null 2>&1; do
+ sleep 1
+ count=$((count + 1))
+ done
+
+ if ps -p "$pid" > /dev/null 2>&1; then
+ echo "Process did not terminate, forcing kill..."
+ kill -9 "$pid" 2>/dev/null
+ sleep 1
+ fi
+ else
+ echo "Error: Failed to send signal to process $pid"
+ rm -f "$PIDFILE"
+ return 1
+ fi
+
+ rm -f "$PIDFILE"
+ echo "Stopped."
+ return 0
+}
+
+status() {
+ if [ -f "$PIDFILE" ]; then
+ pid=$(cat "$PIDFILE")
+ # Validate PID is a number
+ if ! [ "$pid" -eq "$pid" ] 2>/dev/null; then
+ echo "$NAME pid file contains invalid PID"
+ return 1
+ elif ps -p "$pid" > /dev/null 2>&1; then
+ echo "$NAME running (pid $pid)"
+ return 0
+ else
+ echo "$NAME pid file exists but process not found"
+ return 1
+ fi
+ else
+ echo "$NAME not running"
+ return 3
+ fi
+}
+
+restart() {
+ stop
+ sleep 1
+ start
+ return $?
+}
+
+case "$1" in
+ start) start ;;
+ stop) stop ;;
+ restart) restart ;;
+ status) status ;;
+ *) echo "Usage: $0 {start|stop|restart|status}" ;;
+esac
\ No newline at end of file
diff --git a/data/com.kylinsec.Kiran.AuthDevice.service.in b/data/services/systemd/com.kylinsec.Kiran.AuthDevice.service.in
similarity index 100%
rename from data/com.kylinsec.Kiran.AuthDevice.service.in
rename to data/services/systemd/com.kylinsec.Kiran.AuthDevice.service.in
diff --git a/data/com.kylinsec.Kiran.Authentication.service.in b/data/services/systemd/com.kylinsec.Kiran.Authentication.service.in
similarity index 100%
rename from data/com.kylinsec.Kiran.Authentication.service.in
rename to data/services/systemd/com.kylinsec.Kiran.Authentication.service.in
diff --git a/data/kiran-authentication-daemon.service.in b/data/services/systemd/kiran-authentication-daemon.service.in
similarity index 100%
rename from data/kiran-authentication-daemon.service.in
rename to data/services/systemd/kiran-authentication-daemon.service.in
diff --git a/data/kiran-authentication-devices.service.in b/data/services/systemd/kiran-authentication-devices.service.in
similarity index 100%
rename from data/kiran-authentication-devices.service.in
rename to data/services/systemd/kiran-authentication-devices.service.in
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index d66a572d7ef18b5862c2ea39e18908130a7f2b60..074170b1e8724b93e906c7fa4a354dfa7a877d14 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -3,7 +3,7 @@ file(GLOB_RECURSE CPP_FILES ./*.cpp)
qt5_add_dbus_adaptor(
AUTH_MANAGER_ADAPTOR_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.xml
${CMAKE_SOURCE_DIR}/src/daemon/auth-manager.h
Kiran::AuthManager
auth_manager_adaptor
@@ -11,7 +11,7 @@ qt5_add_dbus_adaptor(
qt5_add_dbus_adaptor(
AUTH_SESSION_ADAPTOR_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.Session.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.Session.xml
${CMAKE_SOURCE_DIR}/src/daemon/session.h
Kiran::Session
session_adaptor
@@ -19,52 +19,31 @@ qt5_add_dbus_adaptor(
qt5_add_dbus_adaptor(
USER_ADAPTOR_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.User.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.User.xml
${CMAKE_SOURCE_DIR}/src/daemon/user.h Kiran::User user_adaptor UserAdaptor)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml
- PROPERTIES CLASSNAME AccountsProxy NO_NAMESPACE true)
-
-qt5_add_dbus_interface(
- ACCOUNTS_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.SystemDaemon.Accounts.xml
- accounts_proxy)
-
-set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml
- PROPERTIES CLASSNAME AccountsUserProxy NO_NAMESPACE true)
-
-qt5_add_dbus_interface(
- ACCOUNTS_USER_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.SystemDaemon.Accounts.User.xml
- accounts_user_proxy)
-
-set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.xml
PROPERTIES CLASSNAME AuthDeviceManagerProxy NO_NAMESPACE true)
qt5_add_dbus_interface(
BIOMETRICS_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.xml
auth_device_manager_proxy)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.Device.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.Device.xml
PROPERTIES CLASSNAME AuthDeviceProxy NO_NAMESPACE true)
qt5_add_dbus_interface(
BIOMETRICS_DEVICE_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.Device.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.Device.xml
auth_device_proxy)
set(TARGET_NAME kiran-authentication-daemon)
configure_file(config-daemon.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-daemon.h)
-# 定义支持的语言列表
-set(LANGUAGES zh_CN) # 可以添加更多语言 # set(LANGUAGES zh_CN bo_CN ug_CN mn_MN ky_KG kk_KZ)
-
# 定义翻译源文件列表
set(QM_FILES "")
@@ -76,9 +55,13 @@ foreach(LANG ${LANGUAGES})
execute_process(COMMAND lupdate-qt5 -no-obsolete ${H_FILES} ${CPP_FILES}
${COMMON_CPP_FILES} -ts ${TS_FILE})
- # 生成 qm 文件
- qt5_add_translation(QM_FILE ${TS_FILE})
+ # https://bugreports.qt.io/browse/QTBUG-64317 5.9.4以下生成的qm文件不带${LANG}后缀
+ # qt5_add_translation(QM_FILE ${TS_FILE})
+ set(QM_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.${LANG}.qm")
+ # 执行 lrelease 生成qm文件
+ execute_process(COMMAND lrelease ${TS_FILE} -qm ${QM_FILE})
list(APPEND QM_FILES ${QM_FILE})
+ message(STATUS "QM_FILE: ${QM_FILE}")
endforeach()
add_executable(
diff --git a/src/daemon/device/device-adaptor.cpp b/src/daemon/device/device-adaptor.cpp
index 65314e03f7a93820ba4b6efe27d0eb5a090b6c18..0b77c0beff1ecc3cf59436eced7677519492c726 100644
--- a/src/daemon/device/device-adaptor.cpp
+++ b/src/daemon/device/device-adaptor.cpp
@@ -16,12 +16,12 @@
#include
#include
-#include "kas-authentication-i.h"
-#include "logging-category.h"
#include "auth-manager.h"
#include "config-daemon.h"
#include "device-adaptor.h"
#include "device-protocol.h"
+#include "kas-authentication-i.h"
+#include "logging-category.h"
#include "proxy/login1-manager-proxy.h"
#include "proxy/login1-seat-proxy.h"
#include "proxy/login1-session-proxy.h"
@@ -144,7 +144,7 @@ void DeviceAdaptor::wakeRequest(QSharedPointer request)
void DeviceAdaptor::removeRequest(int64_t requestID)
{
- auto request = this->m_requests.value(requestID, nullptr);
+ auto request = this->m_requests.value(requestID, QSharedPointer());
RETURN_IF_FALSE(request);
if (this->m_currentRequest && (requestID == this->m_currentRequest->reqID))
@@ -169,7 +169,7 @@ void DeviceAdaptor::interruptRequest()
{
this->m_currentRequest->stop();
this->m_currentRequest->source->interrupt();
- this->m_currentRequest = nullptr;
+ this->m_currentRequest.clear();
}
}
@@ -180,7 +180,7 @@ void DeviceAdaptor::finishRequest()
stopDeviceOccupyTimer();
this->m_currentRequest->source->end();
this->m_requests.remove(this->m_currentRequest->reqID);
- this->m_currentRequest = nullptr;
+ this->m_currentRequest.clear();
}
this->schedule();
diff --git a/src/daemon/proxy/dbus-daemon-proxy.cpp b/src/daemon/proxy/dbus-daemon-proxy.cpp
index 0cc65976c605942266ddecdd3cb9fb3482b47880..41f120dd35974953f3a3ffd26c97f113a6457aca 100644
--- a/src/daemon/proxy/dbus-daemon-proxy.cpp
+++ b/src/daemon/proxy/dbus-daemon-proxy.cpp
@@ -28,7 +28,7 @@ DBusDaemonProxy::DBusDaemonProxy()
{
}
-QSharedPointer DBusDaemonProxy::m_instance = nullptr;
+QSharedPointer DBusDaemonProxy::m_instance = QSharedPointer();
QSharedPointer DBusDaemonProxy::getDefault()
{
if (!m_instance)
diff --git a/src/daemon/proxy/login1-manager-proxy.cpp b/src/daemon/proxy/login1-manager-proxy.cpp
index 22437c102693502aabb5c350ce0fb578a4947573..6b86e5de7861d1d38f65e7f59a21de2715d4e028 100644
--- a/src/daemon/proxy/login1-manager-proxy.cpp
+++ b/src/daemon/proxy/login1-manager-proxy.cpp
@@ -28,7 +28,7 @@ Login1ManagerProxy::Login1ManagerProxy()
{
}
-QSharedPointer Login1ManagerProxy::m_instance = nullptr;
+QSharedPointer Login1ManagerProxy::m_instance = QSharedPointer();
QSharedPointer Login1ManagerProxy::getDefault()
{
if (!m_instance)
diff --git a/src/daemon/proxy/login1-seat-proxy.cpp b/src/daemon/proxy/login1-seat-proxy.cpp
index efa42af432d7873f06f2f0b51e86a1739eac2370..c1aba6569612445fda87599799bb911ca19e8406 100644
--- a/src/daemon/proxy/login1-seat-proxy.cpp
+++ b/src/daemon/proxy/login1-seat-proxy.cpp
@@ -57,7 +57,7 @@ Login1SeatProxy::Login1SeatProxy(const QDBusObjectPath &objectPath) : m_objectPa
}
}
-QSharedPointer Login1SeatProxy::m_defaultSeat = nullptr;
+QSharedPointer Login1SeatProxy::m_defaultSeat = QSharedPointer();
QSharedPointer Login1SeatProxy::getDefault()
{
if (!m_defaultSeat)
diff --git a/src/daemon/proxy/polkit-proxy.cpp b/src/daemon/proxy/polkit-proxy.cpp
index 0b45c2e52856bee3db426f354dfef577723c97a6..6a91565750362de0896426dedcb7269940f9420a 100644
--- a/src/daemon/proxy/polkit-proxy.cpp
+++ b/src/daemon/proxy/polkit-proxy.cpp
@@ -127,7 +127,7 @@ PolkitProxy::PolkitProxy()
qDBusRegisterMetaType();
}
-QSharedPointer PolkitProxy::m_instance = nullptr;
+QSharedPointer PolkitProxy::m_instance = QSharedPointer();
QSharedPointer PolkitProxy::getDefault()
{
if (!m_instance)
diff --git a/src/daemon/session.cpp b/src/daemon/session.cpp
index aa94573568c397f43f3570e92e5004e99778d2a6..c2ccaa447f31f2b09949f757f4bb32a2465fb419 100644
--- a/src/daemon/session.cpp
+++ b/src/daemon/session.cpp
@@ -212,7 +212,7 @@ void Session::end()
{
KLOG_DEBUG() << m_sessionID << "session (request id:" << this->m_verifyInfo.m_requestID << ") end";
this->m_verifyInfo.m_requestID = -1;
- this->m_verifyInfo.deviceAdaptor = nullptr;
+ this->m_verifyInfo.deviceAdaptor.clear();
}
void Session::onIdentifyStatus(const QString &bid, int result, const QString &message)
diff --git a/src/daemon/user-manager.cpp b/src/daemon/user-manager.cpp
index 85d5f404b897f2918e6e5a3f36fee01654defe13..8812d0657c7cb260a4a206711c9bc0581ecb4251 100644
--- a/src/daemon/user-manager.cpp
+++ b/src/daemon/user-manager.cpp
@@ -12,23 +12,23 @@
* Author: tangjie02
*/
#include
-#include
#include
#include
+#include
-#include "accounts_proxy.h"
#include "config-daemon.h"
#include "lib/feature-db.h"
#include "user-manager.h"
+#define ETC_PASSWD_FILE "/etc/passwd"
+
namespace Kiran
{
UserManager::UserManager()
{
- this->m_accountsProxy = new AccountsProxy(ACCOUNTS_DBUS_NAME,
- ACCOUNTS_OBJECT_PATH,
- QDBusConnection::systemBus(),
- this);
+ m_passwdWatcher = new QFileSystemWatcher(this);
+ m_passwdWatcher->addPath(ETC_PASSWD_FILE);
+ connect(m_passwdWatcher, SIGNAL(fileChanged(const QString &)), this, SLOT(onPasswdFileChanged(const QString &)));
}
UserManager *UserManager::m_instance = nullptr;
@@ -40,11 +40,11 @@ void UserManager::globalInit()
QSharedPointer UserManager::findUser(const QString &userName)
{
- auto user = this->m_users.value(userName, nullptr);
+ auto user = this->m_users.value(userName, QSharedPointer());
RETURN_VAL_IF_TRUE(user, user);
auto pwent = getpwnam(userName.toStdString().c_str());
- RETURN_VAL_IF_TRUE(pwent == NULL, NULL);
+ RETURN_VAL_IF_TRUE(pwent == nullptr, QSharedPointer());
user = addUser(userName);
return user;
@@ -53,7 +53,6 @@ QSharedPointer UserManager::findUser(const QString &userName)
void UserManager::init()
{
this->initUsers();
- connect(this->m_accountsProxy, SIGNAL(UserDeleted(const QDBusObjectPath &)), this, SLOT(onUserDeleted(const QDBusObjectPath &)));
}
void UserManager::initUsers()
@@ -100,12 +99,41 @@ void UserManager::deleteIID(const QString &iid)
FeatureDB::getInstance()->deleteFearureByIID(iid);
}
-void UserManager::onUserDeleted(const QDBusObjectPath &userObjectPath)
+void UserManager::onPasswdFileChanged(const QString &path)
{
- QFileInfo fileInfo(userObjectPath.path());
- auto uid = fileInfo.baseName().toLongLong();
- auto pwent = getpwuid(uid);
- RETURN_IF_TRUE(pwent == NULL);
- this->deleteUser(pwent->pw_name);
+ auto fp = fopen(ETC_PASSWD_FILE, "r");
+ if (fp == NULL)
+ {
+ KLOG_WARNING() << "Unable to open" << ETC_PASSWD_FILE << ":" << strerror(errno);
+ return;
+ }
+
+ // 从/etc/passwd文件中获取当前存在的用户列表
+ // 将操作系统用户列表与m_users中用户列表进行比较,如果m_users中存在多余的用户,则删除该用户
+ QStringList systemUserList;
+ struct passwd *pwent;
+ do
+ {
+ pwent = fgetpwent(fp);
+ if (pwent != NULL)
+ {
+ auto passwd = QSharedPointer::create(pwent);
+ systemUserList.append(passwd->pw_name);
+ }
+ } while (pwent != NULL);
+
+ fclose(fp);
+
+ for (const auto &userName : this->m_users.keys())
+ {
+ if (!systemUserList.contains(userName))
+ {
+ KLOG_INFO() << "delete user:" << userName << ", because it is not in the system passwd file";
+ this->deleteUser(userName);
+ }
+ }
+
+ m_passwdWatcher->addPath(ETC_PASSWD_FILE);
}
+
} // namespace Kiran
diff --git a/src/daemon/user-manager.h b/src/daemon/user-manager.h
index 3c17a7c8dc6b4da2f20ad770705fb6c2a1e2382a..212c3392e35a2c374ad16aaf42e29312f46949da 100644
--- a/src/daemon/user-manager.h
+++ b/src/daemon/user-manager.h
@@ -15,11 +15,11 @@
#pragma once
#include
+#include
+#include
#include "user.h"
-class AccountsProxy;
-
namespace Kiran
{
class UserManager : QObject
@@ -47,13 +47,14 @@ private:
void deleteIID(const QString &iid);
private Q_SLOTS:
- void onUserDeleted(const QDBusObjectPath &userObjectPath);
+ void onPasswdFileChanged(const QString &path);
private:
static UserManager *m_instance;
- AccountsProxy *m_accountsProxy;
// <用户名,用户对象>
QMap> m_users;
+ // 监控/etc/passwd文件变化
+ QFileSystemWatcher *m_passwdWatcher;
};
} // namespace Kiran
diff --git a/src/daemon/user.cpp b/src/daemon/user.cpp
index 2f784faaf61001fd093db54eda655f835377ecd0..77046b2528e5bc508e1b75b65be956d6ffd0b0fd 100644
--- a/src/daemon/user.cpp
+++ b/src/daemon/user.cpp
@@ -189,7 +189,7 @@ void User::end()
{
USER_DEBUG() << "request end";
this->m_enrollInfo.m_requestID = -1;
- this->m_enrollInfo.deviceAdaptor = nullptr;
+ this->m_enrollInfo.deviceAdaptor.clear();
this->m_enrollInfo.m_authTpe = -1;
this->m_enrollInfo.m_feautreName.clear();
}
diff --git a/src/device-manager/CMakeLists.txt b/src/device-manager/CMakeLists.txt
index 403dea83e43cc2d7ff037290db46d14b96a1fc38..6de25b006ccc0b2057be3361618368e2cd520c97 100644
--- a/src/device-manager/CMakeLists.txt
+++ b/src/device-manager/CMakeLists.txt
@@ -5,9 +5,6 @@ set(TARGET_NAME kiran-authentication-devices)
file(GLOB_RECURSE H_FILES ./*.h)
file(GLOB_RECURSE CPP_FILES ./*.cpp)
-# 定义支持的语言列表
-set(LANGUAGES zh_CN) # 可以添加更多语言 # set(LANGUAGES zh_CN bo_CN ug_CN mn_MN ky_KG kk_KZ)
-
# 定义翻译源文件列表
set(QM_FILES "")
@@ -19,14 +16,18 @@ foreach(LANG ${LANGUAGES})
execute_process(COMMAND lupdate-qt5 -no-obsolete ${H_FILES} ${CPP_FILES} -ts
${TS_FILE})
- # 生成 qm 文件
- qt5_add_translation(QM_FILE ${TS_FILE})
+ # https://bugreports.qt.io/browse/QTBUG-64317 5.9.4以下生成的qm文件不带${LANG}后缀
+ # qt5_add_translation(QM_FILE ${TS_FILE})
+ set(QM_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.${LANG}.qm")
+ # 执行 lrelease 生成qm文件
+ execute_process(COMMAND lrelease ${TS_FILE} -qm ${QM_FILE})
list(APPEND QM_FILES ${QM_FILE})
+ message(STATUS "QM_FILE: ${QM_FILE}")
endforeach()
qt5_add_dbus_adaptor(
AUTH_DEVICE_MANAGER_ADAPTOR_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.xml
${CMAKE_SOURCE_DIR}/src/device-manager/manager.h
Kiran::Manager
auth_device_manager_adaptor
@@ -34,7 +35,7 @@ qt5_add_dbus_adaptor(
qt5_add_dbus_adaptor(
AUTH_DEVICE_ADAPTOR_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.AuthDevice.Device.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.AuthDevice.Device.xml
${CMAKE_SOURCE_DIR}/src/device-manager/device/device.h
Kiran::Device
auth_device_adaptor
diff --git a/src/device-manager/device/device.cpp b/src/device-manager/device/device.cpp
index 020f25b212808b6e04bd08c719f425d21f36532d..7bd6c5c27aab1c9f75351ccfe73d3ad5bb011062 100644
--- a/src/device-manager/device/device.cpp
+++ b/src/device-manager/device/device.cpp
@@ -27,8 +27,11 @@ Device::Device(DriverPtr driver, QObject* parent) : QObject(parent),
m_driver(driver)
{
QUuid uuid = QUuid::createUuid();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
m_devId = uuid.toString(QUuid::Id128);
-
+#else
+ m_devId = uuid.toString();
+#endif
m_dbusAdaptor = QSharedPointer(new AuthDeviceAdaptor(this));
m_status = DEVICE_STATUS_IDLE;
diff --git a/src/device-manager/device/ukey-device.cpp b/src/device-manager/device/ukey-device.cpp
index 7543bf8a0cb238a0e553d78f9fa913a708bcbe19..636d49b1c65cd3eb2cbefdcff623f78818fee96c 100644
--- a/src/device-manager/device/ukey-device.cpp
+++ b/src/device-manager/device/ukey-device.cpp
@@ -101,14 +101,15 @@ void UkeyDevice::EnrollStart(const QString& extraInfo)
{
// 特征存储
// NOTE: 这里没有传featureName、IID、userID
+ auto type = deviceType();
QString featureID = QCryptographicHash::hash(pubKey, QCryptographicHash::Md5).toHex();
- FeatureData data = {
- .feature = pubKey,
- .featureID = featureID,
- .idVendor = m_idVendor,
- .idProduct = m_idProduct,
- .deviceSerialNumber = serialNumber,
- .deviceType = deviceType()};
+ FeatureData data;
+ data.feature = pubKey;
+ data.featureID = featureID;
+ data.idVendor = m_idVendor;
+ data.idProduct = m_idProduct;
+ data.deviceSerialNumber = serialNumber;
+ data.deviceType = deviceType();
notifyEnrollProcess(ENROLL_PROCESS_SUCCESS, SAR_OK, data);
}
diff --git a/src/device-manager/driver-loader.cpp b/src/device-manager/driver-loader.cpp
index 25819390926f11b4a3b6d1dbc97b52280ce47022..2465a512d8fffff728b0d163db463d5d7a60761f 100644
--- a/src/device-manager/driver-loader.cpp
+++ b/src/device-manager/driver-loader.cpp
@@ -95,12 +95,12 @@ DriverPtr DriverLoader::loadDriver(const QString &driverName)
auto libPtr = new QLibrary(driverName);
if (!libPtr)
{
- return nullptr;
+ return DriverPtr();
}
if (!libPtr->load())
{
delete libPtr;
- return nullptr;
+ return DriverPtr();
}
auto createFunc = (CreateDriverFunc)libPtr->resolve("createDriver");
@@ -108,7 +108,7 @@ DriverPtr DriverLoader::loadDriver(const QString &driverName)
{
libPtr->unload();
delete libPtr;
- return nullptr;
+ return DriverPtr();
}
auto driver = DriverPtr(createFunc(), [libPtr](Driver *driver)
@@ -126,7 +126,7 @@ DriverPtr DriverLoader::loadDriver(const QString &driverName)
{
libPtr->unload();
delete libPtr;
- return nullptr;
+ return DriverPtr();
}
return driver;
diff --git a/src/pam/CMakeLists.txt b/src/pam/CMakeLists.txt
index d92d6b16bc7c1b480d7b6e49e79e788755b2941f..8329fb81550d0711b22cf80aaa398323ecc1a32b 100644
--- a/src/pam/CMakeLists.txt
+++ b/src/pam/CMakeLists.txt
@@ -2,39 +2,36 @@ file(GLOB_RECURSE H_FILES ./*.h)
file(GLOB_RECURSE CPP_FILES ./*.cpp)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.xml
PROPERTIES CLASSNAME AuthManagerProxy NO_NAMESPACE true)
qt5_add_dbus_interface(
AUTH_MANAGER_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.xml
auth_manager_proxy)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.Session.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.Session.xml
PROPERTIES CLASSNAME AuthSessionProxy NO_NAMESPACE true)
qt5_add_dbus_interface(
AUTH_SESSION_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.Session.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.Session.xml
auth_session_proxy)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.User.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.User.xml
PROPERTIES CLASSNAME AuthUserProxy NO_NAMESPACE true)
qt5_add_dbus_interface(
AUTH_USER_INTERFACE_SRCS
- ${CMAKE_SOURCE_DIR}/data/com.kylinsec.Kiran.Authentication.User.xml
+ ${CMAKE_SOURCE_DIR}/data/dbus/com.kylinsec.Kiran.Authentication.User.xml
auth_user_proxy)
set(TARGET_NAME pam_kiran_authentication)
configure_file(config-pam.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-pam.h)
-# 定义支持的语言列表
-set(LANGUAGES zh_CN) # 可以添加更多语言 # set(LANGUAGES zh_CN bo_CN ug_CN mn_MN ky_KG kk_KZ)
-
# 定义翻译源文件列表
set(QM_FILES "")
@@ -46,9 +43,13 @@ foreach(LANG ${LANGUAGES})
execute_process(COMMAND lupdate-qt5 -no-obsolete ${H_FILES} ${CPP_FILES}
${COMMON_CPP_FILES} -ts ${TS_FILE})
- # 生成 qm 文件
- qt5_add_translation(QM_FILE ${TS_FILE})
+ # https://bugreports.qt.io/browse/QTBUG-64317 5.9.4以下生成的qm文件不带${LANG}后缀
+ # qt5_add_translation(QM_FILE ${TS_FILE})
+ set(QM_FILE "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.${LANG}.qm")
+ # 执行 lrelease 生成qm文件
+ execute_process(COMMAND lrelease ${TS_FILE} -qm ${QM_FILE})
list(APPEND QM_FILES ${QM_FILE})
+ message(STATUS "QM_FILE: ${QM_FILE}")
endforeach()
add_library(
diff --git a/translations/kiran-authentication-devices.zh_CN.ts b/translations/kiran-authentication-devices.zh_CN.ts
index e0456e95a1c831f96a64120f004dd0a2e55b162a..6897d12c76622bd129ddecbfb40cb907bda06c1d 100644
--- a/translations/kiran-authentication-devices.zh_CN.ts
+++ b/translations/kiran-authentication-devices.zh_CN.ts
@@ -5,59 +5,59 @@
Kiran::UkeyDevice
-
+
Device Busy
设备忙
-
+
The pin code cannot be empty!
pin码不能为空!
-
-
+
+
identify fail!
认证失败!
-
+
Binding user failed!
绑定用户失败!
-
+
Successed binding user
绑定用户成功
-
+
UKey has been bound
UKey已经被绑定
-
+
identify ukey success
ukey认证成功
-
+
pin incorrect
pin码不正确
-
+
pin locked
pin码被锁定
-
+
invalid pin
无效的pin码
-
+
invalid pin length
无效的pin码长度