From ad40ba2fd8021e418d68a2d615fe7c84393767da Mon Sep 17 00:00:00 2001 From: kaiju Date: Wed, 10 Sep 2025 16:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8AclGetDevUdid=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kaiju Change-Id: I51816f5f3987b8848ed9cae89d449baf16d783a6 --- .../dynamic/src/device_manager_util.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/services/remote_connect/dynamic/src/device_manager_util.cpp b/services/remote_connect/dynamic/src/device_manager_util.cpp index 3ed71d44f..d0d26efbf 100644 --- a/services/remote_connect/dynamic/src/device_manager_util.cpp +++ b/services/remote_connect/dynamic/src/device_manager_util.cpp @@ -17,6 +17,8 @@ #include "iam_logger.h" #include "parameter.h" +#include +#include #define LOG_TAG "USER_AUTH_SA" @@ -41,12 +43,27 @@ bool DeviceManagerUtil::GetNetworkIdByUdid(const std::string &udid, std::string return false; } +#define RTLD_LAZY 1 +using PAclGetDevUdid = int (*)(char *, int); bool DeviceManagerUtil::GetLocalDeviceUdid(std::string &udid) { - constexpr int UDID_LENGTH = 65; + static const char *BEGET_PROXY_LIB = "libbeget_proxy.z.so"; + constexpr int UDID_LENGTH = 64; char udidDevice[UDID_LENGTH] = {0}; - int udidRes = AclGetDevUdid(udidDevice, UDID_LENGTH); - if (udidRes == 0 && strlen(udidDevice) == UDID_LENGTH - 1) { + void *handle = dlopen(BEGET_PROXY_LIB, RTLD_LAZY); + if (handle == nullptr) { + IAM_LOGI("load begetlib failed %{public}s", dlerror()); + return false; + } + PAclGetDevUdid fun = (PAclGetDevUdid)dlsym(handle, "AclGetDevUdid"); + if (fun == nullptr) { + IAM_LOGE("get symbol failed %{public}s", dlerror()); + dlclose(handle); + return false; + } + int udidRes = fun(udidDevice, UDID_LENGTH + 1); + dlclose(handle); + if (udidRes == 0 && strlen(udidDevice) == UDID_LENGTH) { IAM_LOGI("GetDeviceUdid udidRes == 0"); std::string udidString(udidDevice, strlen(udidDevice)); udid = udidString; -- Gitee