diff --git a/commondependency/src/multiple_user_connector.cpp b/commondependency/src/multiple_user_connector.cpp index d03e3344036afbe1e4d4cf3798552a144f8f3edc..10f23128574966e428834e759e4dc5e51b93f592 100644 --- a/commondependency/src/multiple_user_connector.cpp +++ b/commondependency/src/multiple_user_connector.cpp @@ -418,7 +418,7 @@ DM_EXPORT int32_t MultipleUserConnector::GetUserIdByDisplayId(uint64_t displayId LOGI("displayId %{public}" PRIu64, displayId); int32_t userId = -1; #if !(defined(__LITEOS_M__) || defined(LITE_DEVICE)) - if (displayId == -1) { + if (static_cast(displayId) == -1) { userId = GetFirstForegroundUserId(); return userId; } diff --git a/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp b/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp index 5cd699d25d7abbefceceb350f8b534d8538c4895..bf0f85689b1baeabce5f4dd7cc1e13684cbde19c 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp @@ -144,7 +144,7 @@ int32_t AuthSrcCredentialAuthDoneState::HandleSrcCredentialAuthDone(std::shared_ int32_t ret = DM_OK; // first time joinLnn, auth lnnCredential if (context->accesser.isGenerateLnnCredential == true && context->isAppCredentialVerified == false && - context->accesser.bindLevel != USER) { + context->accesser.bindLevel != static_cast(USER)) { context->isAppCredentialVerified = true; DerivativeSessionKey(context); msgType = MSG_TYPE_REQ_CREDENTIAL_AUTH_START; @@ -160,7 +160,8 @@ int32_t AuthSrcCredentialAuthDoneState::HandleSrcCredentialAuthDone(std::shared_ return ERR_DM_FAILED; } // First-time authentication and Lnn credential process - } else if (context->accesser.isGenerateLnnCredential == true && context->accesser.bindLevel != USER) { + } else if (context->accesser.isGenerateLnnCredential == true && + context->accesser.bindLevel != static_cast(USER)) { int32_t skId = 0; int32_t ret = context->authMessageProcessor->SaveSessionKeyToDP(context->accesser.userId, skId); if (ret != DM_OK) { @@ -305,7 +306,8 @@ int32_t AuthSinkCredentialAuthNegotiateState::Action(std::shared_ptraccessee.isGenerateLnnCredential == true && context->accessee.bindLevel != USER && + if (context->accessee.isGenerateLnnCredential == true && + context->accessee.bindLevel != static_cast(USER) && context->isAppCredentialVerified == true) { ret = context->authMessageProcessor->SaveSessionKeyToDP(context->accessee.userId, skId); if (ret != DM_OK) { @@ -536,7 +538,7 @@ int32_t AuthSrcCredentialExchangeState::Action(std::shared_ptr co return DM_OK; } // First authentication, generate LNN credentials and public key - if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != USER) { + if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != static_cast(USER)) { ret = GenerateCredIdAndPublicKey(DM_AUTH_SCOPE_LNN, context); if (ret != DM_OK) { LOGE("AuthSrcCredentialExchangeState::Action() error, generate user credId and publicKey failed."); @@ -545,9 +547,10 @@ int32_t AuthSrcCredentialExchangeState::Action(std::shared_ptr co } DmAuthScope authorizedScope = DM_AUTH_SCOPE_INVALID; - if (context->accesser.bindLevel == APP || context->accesser.bindLevel == SERVICE) { + if (context->accesser.bindLevel == static_cast(APP) || + context->accesser.bindLevel == static_cast(SERVICE)) { authorizedScope = DM_AUTH_SCOPE_APP; - } else if (context->accesser.bindLevel == USER) { + } else if (context->accesser.bindLevel == static_cast(USER)) { authorizedScope = DM_AUTH_SCOPE_USER; } @@ -581,7 +584,7 @@ int32_t AuthSinkCredentialExchangeState::Action(std::shared_ptr c } // First authentication lnn cred - if (context->accessee.isGenerateLnnCredential && context->accessee.bindLevel != USER) { + if (context->accessee.isGenerateLnnCredential && context->accessee.bindLevel != static_cast(USER)) { // Generate credentials and public key ret = GenerateCredIdAndPublicKey(DM_AUTH_SCOPE_LNN, context); if (ret != DM_OK) { @@ -604,9 +607,10 @@ int32_t AuthSinkCredentialExchangeState::Action(std::shared_ptr c } DmAuthScope authorizedScope = DM_AUTH_SCOPE_INVALID; - if (context->accessee.bindLevel == APP || context->accessee.bindLevel == SERVICE) { + if (context->accessee.bindLevel == static_cast(APP) || + context->accessee.bindLevel == static_cast(SERVICE)) { authorizedScope = DM_AUTH_SCOPE_APP; - } else if (context->accessee.bindLevel == USER) { + } else if (context->accessee.bindLevel == static_cast(USER)) { authorizedScope = DM_AUTH_SCOPE_USER; } // Generate transport credentials and public key @@ -622,7 +626,6 @@ int32_t AuthSinkCredentialExchangeState::Action(std::shared_ptr c if (ret != DM_OK) { context->hiChainAuthConnector->DeleteCredential(osAccountId, tmpCredId); context->SetCredentialId(DM_AUTH_LOCAL_SIDE, authorizedScope, ""); - LOGE("AuthSinkCredentialExchangeState::Action failed, agree app cred failed."); return ret; } @@ -648,7 +651,7 @@ int32_t AuthSrcCredentialAuthStartState::AgreeAndDeleteCredential(std::shared_pt std::string tmpCredId = ""; int32_t osAccountId = context->accesser.userId; // First authentication - if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != USER) { + if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != static_cast(USER)) { // Agree lnn credentials and public key tmpCredId = context->accesser.lnnCredentialId; ret = AgreeCredential(DM_AUTH_SCOPE_LNN, context); @@ -661,10 +664,11 @@ int32_t AuthSrcCredentialAuthStartState::AgreeAndDeleteCredential(std::shared_pt ffrt::submit([=]() { context->hiChainAuthConnector->DeleteCredential(osAccountId, tmpCredId);}); } DmAuthScope authorizedScope = DM_AUTH_SCOPE_INVALID; - if (context->accesser.bindLevel == APP || context->accesser.bindLevel == SERVICE) { + if (context->accesser.bindLevel == static_cast(APP) || + context->accesser.bindLevel == static_cast(SERVICE)) { authorizedScope = DM_AUTH_SCOPE_APP; } - if (context->accesser.bindLevel == USER) { + if (context->accesser.bindLevel == static_cast(USER)) { authorizedScope = DM_AUTH_SCOPE_USER; } // Agree transport credentials and public key @@ -710,7 +714,6 @@ int32_t AuthSrcCredentialAuthStartState::Action(std::shared_ptr c return ret; } if (context->authStateMachine->WaitExpectEvent(ON_TRANSMIT) != ON_TRANSMIT) { - LOGE("AuthSrcCredentialAuthStartState::Action failed, ON_TRANSMIT event not arrived."); return ERR_DM_FAILED; } message = context->authMessageProcessor->CreateMessage(MSG_TYPE_REQ_CREDENTIAL_AUTH_START, context); @@ -729,7 +732,7 @@ int32_t AuthSrcSKDeriveState::Action(std::shared_ptr context) CHECK_NULL_RETURN(context, ERR_DM_POINT_NULL); CHECK_NULL_RETURN(context->authMessageProcessor, ERR_DM_POINT_NULL); // First authentication lnn cred - if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != USER) { + if (context->accesser.isGenerateLnnCredential && context->accesser.bindLevel != static_cast(USER)) { int32_t skId = 0; // derive lnn sk std::string suffix = context->accesser.lnnCredentialId + context->accessee.lnnCredentialId; @@ -841,7 +844,7 @@ int32_t AuthSinkSKDeriveState::Action(std::shared_ptr context) CHECK_NULL_RETURN(context, ERR_DM_POINT_NULL); CHECK_NULL_RETURN(context->authMessageProcessor, ERR_DM_POINT_NULL); // First authentication lnn cred - if (context->accessee.isGenerateLnnCredential && context->accessee.bindLevel != USER) { + if (context->accessee.isGenerateLnnCredential && context->accessee.bindLevel != static_cast(USER)) { int32_t skId = 0; // derive lnn sk std::string suffix = context->accesser.lnnCredentialId + context->accessee.lnnCredentialId; diff --git a/services/implementation/src/dependency/hichain/hichain_auth_connector.cpp b/services/implementation/src/dependency/hichain/hichain_auth_connector.cpp index b1f2fd031fa50bf48225eacb9927bc54fe2f5f2a..c0784d027c1ef1ecb75769610728e374ace6e14a 100644 --- a/services/implementation/src/dependency/hichain/hichain_auth_connector.cpp +++ b/services/implementation/src/dependency/hichain/hichain_auth_connector.cpp @@ -259,7 +259,7 @@ int32_t HiChainAuthConnector::AuthCredentialPinCode(int32_t osAccountId, int64_t { std::string pinCodeHash = GetAnonyString(Crypto::Sha256(pinCode)); LOGI("AuthCredentialPinCode pinCodeHash: %{public}s", pinCodeHash.c_str()); - if (pinCode.size() < MIN_PINCODE_SIZE) { + if (static_cast(pinCode.size()) < MIN_PINCODE_SIZE) { LOGE("HiChainAuthConnector::AuthCredentialPinCode failed, pinCode size is %{public}zu.", pinCode.size()); return ERR_DM_FAILED; } diff --git a/services/implementation/src/dependency/softbus/softbus_connector.cpp b/services/implementation/src/dependency/softbus/softbus_connector.cpp index db5974f1b4f14b041199f1eaf52a83bd7a5d4c43..90606a916a10fd09fe3239f4c3b031ef976a5b52 100644 --- a/services/implementation/src/dependency/softbus/softbus_connector.cpp +++ b/services/implementation/src/dependency/softbus/softbus_connector.cpp @@ -221,6 +221,7 @@ int32_t SoftbusConnector::SyncLocalAclListProcess(const DevUserInfo &localDevUse case DM_VERSION_INT_5_1_0: ret = SyncLocalAclList5_1_0(localDevUserInfo.deviceId, remoteDevUserInfo.deviceId, localAcl, remoteAclHashList); + break; default: LOGE("versionNum is invaild, ver: %{public}d", versionNum); break;