From 6a4234339518e8be293aacee4aeef6aaa38d7e69 Mon Sep 17 00:00:00 2001
From: "beiling.xie" <xiekunxun@huawei.com>
Date: Wed, 14 Sep 2022 00:12:20 +0800
Subject: [PATCH] support deviceauth for openeuler

Signed-off-by: beiling.xie <xiekunxun@huawei.com>
---
 deps_adapter/BUILD.gn                                 |  3 ++-
 deps_adapter/os_adapter/interfaces/linux/hc_log.h     |  8 ++++----
 services/BUILD.gn                                     |  2 +-
 .../src/permission_adapter/permission_adapter.cpp     | 11 +++++++----
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/deps_adapter/BUILD.gn b/deps_adapter/BUILD.gn
index 28df2d9..906b8ca 100644
--- a/deps_adapter/BUILD.gn
+++ b/deps_adapter/BUILD.gn
@@ -118,10 +118,11 @@ if (defined(ohos_lite)) {
     cflags = [ "-DHILOG_ENABLE" ]
     deps = [
       "//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk",
-      "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara",
+      "//depend:syspara",
       "//third_party/cJSON:cjson_static",
       "//third_party/openssl:libcrypto_static",
       "//utils/native/base:utils",
+      "//third_party/bounds_checking_function:libsec_shared",
     ]
     external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
   }
diff --git a/deps_adapter/os_adapter/interfaces/linux/hc_log.h b/deps_adapter/os_adapter/interfaces/linux/hc_log.h
index 7cfd649..f881d1e 100644
--- a/deps_adapter/os_adapter/interfaces/linux/hc_log.h
+++ b/deps_adapter/os_adapter/interfaces/linux/hc_log.h
@@ -44,10 +44,10 @@ void DevAuthLogPrint(DevAuthLogLevel level, const char *funName, const char *fmt
 #define LOGW(fmt, ...) (DevAuthLogPrint(DEV_AUTH_LOG_LEVEL_WARN, __FUNCTION__, fmt, ##__VA_ARGS__))
 #define LOGE(fmt, ...) (DevAuthLogPrint(DEV_AUTH_LOG_LEVEL_ERROR, __FUNCTION__, fmt, ##__VA_ARGS__))
 
-#define DEV_AUTH_LOG_DEBUG(buf) HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_INFO(buf) HiLogPrint(LOG_CORE, LOG_INFO, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_WARN(buf) HiLogPrint(LOG_CORE, LOG_WARN, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
-#define DEV_AUTH_LOG_ERROR(buf) HiLogPrint(LOG_CORE, LOG_ERROR, LOG_DOMAIN, "[DEVAUTH]", "%{public}s", buf)
+#define DEV_AUTH_LOG_DEBUG(buf) HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_INFO(buf) HiLogPrint(LOG_CORE, LOG_INFO, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_WARN(buf) HiLogPrint(LOG_CORE, LOG_WARN, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
+#define DEV_AUTH_LOG_ERROR(buf) HiLogPrint(LOG_CORE, LOG_ERROR, LOG_DOMAIN, "[DEVAUTH]", "%s", buf)
 
 #else
 
diff --git a/services/BUILD.gn b/services/BUILD.gn
index bb15b89..b2cdb17 100644
--- a/services/BUILD.gn
+++ b/services/BUILD.gn
@@ -159,10 +159,10 @@ if (defined(ohos_lite)) {
       "${deps_adapter_path}:${hal_module_name}",
       "//third_party/cJSON:cjson_static",
       "//utils/native/base:utils",
+      "//foundation/communication/dsoftbus/sdk:softbus_client"
     ]
 
     external_deps = [
-      "dsoftbus_standard:softbus_client",
       "hiviewdfx_hilog_native:libhilog",
     ]
     if (support_jsapi) {
diff --git a/services/frameworks/src/permission_adapter/permission_adapter.cpp b/services/frameworks/src/permission_adapter/permission_adapter.cpp
index dcdb912..6f4f8a3 100644
--- a/services/frameworks/src/permission_adapter/permission_adapter.cpp
+++ b/services/frameworks/src/permission_adapter/permission_adapter.cpp
@@ -15,17 +15,18 @@
 
 #include "permission_adapter.h"
 
-#include "accesstoken_kit.h"
+//#include "accesstoken_kit.h"
 #include "ipc_skeleton.h"
 
 #include "device_auth_defines.h"
 #include "hc_log.h"
 
-using namespace OHOS;
-using namespace OHOS::Security::AccessToken;
+//using namespace OHOS;
+//using namespace OHOS::Security::AccessToken;
 
 int32_t CheckPermission(void)
 {
+#if 0
     AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID();
     ATokenTypeEnum tokenType = AccessTokenKit::GetTokenType(tokenId);
     if (tokenType == TOKEN_NATIVE) {
@@ -45,4 +46,6 @@ int32_t CheckPermission(void)
         LOGE("Invalid token type: %d", tokenType);
         return HC_ERROR;
     }
-}
\ No newline at end of file
+#endif
+    return HC_SUCCESS;
+}
-- 
2.25.1

