communication_ipc/0004-adapt-compilation-for-softbus_client.patch

1294 lines
52 KiB
Diff

From 15e2ccf02e15fd6e9ea0e8f86b013ff49b8533e5 Mon Sep 17 00:00:00 2001
From: heppen <hepeng68@huawei.com>
Date: Tue, 26 Sep 2023 17:22:20 +0800
Subject: [PATCH] adapt compilation for softbus_client
---
adapter/BUILD.gn | 2 +-
.../common/bus_center/bus_center_adapter.gni | 4 +-
.../common/dfx/softbus_adapter_hisysevent.cpp | 263 +++++++++---------
.../kernel/posix/softbus_adapter_thread.c | 3 +-
.../feature_config/standard/config.gni | 2 +-
bundle.json | 3 -
.../src/fillp_lib/src/fillp/fillp_input.c | 26 +-
.../bus_center/src/bus_center_adapter.c | 2 +-
core/authentication/authentication.gni | 1 +
core/authentication/include/auth_config.h | 35 +++
core/authentication/include/auth_hichain.h | 2 +
core/authentication/src/auth_config.c | 65 +++++
core/authentication/src/auth_hichain.c | 13 +-
core/authentication/src/auth_manager.c | 2 +-
core/authentication/src/auth_session_fsm.c | 12 +
core/authentication/src/auth_session_key.c | 2 +-
.../lane_manager/src/lnn_lane_link_proc.c | 2 +-
.../lane_manager/src/lnn_select_rule.c | 2 +-
.../net_buscenter/src/lnn_network_manager.c | 2 +-
core/common/include/softbus_def.h | 4 +-
core/common/message_handler/message_handler.c | 8 -
.../standard/softbus_permission.cpp | 151 +++++-----
.../softbus_property/softbus_feature_config.c | 6 +-
.../common/src/softbus_thread_pool.c | 3 +-
core/frame/BUILD.gn | 6 +-
.../src/permission_status_change_cb.cpp | 18 +-
.../src/softbus_client_info_manager.cpp | 9 +-
.../standard/init/src/softbus_server_stub.cpp | 137 ++++-----
.../tcp_direct/src/trans_tcp_direct_manager.c | 2 +-
.../tcp_direct/src/trans_tcp_direct_wifi.c | 2 +-
30 files changed, 458 insertions(+), 331 deletions(-)
create mode 100644 core/authentication/include/auth_config.h
create mode 100644 core/authentication/src/auth_config.c
diff --git a/adapter/BUILD.gn b/adapter/BUILD.gn
index 20f4e60..2b7fa0f 100644
--- a/adapter/BUILD.gn
+++ b/adapter/BUILD.gn
@@ -206,7 +206,7 @@ if (defined(ohos_lite)) {
public_configs = [ ":config_adapter_common" ]
if (is_standard_system) {
external_deps = [
- "hisysevent_native:libhisysevent",
+ # "hisysevent_native:libhisysevent",
"hiviewdfx_hilog_native:libhilog",
]
}
diff --git a/adapter/common/bus_center/bus_center_adapter.gni b/adapter/common/bus_center/bus_center_adapter.gni
index ebd12a0..6c8887d 100644
--- a/adapter/common/bus_center/bus_center_adapter.gni
+++ b/adapter/common/bus_center/bus_center_adapter.gni
@@ -87,8 +87,8 @@ if (defined(ohos_lite)) {
if (has_ces_part) {
bus_center_adapter_src +=
[ "$adapter_bus_center_path/common_event/lnn_common_event_monitor.cpp" ]
- bus_center_adapter_external_deps +=
- [ "common_event_service:cesfwk_innerkits" ]
+ # bus_center_adapter_external_deps +=
+ # [ "common_event_service:cesfwk_innerkits" ]
} else {
bus_center_adapter_src += [ "$adapter_bus_center_path/common_event/lnn_common_event_monitor_virtual.cpp" ]
}
diff --git a/adapter/common/dfx/softbus_adapter_hisysevent.cpp b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
index 1c6d363..d044903 100644
--- a/adapter/common/dfx/softbus_adapter_hisysevent.cpp
+++ b/adapter/common/dfx/softbus_adapter_hisysevent.cpp
@@ -23,127 +23,127 @@
#include "softbus_adapter_mem.h"
#include "softbus_adapter_thread.h"
#include "message_handler.h"
-#include "hisysevent_c.h"
+// #include "hisysevent_c.h"
-static const char *g_domain = "DSOFTBUS";
-static bool g_init_lock = false;
-static SoftBusMutex g_dfx_lock;
-static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
+// static const char *g_domain = "DSOFTBUS";
+// static bool g_init_lock = false;
+// static SoftBusMutex g_dfx_lock;
+// static HiSysEventParam g_dstParam[SOFTBUS_EVT_PARAM_BUTT];
-static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
-{
- switch (srcParam->paramType) {
- case SOFTBUS_EVT_PARAMTYPE_BOOL:
- dstParam->t = HISYSEVENT_BOOL;
- dstParam->v.b = srcParam->paramValue.b;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT8:
- dstParam->t = HISYSEVENT_UINT8;
- dstParam->v.ui8 = srcParam->paramValue.u8v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT16:
- dstParam->t = HISYSEVENT_UINT16;
- dstParam->v.ui16 = srcParam->paramValue.u16v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_INT32:
- dstParam->t = HISYSEVENT_INT32;
- dstParam->v.i32 = srcParam->paramValue.i32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT32:
- dstParam->t = HISYSEVENT_UINT32;
- dstParam->v.ui32 = srcParam->paramValue.u32v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_UINT64:
- dstParam->t = HISYSEVENT_UINT64;
- dstParam->v.ui64 = srcParam->paramValue.u64v;
- break;
- case SOFTBUS_EVT_PARAMTYPE_FLOAT:
- dstParam->t = HISYSEVENT_FLOAT;
- dstParam->v.f = srcParam->paramValue.f;
- break;
- case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
- dstParam->t = HISYSEVENT_DOUBLE;
- dstParam->v.d = srcParam->paramValue.d;
- break;
- case SOFTBUS_EVT_PARAMTYPE_STRING:
- dstParam->t = HISYSEVENT_STRING;
- dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
- if (dstParam->v.s == NULL) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
- return SOFTBUS_ERR;
- }
- if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
- SoftBusFree(dstParam->v.s);
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
- return SOFTBUS_ERR;
- }
- break;
- default:
- break;
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertEventParam(SoftBusEvtParam *srcParam, HiSysEventParam *dstParam)
+// {
+ // switch (srcParam->paramType) {
+ // case SOFTBUS_EVT_PARAMTYPE_BOOL:
+ // dstParam->t = HISYSEVENT_BOOL;
+ // dstParam->v.b = srcParam->paramValue.b;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT8:
+ // dstParam->t = HISYSEVENT_UINT8;
+ // dstParam->v.ui8 = srcParam->paramValue.u8v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT16:
+ // dstParam->t = HISYSEVENT_UINT16;
+ // dstParam->v.ui16 = srcParam->paramValue.u16v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_INT32:
+ // dstParam->t = HISYSEVENT_INT32;
+ // dstParam->v.i32 = srcParam->paramValue.i32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT32:
+ // dstParam->t = HISYSEVENT_UINT32;
+ // dstParam->v.ui32 = srcParam->paramValue.u32v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_UINT64:
+ // dstParam->t = HISYSEVENT_UINT64;
+ // dstParam->v.ui64 = srcParam->paramValue.u64v;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_FLOAT:
+ // dstParam->t = HISYSEVENT_FLOAT;
+ // dstParam->v.f = srcParam->paramValue.f;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_DOUBLE:
+ // dstParam->t = HISYSEVENT_DOUBLE;
+ // dstParam->v.d = srcParam->paramValue.d;
+ // break;
+ // case SOFTBUS_EVT_PARAMTYPE_STRING:
+ // dstParam->t = HISYSEVENT_STRING;
+ // dstParam->v.s = (char *)SoftBusCalloc(sizeof(char) * SOFTBUS_HISYSEVT_PARAM_LEN);
+ // if (dstParam->v.s == NULL) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam: SoftBusMalloc fail");
+ // return SOFTBUS_ERR;
+ // }
+ // if (strcpy_s(dstParam->v.s, SOFTBUS_HISYSEVT_PARAM_LEN, srcParam->paramValue.str) != EOK) {
+ // SoftBusFree(dstParam->v.s);
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertEventParam:copy string var fail");
+ // return SOFTBUS_ERR;
+ // }
+ // break;
+ // default:
+ // break;
+ // }
+// return SOFTBUS_OK;
+// }
-static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
-{
- if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
- sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
- return SOFTBUS_ERR;
- }
- for (uint32_t i = 0; i < msg->paramNum; i++) {
- if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
- return SOFTBUS_ERR;
- }
- if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
- return SOFTBUS_ERR;
- }
- }
- return SOFTBUS_OK;
-}
+// static int32_t ConvertMsgToHiSysEvent(SoftBusEvtReportMsg *msg)
+// {
+// if (memset_s(g_dstParam, sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT, 0,
+// sizeof(HiSysEventParam) * SOFTBUS_EVT_PARAM_BUTT) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init g_dstParam fail");
+// return SOFTBUS_ERR;
+// }
+// for (uint32_t i = 0; i < msg->paramNum; i++) {
+// if (strcpy_s(g_dstParam[i].name, SOFTBUS_HISYSEVT_NAME_LEN, msg->paramArray[i].paramName) != EOK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "copy param fail");
+// return SOFTBUS_ERR;
+// }
+// if (ConvertEventParam(&msg->paramArray[i], &g_dstParam[i]) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "ConvertMsgToHiSysEvent:convert param fail");
+// return SOFTBUS_ERR;
+// }
+// }
+// return SOFTBUS_OK;
+// }
-static void HiSysEventParamDeInit(uint32_t size)
-{
- for (uint32_t i = 0; i < size; i++) {
- if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
- SoftBusFree(g_dstParam[i].v.s);
- g_dstParam[i].v.s = NULL;
- }
- }
- }
+// static void HiSysEventParamDeInit(uint32_t size)
+// {
+// for (uint32_t i = 0; i < size; i++) {
+// if (g_dstParam[i].t == HISYSEVENT_STRING && g_dstParam[i].v.s != NULL) {
+// SoftBusFree(g_dstParam[i].v.s);
+// g_dstParam[i].v.s = NULL;
+// }
+// }
+// }
-static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
-{
- HiSysEventEventType hiSysEvtType;
- switch (type) {
- case SOFTBUS_EVT_TYPE_FAULT:
- hiSysEvtType = HISYSEVENT_FAULT;
- break;
- case SOFTBUS_EVT_TYPE_STATISTIC:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- case SOFTBUS_EVT_TYPE_SECURITY:
- hiSysEvtType = HISYSEVENT_SECURITY;
- break;
- case SOFTBUS_EVT_TYPE_BEHAVIOR:
- hiSysEvtType = HISYSEVENT_BEHAVIOR;
- break;
- default:
- hiSysEvtType = HISYSEVENT_STATISTIC;
- break;
- }
- return hiSysEvtType;
-}
+// static HiSysEventEventType ConvertMsgType(SoftBusEvtType type)
+// {
+// HiSysEventEventType hiSysEvtType;
+// switch (type) {
+// case SOFTBUS_EVT_TYPE_FAULT:
+// hiSysEvtType = HISYSEVENT_FAULT;
+// break;
+// case SOFTBUS_EVT_TYPE_STATISTIC:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// case SOFTBUS_EVT_TYPE_SECURITY:
+// hiSysEvtType = HISYSEVENT_SECURITY;
+// break;
+// case SOFTBUS_EVT_TYPE_BEHAVIOR:
+// hiSysEvtType = HISYSEVENT_BEHAVIOR;
+// break;
+// default:
+// hiSysEvtType = HISYSEVENT_STATISTIC;
+// break;
+// }
+// return hiSysEvtType;
+// }
-static void InitHisEvtMutexLock()
-{
- if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
- return;
- }
-}
+// static void InitHisEvtMutexLock()
+// {
+// if (SoftBusMutexInit(&g_dfx_lock, NULL) != SOFTBUS_OK) {
+// HILOG_ERROR(SOFTBUS_HILOG_ID, "init HisEvtMutexLock fail");
+// return;
+// }
+// }
#ifdef __cplusplus
#if __cplusplus
@@ -153,22 +153,23 @@ extern "C" {
int32_t SoftbusWriteHisEvt(SoftBusEvtReportMsg* reportMsg)
{
- if (reportMsg == nullptr) {
- return SOFTBUS_ERR;
- }
- if (!g_init_lock) {
- InitHisEvtMutexLock();
- g_init_lock = true;
- }
- if (SoftBusMutexLock(&g_dfx_lock) != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
- return SOFTBUS_LOCK_ERR;
- }
- ConvertMsgToHiSysEvent(reportMsg);
- OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
- g_dstParam, reportMsg->paramNum);
- HiSysEventParamDeInit(reportMsg->paramNum);
- (void)SoftBusMutexUnlock(&g_dfx_lock);
+ // if (reportMsg == nullptr) {
+ // return SOFTBUS_ERR;
+ // }
+ // if (!g_init_lock) {
+ // InitHisEvtMutexLock();
+ // g_init_lock = true;
+ // }
+ // if (SoftBusMutexLock(&g_dfx_lock) != 0) {
+ // HILOG_ERROR(SOFTBUS_HILOG_ID, "%s:lock failed", __func__);
+ // return SOFTBUS_LOCK_ERR;
+ // }
+ // ConvertMsgToHiSysEvent(reportMsg);
+ // OH_HiSysEvent_Write(g_domain, reportMsg->evtName, ConvertMsgType(reportMsg->evtType),
+ // g_dstParam, reportMsg->paramNum);
+ // HiSysEventParamDeInit(reportMsg->paramNum);
+ // (void)SoftBusMutexUnlock(&g_dfx_lock);
+ (void)reportMsg;
return SOFTBUS_OK;
}
diff --git a/adapter/common/kernel/posix/softbus_adapter_thread.c b/adapter/common/kernel/posix/softbus_adapter_thread.c
index f6c65e8..33eeaa9 100644
--- a/adapter/common/kernel/posix/softbus_adapter_thread.c
+++ b/adapter/common/kernel/posix/softbus_adapter_thread.c
@@ -273,7 +273,8 @@ static int32_t SoftBusConfTransPthreadAttr(SoftBusThreadAttr *threadAttr, pthrea
if (stackSize != 0) {
ret = pthread_attr_setstacksize(attr, stackSize);
if (ret != 0) {
- HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, ret[%{public}d]", ret);
+ HILOG_ERROR(SOFTBUS_HILOG_ID, "pthread_attr_setstacksize failed, stacksize[%{public}lu], ret[%{public}d]",
+ stackSize, ret);
return SOFTBUS_ERR;
}
}
diff --git a/adapter/default_config/feature_config/standard/config.gni b/adapter/default_config/feature_config/standard/config.gni
index 6602d7e..c9bb34f 100644
--- a/adapter/default_config/feature_config/standard/config.gni
+++ b/adapter/default_config/feature_config/standard/config.gni
@@ -23,7 +23,7 @@ declare_args() {
dsoftbus_feature_protocol_newip = false
dsoftbus_feature_trans_udp = true
- dsoftbus_feature_trans_udp_stream = false
+ dsoftbus_feature_trans_udp_stream = true
dsoftbus_feature_trans_udp_file = true
dsoftbus_feature_ip_auth = true
diff --git a/bundle.json b/bundle.json
index fafbe1a..9ff4f14 100644
--- a/bundle.json
+++ b/bundle.json
@@ -68,9 +68,6 @@
"//foundation/communication/dsoftbus/sdk:softbus_client"
],
"service_group":[
- "//foundation/communication/dsoftbus/core:softbus_server",
- "//foundation/communication/dsoftbus/core/frame/standard/sa_profile:softbus_sa_profile",
- "//foundation/communication/dsoftbus/tools:tool"
]
},
"inner_kits": [
diff --git a/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c b/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c
index 1290b8e..2c0d51f 100644
--- a/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c
+++ b/components/nstackx/fillp/src/fillp_lib/src/fillp/fillp_input.c
@@ -598,18 +598,18 @@ static FILLP_BOOL FillpCheckPackNumber(struct FillpPcb *pcb, struct FillpPktPack
return FILLP_FALSE;
}
- FILLP_LOGDBG("fillp_sock_id:%d loss:%u,rate:%u,seq:%u,pkt:%u,flag:%u,oppRate:%u,lostSeq:%u",
- FILLP_GET_SOCKET(pcb)->index, FILLP_NTOHS(pack->pktLoss),
- FILLP_NTOHL(pack->rate), pktHdr->seqNum, pktHdr->pktNum,
- FILLP_NTOHS(pack->flag), FILLP_NTOHL(pack->oppositeSetRate), lostSeqNum);
-
- FILLP_LOGDTL("fillp_sock_id:%d, unSendList:%u,unackList:%u,unrecvList:%u, itemWaitTokenLists:%u, "
- "total:%u,curMemSize:%u,maxACKSeq:%u,ackSeqNum:%u,curSeq:%u",
- FILLP_GET_SOCKET(pcb)->index, pcb->send.unSendList.size, pcb->send.unackList.count,
- pcb->send.unrecvList.nodeNum, pcb->send.itemWaitTokenLists.nodeNum,
- (FILLP_UINT32)(pcb->send.unSendList.size + pcb->send.redunList.nodeNum + pcb->send.unackList.count +
- pcb->send.unrecvList.nodeNum + pcb->send.itemWaitTokenLists.nodeNum),
- pcb->send.curItemCount, pcb->send.maxAckNumFromReceiver, pcb->send.ackSeqNum, pcb->send.seqNum);
+ // FILLP_LOGDBG("fillp_sock_id:%d loss:%u,rate:%u,seq:%u,pkt:%u,flag:%u,oppRate:%u,lostSeq:%u",
+ // FILLP_GET_SOCKET(pcb)->index, FILLP_NTOHS(pack->pktLoss),
+ // FILLP_NTOHL(pack->rate), pktHdr->seqNum, pktHdr->pktNum,
+ // FILLP_NTOHS(pack->flag), FILLP_NTOHL(pack->oppositeSetRate), lostSeqNum);
+
+ // FILLP_LOGDTL("fillp_sock_id:%d, unSendList:%u,unackList:%u,unrecvList:%u, itemWaitTokenLists:%u, "
+ // "total:%u,curMemSize:%u,maxACKSeq:%u,ackSeqNum:%u,curSeq:%u",
+ // FILLP_GET_SOCKET(pcb)->index, pcb->send.unSendList.size, pcb->send.unackList.count,
+ // pcb->send.unrecvList.nodeNum, pcb->send.itemWaitTokenLists.nodeNum,
+ // (FILLP_UINT32)(pcb->send.unSendList.size + pcb->send.redunList.nodeNum + pcb->send.unackList.count +
+ // pcb->send.unrecvList.nodeNum + pcb->send.itemWaitTokenLists.nodeNum),
+ // pcb->send.curItemCount, pcb->send.maxAckNumFromReceiver, pcb->send.ackSeqNum, pcb->send.seqNum);
return FILLP_TRUE;
}
@@ -808,7 +808,7 @@ static void FillpPackInput(struct FillpPcb *pcb, FILLP_CONST struct NetBuf *p)
MoveUnackToUnrecvByPackInfo(pcb, ackSeqNum, lostSeqNum);
pcb->statistics.debugPcb.packRcv++;
- FillpPackInputLog(pcb);
+ // FillpPackInputLog(pcb);
FillpFcPackInput(pcb, pack);
return;
}
diff --git a/core/adapter/bus_center/src/bus_center_adapter.c b/core/adapter/bus_center/src/bus_center_adapter.c
index 5cc0d50..1c96007 100644
--- a/core/adapter/bus_center/src/bus_center_adapter.c
+++ b/core/adapter/bus_center/src/bus_center_adapter.c
@@ -27,7 +27,7 @@
#include "softbus_errcode.h"
#include "softbus_log.h"
-#define DEFAULT_DEVICE_NAME "OpenHarmony"
+#define DEFAULT_DEVICE_NAME "openEuler"
int32_t GetCommonDevInfo(const CommonDeviceKey key, char *value, uint32_t len)
{
diff --git a/core/authentication/authentication.gni b/core/authentication/authentication.gni
index e835c44..9cffc27 100644
--- a/core/authentication/authentication.gni
+++ b/core/authentication/authentication.gni
@@ -33,6 +33,7 @@ if (dsoftbus_feature_lnn_net) {
"$authentication_path/src/auth_connection.c",
"$authentication_path/src/auth_hichain.c",
"$authentication_path/src/auth_manager.c",
+ "$authentication_path/src/auth_config.c",
"$authentication_path/src/auth_request.c",
"$authentication_path/src/auth_session_fsm.c",
"$authentication_path/src/auth_session_key.c",
diff --git a/core/authentication/include/auth_config.h b/core/authentication/include/auth_config.h
new file mode 100644
index 0000000..498b242
--- /dev/null
+++ b/core/authentication/include/auth_config.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * 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 AUTH_CONFIG_H
+#define AUTH_CONFIG_H
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif
+#endif
+
+int32_t AuthConfigInit();
+
+int32_t AuthConfigDeInit();
+
+bool GetHichainEnable();
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+#endif /* AUTH_CONFIG_H */
diff --git a/core/authentication/include/auth_hichain.h b/core/authentication/include/auth_hichain.h
index 8125411..dbbff1e 100644
--- a/core/authentication/include/auth_hichain.h
+++ b/core/authentication/include/auth_hichain.h
@@ -37,6 +37,8 @@ int32_t HichainProcessData(int64_t authSeq, const uint8_t *data, uint32_t len);
void HichainDestroy(void);
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData);
+
#ifdef __cplusplus
#if __cplusplus
}
diff --git a/core/authentication/src/auth_config.c b/core/authentication/src/auth_config.c
new file mode 100644
index 0000000..1c1fb5d
--- /dev/null
+++ b/core/authentication/src/auth_config.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * 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 "auth_common.h"
+#include "cJSON.h"
+#include "softbus_adapter_file.h"
+
+#define TEST_JSON "{\"hichain\":0}"
+
+const char *g_FileName = "/system/bin/auth_config.txt";
+#define MAX_READ_LEN (1024)
+
+typedef struct {
+ int32_t hichainEnable;
+} AuthConfig;
+
+static AuthConfig g_authConfig;
+
+int32_t AuthConfigInit()
+{
+ g_authConfig.hichainEnable = 0;
+
+ char readbuf[MAX_READ_LEN + 1] = {"\0"};
+ int32_t maxLen = MAX_READ_LEN;
+ int32_t ret = SoftBusReadFullFile(g_FileName, readbuf, maxLen);
+ if (ret != SOFTBUS_OK) {
+ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "SoftBusReadFullFile fail.");
+ return ret;
+ }
+ cJSON *data = cJSON_Parse((char *)readbuf);
+ if (data == NULL) {
+ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "cJSON_Parse fail.");
+ return SOFTBUS_ERR;
+ }
+ if (!GetJsonObjectInt32Item(data, "hichain", &g_authConfig.hichainEnable)) {
+ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "GetJsonObjectInt32Item fail.");
+ cJSON_Delete(data);
+ return SOFTBUS_ERR;
+ }
+
+ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "hichain: %d", g_authConfig.hichainEnable);
+ cJSON_Delete(data);
+ return SOFTBUS_OK;
+}
+
+int32_t AuthConfigDeInit()
+{
+ return SOFTBUS_OK;
+}
+
+bool GetHichainEnable() {
+ return (g_authConfig.hichainEnable != 0);
+}
diff --git a/core/authentication/src/auth_hichain.c b/core/authentication/src/auth_hichain.c
index f7b362e..e371d25 100644
--- a/core/authentication/src/auth_hichain.c
+++ b/core/authentication/src/auth_hichain.c
@@ -18,6 +18,7 @@
#include <securec.h>
#include "auth_common.h"
+#include "auth_config.h"
#include "auth_session_fsm.h"
#include "device_auth.h"
#include "device_auth_defines.h"
@@ -90,7 +91,7 @@ static void OnSessionKeyReturned(int64_t authSeq, const uint8_t *sessionKey, uin
(void)AuthSessionSaveSessionKey(authSeq, sessionKey, sessionKeyLen);
}
-static void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
+void OnFinish(int64_t authSeq, int operationCode, const char *returnData)
{
(void)operationCode;
(void)returnData;
@@ -227,6 +228,7 @@ static const GroupAuthManager *InitHichain(void)
DestroyDeviceAuthService();
return NULL;
}
+ (void)AuthConfigInit();
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_INFO, "hichain init succ.");
return gaIns;
}
@@ -297,6 +299,15 @@ int32_t HichainStartAuth(int64_t authSeq, const char *udid, const char *uid)
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "hichain not initialized.");
return SOFTBUS_ERR;
}
+
+ // bypass auth
+ if (!GetHichainEnable()) {
+ uint8_t tempKey[32] = {0};
+ memset(tempKey, 1, 32);
+ g_hichainCallback.onSessionKeyReturned(authSeq, tempKey, 32);
+ return SOFTBUS_OK;
+ }
+
char *authParams = GenDeviceLevelParam(udid, uid, true);
if (authParams == NULL) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "generate auth param fail.");
diff --git a/core/authentication/src/auth_manager.c b/core/authentication/src/auth_manager.c
index e7b1ded..1066bec 100644
--- a/core/authentication/src/auth_manager.c
+++ b/core/authentication/src/auth_manager.c
@@ -1242,7 +1242,7 @@ int32_t AuthDeviceDecrypt(int64_t authId, const uint8_t *inData, uint32_t inLen,
return SOFTBUS_AUTH_NOT_FOUND;
}
if (DecryptData(&auth->sessionKeyList, inData, inLen, outData, outLen) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth decrypt fail.");
+ SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "auth[%ld] decrypt fail.", authId);
DelAuthManager(auth, false);
return SOFTBUS_ENCRYPT_ERR;
}
diff --git a/core/authentication/src/auth_session_fsm.c b/core/authentication/src/auth_session_fsm.c
index eaf6844..cce230e 100644
--- a/core/authentication/src/auth_session_fsm.c
+++ b/core/authentication/src/auth_session_fsm.c
@@ -264,6 +264,13 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_AUTH_SYNC_DEVID_FAIL;
break;
}
+ // bypass auth
+ if (!GetHichainEnable()) {
+ if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
+ ret = SOFTBUS_AUTH_HICHAIN_AUTH_FAIL;
+ break;
+ }
+ }
} else {
/* just client need start authDevice. */
if (HichainStartAuth(authFsm->authSeq, info->udid, info->connInfo.peerUid) != SOFTBUS_OK) {
@@ -275,6 +282,11 @@ static void HandleMsgRecvDeviceId(AuthFsm *authFsm, MessagePara *para)
ret = SOFTBUS_OK;
} while (false);
+ // bypass auth
+ if (!GetHichainEnable()) {
+ OnFinish(authFsm->authSeq, 0, NULL);
+ }
+
if (ret != SOFTBUS_OK) {
SoftBusLog(SOFTBUS_LOG_AUTH, SOFTBUS_LOG_ERROR, "handle devId msg fail, ret=%d", ret);
CompleteAuthSession(authFsm, ret);
diff --git a/core/authentication/src/auth_session_key.c b/core/authentication/src/auth_session_key.c
index 3856cbd..0e5dfcc 100644
--- a/core/authentication/src/auth_session_key.c
+++ b/core/authentication/src/auth_session_key.c
@@ -25,7 +25,7 @@
#include "softbus_errcode.h"
#include "softbus_log.h"
-#define SESSION_KEY_MAX_NUM 10
+#define SESSION_KEY_MAX_NUM 50
#define LAST_USE_THRESHOLD_MS (30 * 1000L) /* 30s */
typedef struct {
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
index c966df3..b37b90a 100755
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_lane_link_proc.c
@@ -34,7 +34,7 @@
#include "softbus_network_utils.h"
#include "softbus_protocol_def.h"
#include "softbus_utils.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
typedef int32_t (*LaneLinkByType)(uint32_t reqId, const LinkRequest *reqInfo, const LaneLinkCb *callback);
diff --git a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
index 79712a6..ec66978 100644
--- a/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
+++ b/core/bus_center/lnn/lane_hub/lane_manager/src/lnn_select_rule.c
@@ -30,7 +30,7 @@
#include "softbus_network_utils.h"
#include "softbus_utils.h"
#include "softbus_wifi_api_adapter.h"
-#include "wifi_device.h"
+// #include "wifi_device.h"
#define LNN_LINK_DEFAULT_SCORE 60 /* Indicates that scoring is not supported */
diff --git a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c
index 91856d8..36ea248 100644
--- a/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c
+++ b/core/bus_center/lnn/net_buscenter/src/lnn_network_manager.c
@@ -34,7 +34,7 @@
#define LNN_DELIMITER_INSIDE ":"
#define LNN_DEFAULT_IF_NAME_WLAN "wlan0"
-#define LNN_DEFAULT_IF_NAME_ETH "eth0"
+#define LNN_DEFAULT_IF_NAME_ETH "enp7s0"
#define LNN_DEFAULT_IF_NAME_BR "br0"
#define LNN_DEFAULT_IF_NAME_BLE "ble0"
diff --git a/core/common/include/softbus_def.h b/core/common/include/softbus_def.h
index 2edb7f5..a34aa50 100644
--- a/core/common/include/softbus_def.h
+++ b/core/common/include/softbus_def.h
@@ -53,8 +53,8 @@ extern "C" {
#define MAX_SOCKET_ADDR_LEN 46
-#define MAX_SESSION_ID 16
-#define MAX_SESSION_SERVER_NUMBER 10
+#define MAX_SESSION_ID 80
+#define MAX_SESSION_SERVER_NUMBER 50
#define WAIT_SERVER_READY_INTERVAL 200
diff --git a/core/common/message_handler/message_handler.c b/core/common/message_handler/message_handler.c
index d83ca3e..12a2be1 100644
--- a/core/common/message_handler/message_handler.c
+++ b/core/common/message_handler/message_handler.c
@@ -196,15 +196,7 @@ static void *LoopTask(void *arg)
static int StartNewLooperThread(SoftBusLooper *looper)
{
-#ifdef __aarch64__
#define MAINLOOP_STACK_SIZE (2 * 1024 * 1024)
-#else
-#ifdef ASAN_BUILD
-#define MAINLOOP_STACK_SIZE 10240
-#else
-#define MAINLOOP_STACK_SIZE 8192
-#endif
-#endif
int ret;
SoftBusThreadAttr threadAttr;
SoftBusThread tid;
diff --git a/core/common/security/permission/standard/softbus_permission.cpp b/core/common/security/permission/standard/softbus_permission.cpp
index e2b3ac7..5016dec 100644
--- a/core/common/security/permission/standard/softbus_permission.cpp
+++ b/core/common/security/permission/standard/softbus_permission.cpp
@@ -17,8 +17,9 @@
#include <sys/types.h>
#include <unistd.h>
+#include <string.h>
-#include "accesstoken_kit.h"
+// #include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "permission_entry.h"
#include "softbus_adapter_mem.h"
@@ -32,95 +33,100 @@
#endif
namespace {
- using namespace OHOS::Security;
+ // using namespace OHOS::Security;
const std::string PERMISSION_JSON_FILE = PERMISSION_JSON_FILE_PATH;
const std::string DANGER_APP_PERMISSION = "ohos.permission.DISTRIBUTED_DATASYNC";
- const int32_t SYSTEM_UID = 1000;
- const int32_t MULTE_USER_RADIX = 100000;
- const std::string SAMGR_PROCESS_NAME = "samgr";
+ // const int32_t SYSTEM_UID = 1000;
+ // const int32_t MULTE_USER_RADIX = 100000;
+ // const std::string SAMGR_PROCESS_NAME = "samgr";
}
int32_t TransPermissionInit(void)
{
- int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
- if (ret != SOFTBUS_OK) {
- return ret;
- }
- return InitDynamicPermission();
+ // int32_t ret = LoadPermissionJson(PERMISSION_JSON_FILE.c_str());
+ // if (ret != SOFTBUS_OK) {
+ // return ret;
+ // }
+ // return InitDynamicPermission();
+ return SOFTBUS_OK;
}
void TransPermissionDeinit(void)
{
- DeinitPermissionJson();
+ // DeinitPermissionJson();
}
int32_t CheckTransPermission(pid_t callingUid, pid_t callingPid,
const char *pkgName, const char *sessionName, uint32_t actions)
{
- if (sessionName == nullptr || pkgName == nullptr) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
- if (pItem == nullptr) {
- return SOFTBUS_MALLOC_ERR;
- }
- int32_t ret = CheckPermissionEntry(sessionName, pItem);
- SoftBusFree(pItem);
- if (ret >= SYSTEM_APP) {
- return SOFTBUS_OK;
- }
- return SOFTBUS_PERMISSION_DENIED;
+ // if (sessionName == nullptr || pkgName == nullptr) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // SoftBusPermissionItem *pItem = CreatePermissionItem(NATIVE_APP, callingUid, callingPid, pkgName, actions);
+ // if (pItem == nullptr) {
+ // return SOFTBUS_MALLOC_ERR;
+ // }
+ // int32_t ret = CheckPermissionEntry(sessionName, pItem);
+ // SoftBusFree(pItem);
+ // if (ret >= SYSTEM_APP) {
+ // return SOFTBUS_OK;
+ // }
+ // return SOFTBUS_PERMISSION_DENIED;
+ return SOFTBUS_OK;
}
int32_t CheckTransSecLevel(const char *mySessionName, const char *peerSessionName)
{
- if (mySessionName == nullptr || peerSessionName == nullptr) {
- return SOFTBUS_INVALID_PARAM;
- }
- if (strcmp(mySessionName, peerSessionName) == 0) {
- return SOFTBUS_OK;
- }
- if (!PermIsSecLevelPublic(mySessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
- if (!PermIsSecLevelPublic(peerSessionName)) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // if (mySessionName == nullptr || peerSessionName == nullptr) {
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+ // if (strcmp(mySessionName, peerSessionName) == 0) {
+ // return SOFTBUS_OK;
+ // }
+ // if (!PermIsSecLevelPublic(mySessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+ // if (!PermIsSecLevelPublic(peerSessionName)) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
bool CheckDiscPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return 0;
}
bool CheckBusCenterPermission(pid_t callingUid, const char *pkgName)
{
- std::string pkg = "";
- if (pkgName != nullptr) {
- pkg = std::string(pkgName);
- } else {
- return false;
- }
- if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
- return true;
- }
- return false;
+ // std::string pkg = "";
+ // if (pkgName != nullptr) {
+ // pkg = std::string(pkgName);
+ // } else {
+ // return false;
+ // }
+ // if (callingUid == SYSTEM_UID || callingUid % MULTE_USER_RADIX == SYSTEM_UID) {
+ // return true;
+ // }
+ // return false;
+ return true;
}
int32_t GrantTransPermission(int32_t callingUid, int32_t callingPid, const char *sessionName)
{
- return AddDynamicPermission(callingUid, callingPid, sessionName);
+ // return AddDynamicPermission(callingUid, callingPid, sessionName);
+ return SOFTBUS_OK;
}
int32_t RemoveTransPermission(const char *sessionName)
@@ -130,19 +136,20 @@ int32_t RemoveTransPermission(const char *sessionName)
int32_t CheckDynamicPermission(void)
{
- uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
-
- auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
- if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
- return SOFTBUS_ERR;
- }
- AccessToken::NativeTokenInfo nativeTokenInfo;
- int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
- if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
- return SOFTBUS_OK;
- }
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
- "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
- return SOFTBUS_ERR;
+ // uint32_t callingToken = OHOS::IPCSkeleton::GetCallingTokenID();
+
+ // auto tokenType = AccessToken::AccessTokenKit::GetTokenTypeFlag(callingToken);
+ // if (tokenType != AccessToken::ATokenTypeEnum::TOKEN_NATIVE) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "not native call");
+ // return SOFTBUS_ERR;
+ // }
+ // AccessToken::NativeTokenInfo nativeTokenInfo;
+ // int32_t result = AccessToken::AccessTokenKit::GetNativeTokenInfo(callingToken, nativeTokenInfo);
+ // if (result == SOFTBUS_OK && nativeTokenInfo.processName == SAMGR_PROCESS_NAME) {
+ // return SOFTBUS_OK;
+ // }
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR,
+ // "check dynamic permission failed, processName:%{private}s", nativeTokenInfo.processName.c_str());
+ // return SOFTBUS_ERR;
+ return SOFTBUS_OK;
}
diff --git a/core/common/softbus_property/softbus_feature_config.c b/core/common/softbus_property/softbus_feature_config.c
index 442c8e0..6fc5cd7 100644
--- a/core/common/softbus_property/softbus_feature_config.c
+++ b/core/common/softbus_property/softbus_feature_config.c
@@ -39,10 +39,10 @@
#define CONN_RFCOM_SEND_MAX_LEN 990
#define CONN_BR_RECEIVE_MAX_LEN 500
#define CONN_TCP_MAX_LENGTH 3072
-#define CONN_TCP_MAX_CONN_NUM 30
+#define CONN_TCP_MAX_CONN_NUM 150
#define CONN_TCP_TIME_OUT 100
#define MAX_NODE_STATE_CB_CNT 10
-#define MAX_LNN_CONNECTION_CNT 10
+#define MAX_LNN_CONNECTION_CNT 50
#define LNN_SUPPORT_CAPBILITY 62
#define AUTH_ABILITY_COLLECTION 0
#define ADAPTER_LOG_LEVEL 0
@@ -50,7 +50,7 @@
#define DEFAULT_STORAGE_PATH "/data/service/el1/public"
#endif
#define LNN_UDID_INIT_DELAY_LEN 1000
-#define LNN_NET_IF_NAME "0:eth0,1:wlan0,2:br0,3:ble0"
+#define LNN_NET_IF_NAME "0:enp7s0,1:wlan0,2:br0,3:ble0"
#define LNN_MAX_CONCURENT_NUM 2
#define DEFAULT_DISC_FREQ_LOW ((5 << 16) | 12)
#define DEFAULT_DISC_FREQ_MID ((5 << 16) | 24)
diff --git a/core/connection/common/src/softbus_thread_pool.c b/core/connection/common/src/softbus_thread_pool.c
index 854cfbb..71dad93 100644
--- a/core/connection/common/src/softbus_thread_pool.c
+++ b/core/connection/common/src/softbus_thread_pool.c
@@ -24,7 +24,8 @@
#include "softbus_log.h"
#ifndef MIN_STACK_SIZE
-#define MIN_STACK_SIZE 0x8000
+// #define MIN_STACK_SIZE 0x8000
+#define MIN_STACK_SIZE 0x200000
#endif
#define THREAD_POOL_NAME "SoftBusConnect"
diff --git a/core/frame/BUILD.gn b/core/frame/BUILD.gn
index ec37fae..ad2e1cc 100644
--- a/core/frame/BUILD.gn
+++ b/core/frame/BUILD.gn
@@ -173,7 +173,7 @@ if (defined(ohos_lite)) {
sources = dsoftbus_server_common_src
sources += [
"$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp",
- "$os_type/client_manager/src/permission_status_change_cb.cpp",
+ # "$os_type/client_manager/src/permission_status_change_cb.cpp",
"$os_type/client_manager/src/softbus_client_info_manager.cpp",
"$os_type/init/src/if_softbus_server.cpp",
"$os_type/init/src/softbus_server.cpp",
@@ -195,8 +195,8 @@ if (defined(ohos_lite)) {
if (is_standard_system) {
external_deps = dsoftbus_server_common_external_deps
external_deps += [
- "access_token:libaccesstoken_sdk",
- "access_token:libprivacy_sdk",
+ # "access_token:libaccesstoken_sdk",
+ # "access_token:libprivacy_sdk",
"device_auth:deviceauth_sdk",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
diff --git a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
index 6c40d49..9dc1ce5 100644
--- a/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
+++ b/core/frame/standard/client_manager/src/permission_status_change_cb.cpp
@@ -33,14 +33,14 @@ void PermissionStatusChangeCb::PermStateChangeCallback(PermStateChangeInfo& resu
void RegisterDataSyncPermission(const uint32_t callingTokenId,
const std::string permissionName, const std::string pkgName)
{
- PermStateChangeScope scopeInfo;
- scopeInfo.permList = {permissionName};
- scopeInfo.tokenIDs = {callingTokenId};
- std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
- std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
- if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
- }
+ // PermStateChangeScope scopeInfo;
+ // scopeInfo.permList = {permissionName};
+ // scopeInfo.tokenIDs = {callingTokenId};
+ // std::shared_ptr<PermissionStatusChangeCb> callbackPtr_ =
+ // std::make_shared<PermissionStatusChangeCb>(scopeInfo, pkgName);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "after tokenId:%{public}d register", callingTokenId);
+ // if (AccessTokenKit::RegisterPermStateChangeCallback(callbackPtr_) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "RegisterPermStateChangeCallback failed.");
+ // }
}
} // namespace OHOS
\ No newline at end of file
diff --git a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
index 566a2b8..aeba793 100644
--- a/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
+++ b/core/frame/standard/client_manager/src/softbus_client_info_manager.cpp
@@ -14,7 +14,8 @@
*/
#include "softbus_client_info_manager.h"
-#include "permission_status_change_cb.h"
+#include "ipc_skeleton.h"
+// #include "permission_status_change_cb.h"
#include "softbus_server.h"
#include "softbus_errcode.h"
#include "softbus_log.h"
@@ -36,9 +37,9 @@ int32_t SoftbusClientInfoManager::SoftbusAddService(const std::string &pkgName,
std::lock_guard<std::recursive_mutex> autoLock(clientObjectMapLock_);
std::pair<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>> clientObject(object, abilityDeath);
clientObjectMap_.emplace(pkgName, clientObject);
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
- RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // std::string permissionName = OHOS_PERMISSION_DISTRIBUTED_DATASYNC;
+ // RegisterDataSyncPermission(tokenCaller, permissionName, pkgName);
return SOFTBUS_OK;
}
diff --git a/core/frame/standard/init/src/softbus_server_stub.cpp b/core/frame/standard/init/src/softbus_server_stub.cpp
index 2103523..ee91cec 100644
--- a/core/frame/standard/init/src/softbus_server_stub.cpp
+++ b/core/frame/standard/init/src/softbus_server_stub.cpp
@@ -30,80 +30,81 @@
#include "softbus_server_frame.h"
#include "trans_channel_manager.h"
#include "trans_session_manager.h"
-#include "accesstoken_kit.h"
-#include "access_token.h"
-#include "privacy_kit.h"
+// #include "accesstoken_kit.h"
+// #include "access_token.h"
+// #include "privacy_kit.h"
#include "softbus_hisysevt_transreporter.h"
-using namespace OHOS::Security::AccessToken;
+// using namespace OHOS::Security::AccessToken;
namespace OHOS {
int32_t SoftBusServerStub::CheckOpenSessionPermission(const SessionParam *param)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- if ((param == NULL) ||
- (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
- return SOFTBUS_INVALID_PARAM;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
- return SOFTBUS_PERMISSION_DENIED;
- }
-
- if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // if ((param == NULL) ||
+ // (TransGetPkgNameBySessionName(param->sessionName, pkgName, PKG_NAME_SIZE_MAX) != SOFTBUS_OK)) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession TransGetPkgNameBySessionName failed");
+ // return SOFTBUS_INVALID_PARAM;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, param->sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession no permission");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
+
+ // if (CheckTransSecLevel(param->sessionName, param->peerSessionName) != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "OpenSession sec level invalid");
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
int32_t SoftBusServerStub::CheckChannelPermission(int32_t channelId, int32_t channelType)
{
- char pkgName[PKG_NAME_SIZE_MAX] = {0};
- char sessionName[SESSION_NAME_SIZE_MAX] = {0};
- int32_t ret = SOFTBUS_OK;
- TransInfo info;
- info.channelId = channelId;
- info.channelType = channelType;
- ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
- if (ret != SOFTBUS_OK) {
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
- return ret;
- }
-
- pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
- pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
- if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
- return SOFTBUS_PERMISSION_DENIED;
- }
+ // char pkgName[PKG_NAME_SIZE_MAX] = {0};
+ // char sessionName[SESSION_NAME_SIZE_MAX] = {0};
+ // int32_t ret = SOFTBUS_OK;
+ // TransInfo info;
+ // info.channelId = channelId;
+ // info.channelType = channelType;
+ // ret = TransGetNameByChanId(&info, pkgName, sessionName, PKG_NAME_SIZE_MAX, SESSION_NAME_SIZE_MAX);
+ // if (ret != SOFTBUS_OK) {
+ // SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "ServerCloseChannel invalid channel info");
+ // return ret;
+ // }
+
+ // pid_t callingUid = OHOS::IPCSkeleton::GetCallingUid();
+ // pid_t callingPid = OHOS::IPCSkeleton::GetCallingPid();
+ // if (CheckTransPermission(callingUid, callingPid, pkgName, sessionName, ACTION_OPEN) != SOFTBUS_OK) {
+ // return SOFTBUS_PERMISSION_DENIED;
+ // }
return SOFTBUS_OK;
}
-static inline int32_t CheckAndRecordAccessToken(const char* permission)
-{
- uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
- int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
-
- ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
- int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
- int32_t failCnt = 1 - successCnt;
- if (type == TOKEN_HAP) {
- PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
- }
+// static inline int32_t CheckAndRecordAccessToken(const char* permission)
+// {
+ // uint32_t tokenCaller = IPCSkeleton::GetCallingTokenID();
+ // int32_t ret = AccessTokenKit::VerifyAccessToken(tokenCaller, permission);
+
+ // ATokenTypeEnum type = AccessTokenKit::GetTokenTypeFlag(tokenCaller);
+ // int32_t successCnt = (int32_t)(ret == PERMISSION_GRANTED);
+ // int32_t failCnt = 1 - successCnt;
+ // if (type == TOKEN_HAP) {
+ // PrivacyKit::AddPermissionUsedRecord(tokenCaller, permission, successCnt, failCnt);
+ // }
- return ret;
-}
+ // return ret;
+ // return SOFTBUS_OK;
+// }
-static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
-{
- if (ipcCode == SERVER_OPEN_SESSION) {
- SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
- }
-}
+// static inline void SoftbusReportPermissionFaultEvt(uint32_t ipcCode)
+// {
+// if (ipcCode == SERVER_OPEN_SESSION) {
+// SoftbusReportTransErrorEvt(SOFTBUS_ACCESS_TOKEN_DENIED);
+// }
+// }
SoftBusServerStub::SoftBusServerStub()
{
@@ -205,16 +206,16 @@ int32_t SoftBusServerStub::OnRemoteRequest(uint32_t code,
return SOFTBUS_ERR;
}
- auto itPerm = memberPermissionMap_.find(code);
- if (itPerm != memberPermissionMap_.end()) {
- const char *permission = itPerm->second;
- if ((permission != nullptr) &&
- (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
- SoftbusReportPermissionFaultEvt(code);
- SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
- return SOFTBUS_ACCESS_TOKEN_DENIED;
- }
- }
+ // auto itPerm = memberPermissionMap_.find(code);
+ // if (itPerm != memberPermissionMap_.end()) {
+ // const char *permission = itPerm->second;
+ // if ((permission != nullptr) &&
+ // (CheckAndRecordAccessToken(permission) != PERMISSION_GRANTED)) {
+ // SoftbusReportPermissionFaultEvt(code);
+ // SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_INFO, "access token permission %s denied!", permission);
+ // return SOFTBUS_ACCESS_TOKEN_DENIED;
+ // }
+ // }
auto itFunc = memberFuncMap_.find(code);
if (itFunc != memberFuncMap_.end()) {
diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
index 9b73c13..5a9ba5e 100644
--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
+++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_manager.c
@@ -248,7 +248,7 @@ static int32_t TransUpdAppInfo(AppInfo *appInfo, const ConnectOption *connInfo)
int32_t TransOpenDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId)
{
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "TransOpenDirectChannel");
+ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "TransOpenDirectChannel");
if (appInfo == NULL || connInfo == NULL || channelId == NULL) {
return SOFTBUS_INVALID_PARAM;
}
diff --git a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
index 868dfc5..c34b4de 100644
--- a/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
+++ b/core/transmission/trans_channel/tcp_direct/src/trans_tcp_direct_wifi.c
@@ -28,7 +28,7 @@
int32_t OpenTcpDirectChannel(const AppInfo *appInfo, const ConnectOption *connInfo, int32_t *channelId)
{
- SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_ERROR, "OpenTcpDirectChannel");
+ SoftBusLog(SOFTBUS_LOG_TRAN, SOFTBUS_LOG_INFO, "OpenTcpDirectChannel");
if (appInfo == NULL || connInfo == NULL || channelId == NULL) {
return SOFTBUS_INVALID_PARAM;
}
--
2.33.0