diff --git a/services/implementation/src/authentication_v2/auth_manager.cpp b/services/implementation/src/authentication_v2/auth_manager.cpp index 293054d3d60e77f9f8bb0233a696a352e2f1c629..45b2cedc7eb2300c21c154e14d2b5dc435bc7647 100644 --- a/services/implementation/src/authentication_v2/auth_manager.cpp +++ b/services/implementation/src/authentication_v2/auth_manager.cpp @@ -1159,8 +1159,7 @@ void AuthManager::ParseProxyJsonObject(const JsonObject &jsonObject) jsonObject[PARAM_KEY_IS_CALLING_PROXY_AS_SUBJECT].Get() == DM_VAL_FALSE) { context_->IsCallingProxyAsSubject = false; } - if (!jsonObject.Contains(PARAM_KEY_SUBJECT_PROXYED_SUBJECTS) || - !IsString(jsonObject, PARAM_KEY_SUBJECT_PROXYED_SUBJECTS)) { + if (!IsString(jsonObject, PARAM_KEY_SUBJECT_PROXYED_SUBJECTS)) { LOGE("no subject proxyed apps"); return; } @@ -1168,11 +1167,11 @@ void AuthManager::ParseProxyJsonObject(const JsonObject &jsonObject) JsonObject allProxyObj; allProxyObj.Parse(subjectProxyOnesStr); for (auto const &item : allProxyObj.Items()) { - if (!item.Contains(TAG_BUNDLE_NAME) || !IsString(item, TAG_BUNDLE_NAME)) { + if (!IsString(item, TAG_BUNDLE_NAME)) { LOGE("bundleName invalid"); return; } - if (!item.Contains(TAG_TOKENID) || !IsInt64(item, TAG_TOKENID)) { + if (!IsInt64(item, TAG_TOKENID)) { LOGE("tokenId invalid"); return; } diff --git a/services/implementation/src/authentication_v2/auth_stages/auth_confirm.cpp b/services/implementation/src/authentication_v2/auth_stages/auth_confirm.cpp index dba71a330efa41b8f66f8a755cb55a5fb67b30e0..efd7b58c5e48a5f7187d4b8aa2f8bb46ccaf36e2 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_confirm.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_confirm.cpp @@ -395,10 +395,10 @@ void AuthSrcConfirmState::GetSrcProxyAclInfoForP2P(std::shared_ptr()) { - if (item.Contains(BUNDLE_INFO) && IsString(item, BUNDLE_INFO)) { + if (IsString(item, BUNDLE_INFO)) { access.bundleInfo = item[BUNDLE_INFO].Get(); } return true; 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 3caf69e22f2077bb346f814c73567103f4c7704c..4bada104f53d5f96a04388633dd50e492d6e1abe 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_credential.cpp @@ -533,7 +533,7 @@ int32_t AuthSrcCredentialExchangeState::Action(std::shared_ptr co int32_t ret = ERR_DM_FAILED; context->isAppCredentialVerified = false; if (!NeedAgreeAcl(context)) { - context->authStateMachine->TransitionTo(std::make_shared()); + context->authStateMachine->TransitionTo(std::make_shared()); return DM_OK; } if (GetSessionKey(context)) { diff --git a/services/implementation/src/authentication_v2/dm_auth_message_processor.cpp b/services/implementation/src/authentication_v2/dm_auth_message_processor.cpp index 7a3698d269b521861f9c85903c17a85b0665e5ce..e3052a1dd38f478099166056eb73b22a701e446a 100644 --- a/services/implementation/src/authentication_v2/dm_auth_message_processor.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_message_processor.cpp @@ -247,6 +247,9 @@ int32_t DmAuthMessageProcessor::SaveDerivativeSessionKeyToDP(int32_t userId, con newSessionKey.keyLen = newKeyLen; int ret = DeviceProfileConnector::GetInstance().PutSessionKey(userId, std::vector(newSessionKey.key, newSessionKey.key + newSessionKey.keyLen), skId); + if (ret != DM_OK) { + LOGE("DP save user session key failed %{public}d", ret); + } if (newSessionKey.key != nullptr) { (void)memset_s(newSessionKey.key, newSessionKey.keyLen, 0, newSessionKey.keyLen); free(newSessionKey.key); @@ -869,7 +872,7 @@ int32_t DmAuthMessageProcessor::CreateProxyRespNegotiateMessage(std::shared_ptr< { CHECK_NULL_RETURN(context, ERR_DM_POINT_NULL); jsonObject[PARAM_KEY_IS_PROXY_BIND] = context->IsProxyBind; - if (context != nullptr && context->IsProxyBind && !context->subjectProxyOnes.empty()) { + if (context->IsProxyBind && !context->subjectProxyOnes.empty()) { JsonObject allProxyObj(JsonCreateType::JSON_CREATE_TYPE_ARRAY); for (const auto &app : context->subjectProxyOnes) { JsonObject object; @@ -1542,6 +1545,7 @@ int32_t DmAuthMessageProcessor::ParseMessageRespUserConfirm(const JsonObject &js int32_t DmAuthMessageProcessor::ParseMessageProxyRespUserConfirm(const JsonObject &json, std::shared_ptr context) { + CHECK_NULL_RETURN(context, ERR_DM_POINT_NULL); if (!context->IsProxyBind) { return DM_OK; } diff --git a/services/implementation/src/authentication_v2/dm_auth_state.cpp b/services/implementation/src/authentication_v2/dm_auth_state.cpp index 9a63c3f00ed5dd2a7e8aabdc7f706ad6e07d7f37..d3ad489c6cee4a047581f6bba4b40a66278e3383 100644 --- a/services/implementation/src/authentication_v2/dm_auth_state.cpp +++ b/services/implementation/src/authentication_v2/dm_auth_state.cpp @@ -267,14 +267,14 @@ bool DmAuthState::ProxyNeedAgreeAcl(std::shared_ptr context) } if (context->direction == DM_AUTH_SOURCE) { for (const auto &app : context->subjectProxyOnes) { - if (!app.proxyAccesser.isAuthed) { + if (!app.proxyAccesser.isAuthed || app.IsNeedSetProxyRelationShip) { return true; } } return false; } for (const auto &app : context->subjectProxyOnes) { - if (!app.proxyAccessee.isAuthed) { + if (!app.proxyAccessee.isAuthed || app.IsNeedSetProxyRelationShip) { return true; } } diff --git a/utils/src/jsonstr_handle/dm_jsonstr_handle.cpp b/utils/src/jsonstr_handle/dm_jsonstr_handle.cpp index 9789df5d032878746d6c4056f3f672aed2ba163c..c4c33da76b21f5beec11e0530bf7fbd4114c76af 100644 --- a/utils/src/jsonstr_handle/dm_jsonstr_handle.cpp +++ b/utils/src/jsonstr_handle/dm_jsonstr_handle.cpp @@ -36,7 +36,7 @@ DM_EXPORT void JsonStrHandle::GetPeerAppInfoParseExtra(const std::string &extra, LOGE("ParseExtra extraInfoJson error"); return; } - if (!IsString(extraInfoJson, TAG_PEER_BUNDLE_NAME) || !IsInt64(extraInfoJson, TAG_PEER_TOKENID)) { + if (!IsString(extraInfoJson, TAG_PEER_BUNDLE_NAME) || !IsUint64(extraInfoJson, TAG_PEER_TOKENID)) { LOGE("ParseExtra TAG_PEER_BUNDLE_NAME or TAG_PEER_TOKENID error"); return; }