!1 First submission of source code

Merge pull request !1 from kylinsecos/master
This commit is contained in:
openeuler-ci-bot 2022-01-26 09:07:44 +00:00 committed by Gitee
commit aa1d9fa1be
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,100 @@
From de85f51ca1127a06ed200fe6c7670ebb73a3587f Mon Sep 17 00:00:00 2001
From: wangxiaoqing <wangxiaoqing@kylinos.com.cn>
Date: Tue, 25 Jan 2022 16:46:27 +0800
Subject: [PATCH] fix(kiran-authentication-service): Add the enable zlog ex
macro for zlog
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 添加ENABLE_ZLOG_EX宏来兼容不同版本的zlog
Signed-off-by: wangxiaoqing <wangxiaoqing@kylinos.com.cn>
---
src/CMakeLists.txt | 13 ++++++++++++-
src/kiran-auth-service.c | 4 ++++
src/main.c | 16 ++++++++++++----
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bfee007..b9bb3dc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,10 +4,21 @@ find_package (OpenSSL REQUIRED)
pkg_check_modules (GLIB2 REQUIRED glib-2.0)
pkg_check_modules (GIO REQUIRED gio-2.0)
pkg_check_modules (GIO_UNIX REQUIRED gio-unix-2.0)
-pkg_check_modules (ZLOG REQUIRED zlog)
pkg_check_modules (GLIB_JSON REQUIRED json-glib-1.0)
pkg_check_modules (KIRAN_CC_DAEMON REQUIRED kiran-cc-daemon)
+if (ENABLE_ZLOG_EX)
+ pkg_search_module(ZLOG REQUIRED zlog)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_ZLOG_EX")
+else()
+ find_library(ZLOG_LIBRARY zlog)
+ set (ZLOG_INCLUDE_DIRS "")
+ set (ZLOG_LIBRARIES "${ZLOG_LIBRARY}")
+endif()
+
+message("found zlog dirs: ${ZLOG_INCLUDE_DIRS}")
+message("found zlog libs: ${ZLOG_LIBRARIES}")
+
find_library(PAM_LIBRARY pam)
find_program(GDBUS_CODEGEN "gdbus-codegen")
diff --git a/src/kiran-auth-service.c b/src/kiran-auth-service.c
index a41c89a..3a4408d 100644
--- a/src/kiran-auth-service.c
+++ b/src/kiran-auth-service.c
@@ -22,7 +22,11 @@
#include <json-glib/json-glib.h>
#include <kiran-cc-daemon/kiran-system-daemon/accounts-i.h>
#include <security/pam_appl.h>
+#ifdef ENABLE_ZLOG_EX
#include <zlog_ex.h>
+#else
+#include <zlog.h>
+#endif
#include "authentication_i.h"
#include "kiran-accounts-gen.h"
#include "kiran-biometrics-gen.h"
diff --git a/src/main.c b/src/main.c
index d35501e..d64b571 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,11 @@
#include <glib.h>
#include <locale.h>
+#ifdef ENABLE_ZLOG_EX
#include <zlog_ex.h>
+#else
+#include <zlog.h>
+#endif
#include "kiran-auth-service.h"
int main(int argc, char *argv[])
@@ -25,11 +29,15 @@ int main(int argc, char *argv[])
setlocale(LC_CTYPE, "");
setlocale(LC_MESSAGES, "");
- if (dzlog_init_ex(NULL,
- "kylinsec-system-app",
- "kiran-authentication",
- "kiran_authentication_manager") < 0)
+#ifdef ENABLE_ZLOG_EX
+ if (dzlog_init_ex (NULL, "kylinsec-system", "kiran-biometrics", "kiran_biometrics_manager") < 0)
+#else
+ if (dzlog_init("/etc/zlog.conf", "kylinsec-system") < 0)
+#endif
+ {
+ g_error ("zlog init failed!");
return -1;
+ }
#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
--
2.27.0

Binary file not shown.

View File

@ -0,0 +1,86 @@
%global on_openeuler 1
Name: kiran-authentication-service
Version: 0.0.1
Release: 2.kb3
Summary: Kiran Desktop kiran authentication service
License: Mulan PSL v2
URL: http://www.kylinsec.com.cn
Source0: %{name}-%{version}.tar.gz
Patch1: 0001-fix-kiran-authentication-service-Add-the-enable-zlog-de85f51c.patch
BuildRequires: glib2-devel
%if 0%{?on_openeuler}
BuildRequires: zlog
%else
BuildRequires: zlog-devel
%endif
BuildRequires: cmake
BuildRequires: make
BuildRequires: pam-devel
BuildRequires: kiran-cc-daemon-devel
BuildRequires: openssl-devel
BuildRequires: json-glib-devel
BuildRequires: gcc
BuildRequires: gcc-c++
%description
Kiran authentication service is used to do system auth with password, fingerprint, face
%package devel
Summary: Development files for kiran authentication service
Requires: %{name} = %{version}-%{release}
%description devel
Development files for kiran authentication service
%prep
%autosetup -p1
%build
%cmake
make %{?_smp_mflags} V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT
%files
%{_libexecdir}/kiran_authentication_service
%{_sysconfdir}/dbus-1/system.d/kiran_authentication.conf
%{_sysconfdir}/kiran-authentication-service/custom.conf
%{_sysconfdir}/pam.d/kiran-auth-service
%{_datadir}/dbus-1/system-services/com.kylinsec.Kiran.SystemDaemon.Authentication.service
%{_prefix}/lib/systemd/system/kiran-system-daemon-authentication.service
%{_libdir}/libkiran-authentication-service.so.0.0.1
%{_libdir}/libkiran-authentication-service.so.0.1
%{_libdir}/security/pam_kiran_authentication.so
%files devel
%{_includedir}/kiran-authentication-service/authentication_i.h
%{_libdir}/pkgconfig/kiran-authentication-service.pc
%{_libdir}/libkiran-authentication-service.so
%changelog
* Tue Jan 25 2022 wxq <wangxiaoqing@kylinos.com.cn> - 0.0.1-2.kb3
- KYOS-B: Add the enable zlog ex macro for zlog.
* Mon Jan 24 2022 wxq <wangxiaoqing@kylinos.com.cn> - 0.0.1-2.kb2
- KYOS-F: Add the requires for develop package.
* Wed Dec 29 2021 kpkg <kpkg@kylinos.com.cn> - 0.0.1-2.kb1
- rebuild for KY3.4-MATE-modules-dev
* Wed Dec 29 2021 caoyuanji<caoyuanji@kylinos.com.cn> - 0.0.1-2
- Upgrade version number for easy upgrade
* Fri Dec 24 2021 caoyuanji <caoyuanji@kylinos.com.cn> - 0.0.1-1.kb6
- rebuild for KY3.4-4-KiranUI-2.2
* Thu Dec 23 2021 wxq <wangxiaoqing@kylinos.com.cn> - 0.0.1.kb5
- KYOS-B: Add the requires for develop package.
* Tue Aug 24 2021 wxq <wangxiaoqing@kylinos.com.cn> - 0.0.1
- KYOS-F: build 0.0.1 version. (#38334)