SocketPair main_sock_pair(mock_);
SocketPair delegate_sock_pair(mock_);
FdList fd_list;
- char sender_appid[255];
-
- if (!mock_ && aul_app_get_appid_bypid(getpid(),
- sender_appid, sizeof(sender_appid)) < 0) {
- _E("Can't get appid"); // LCOV_EXCL_LINE
- return -1; // LCOV_EXCL_LINE
- }
if (main_sock_pair.Request(target_appid, port_name) != 0)
return -1;
int FdBroker::SendSync(const std::string& target_appid,
const std::string& port_name,
int (*fds)[2]) {
- char sender_appid[255] = { 0, };
- int ret;
- if (!mock_) {
- ret = aul_app_get_appid_bypid(getpid(), sender_appid, sizeof(sender_appid));
- if (ret != AUL_R_OK) {
- _E("Failed to get application ID. ret(%d)", ret);
- return -1;
- }
- }
-
SocketPair main_sock_pair(mock_);
- ret = main_sock_pair.Request(target_appid, port_name);
+ int ret = main_sock_pair.Request(target_appid, port_name);
if (ret != 0)
return -1;
g_variant_get(reply_body, "(i)", &ret);
if (ret != 0) {
- _E("Access Denied[sender_appid: %s, result: %d]", sender_appid, ret);
+ _E("Access Denied[result: %d]", ret);
g_object_unref(reply);
return -EILLEGALACCESS;
}
return;
}
- int ret = -1;
- char sender_appid[255];
- int sender_pid;
+ std::string sender_id;
+ int sender_pid = broker->GetSenderPid(conn, sender);
+ char sender_appid[256];
+ int ret = aul_app_get_appid_bypid(sender_pid, sender_appid,
+ sizeof(sender_appid));
+ if (ret < 0)
+ sender_id = "Daemon";
+ else
+ sender_id = std::string(sender_appid);
- sender_pid = broker->GetSenderPid(conn, sender);
- if (aul_app_get_appid_bypid(sender_pid, sender_appid,
- sizeof(sender_appid)) < 0) {
+ if (sender_id.empty()) {
+ ret = -1;
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(i)", ret));
return;
}
AccessController& ac = broker->GetAccessController();
- ret = ac.Check(conn, sender, sender_appid);
+ ret = ac.Check(conn, sender, sender_id.c_str());
if (ret == 0)
- broker->ReceiveMessage(sender_appid, invocation);
+ broker->ReceiveMessage(sender_id.c_str(), invocation);
g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", ret));
}