mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-27 01:51:13 +00:00
!1539 【IPC/RPC】删除GetPIdUid接口
Merge pull request !1539 from chenchong_666/master
This commit is contained in:
commit
4ca8db9280
@ -171,17 +171,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
int32_t NoticeServiceDie();
|
int32_t NoticeServiceDie();
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Obtains the corresponding PID and UID;
|
|
||||||
* This interface is only provided for internal use by IPC/RPC and is not open to the public,
|
|
||||||
* It may be taken down at any time.
|
|
||||||
* @param reply Indicates the object returned by the peer process.
|
|
||||||
* @return Returns {@link ERR_NONE} if the operation is successful; returns an error code
|
|
||||||
* defined in {@link ipc_types.h} otherwise.
|
|
||||||
* @since 9
|
|
||||||
*/
|
|
||||||
int GetPidUid(MessageParcel &reply);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Obtains the session name.
|
* @brief Obtains the session name.
|
||||||
* @return Returns the session name of type string.
|
* @return Returns the session name of type string.
|
||||||
|
@ -276,7 +276,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef CONFIG_IPC_SINGLE
|
#ifndef CONFIG_IPC_SINGLE
|
||||||
int GetPidUid(MessageParcel &data, MessageParcel &reply);
|
|
||||||
std::string GetSessionName();
|
std::string GetSessionName();
|
||||||
int32_t GetSessionNameForPidUid(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
int32_t GetSessionNameForPidUid(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||||
int32_t GetGrantedSessionName(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
int32_t GetGrantedSessionName(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
|
||||||
|
@ -321,14 +321,6 @@ int IPCObjectProxy::RemoveSessionName(const std::string &sessionName)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPCObjectProxy::GetPidUid(MessageParcel &reply)
|
|
||||||
{
|
|
||||||
MessageParcel data;
|
|
||||||
MessageOption option;
|
|
||||||
|
|
||||||
return SendRequestInner(true, GET_PID_UID, data, reply, option);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IPCObjectProxy::OnFirstStrongRef(const void *objectId)
|
void IPCObjectProxy::OnFirstStrongRef(const void *objectId)
|
||||||
{
|
{
|
||||||
// IPC proxy: AcquireHandle->AttachObject
|
// IPC proxy: AcquireHandle->AttachObject
|
||||||
|
@ -327,10 +327,16 @@ int IPCObjectStub::DBinderGetSessionNameForPidUid(uint32_t code,
|
|||||||
int IPCObjectStub::DBinderGetPidUid(uint32_t code,
|
int IPCObjectStub::DBinderGetPidUid(uint32_t code,
|
||||||
MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||||
{
|
{
|
||||||
if (!IPCSkeleton::IsLocalCalling()) {
|
if (!IPCSkeleton::IsLocalCalling() || !IsSamgrCall()) {
|
||||||
|
ZLOGE(LABEL, "GET_PID_UID message is not from sa manager");
|
||||||
return IPC_STUB_INVALID_DATA_ERR;
|
return IPC_STUB_INVALID_DATA_ERR;
|
||||||
}
|
}
|
||||||
return GetPidUid(data, reply);
|
|
||||||
|
if (!reply.WriteUint32(getpid()) || !reply.WriteUint32(getuid())) {
|
||||||
|
ZLOGE(LABEL, "write to parcel fail");
|
||||||
|
return IPC_STUB_INVALID_DATA_ERR;
|
||||||
|
}
|
||||||
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPCObjectStub::DBinderRemoveSessionName(uint32_t code,
|
int IPCObjectStub::DBinderRemoveSessionName(uint32_t code,
|
||||||
@ -698,15 +704,6 @@ int32_t IPCObjectStub::GetSessionNameForPidUid(uint32_t code, MessageParcel &dat
|
|||||||
return ERR_NONE;
|
return ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IPCObjectStub::GetPidUid(MessageParcel &data, MessageParcel &reply)
|
|
||||||
{
|
|
||||||
if (!reply.WriteUint32(getpid()) || !reply.WriteUint32(getuid())) {
|
|
||||||
ZLOGE(LABEL, "write to parcel fail");
|
|
||||||
return IPC_STUB_INVALID_DATA_ERR;
|
|
||||||
}
|
|
||||||
return ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string IPCObjectStub::CreateSessionName(int uid, int pid)
|
std::string IPCObjectStub::CreateSessionName(int uid, int pid)
|
||||||
{
|
{
|
||||||
std::string sessionName = DBINDER_SOCKET_NAME_PREFIX +
|
std::string sessionName = DBINDER_SOCKET_NAME_PREFIX +
|
||||||
|
@ -143,19 +143,6 @@ HWTEST_F(IPCObjectProxyTest, GetSessionNameForPidUidTest001, TestSize.Level1)
|
|||||||
ASSERT_TRUE(ret.size() == 0);
|
ASSERT_TRUE(ret.size() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @tc.name: GetPidUidTest001
|
|
||||||
* @tc.desc: Verify the IPCObjectProxy::GetPidUid function
|
|
||||||
* @tc.type: FUNC
|
|
||||||
*/
|
|
||||||
HWTEST_F(IPCObjectProxyTest, GetPidUidTest001, TestSize.Level1)
|
|
||||||
{
|
|
||||||
IPCObjectProxy object(1);
|
|
||||||
MessageParcel reply;
|
|
||||||
auto ret = object.GetPidUid(reply);
|
|
||||||
ASSERT_TRUE(ret != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: GetInterfaceDescriptorTest001
|
* @tc.name: GetInterfaceDescriptorTest001
|
||||||
* @tc.desc: Verify the IPCObjectProxy::GetInterfaceDescriptor function
|
* @tc.desc: Verify the IPCObjectProxy::GetInterfaceDescriptor function
|
||||||
|
Loading…
Reference in New Issue
Block a user