From: Hyunho Kang Date: Tue, 22 Dec 2015 08:30:37 +0000 (+0900) Subject: Get socket fd through AUL X-Git-Tag: accepted/tizen/mobile/20151230.223313^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F55161%2F4;p=platform%2Fcore%2Fappfw%2Fmessage-port.git Get socket fd through AUL - Direct fd passing can be a security hole Change-Id: I2bc507bdd4cf5dfe43e5e48a91376bf0bf784d9b Signed-off-by: Hyunho Kang --- diff --git a/src/message-port.c b/src/message-port.c index a5a55c7..51315c3 100755 --- a/src/message-port.c +++ b/src/message-port.c @@ -1215,23 +1215,23 @@ static int __message_port_send_message(const char *remote_appid, const char *rem if (strcmp(remote_appid, __app_id) != 0) { /* self send */ - if (socketpair(AF_UNIX, SOCK_DGRAM, 0, port_info->sock_pair) != 0) { + /* if message-port fail to get socket pair, communicate using GDBus */ + if (aul_request_message_port_socket_pair(port_info->sock_pair) != AUL_R_OK) { _LOGE("error create socket pair"); - ret = MESSAGEPORT_ERROR_IO_ERROR; - goto out; - } + } else { - _LOGI("sock pair : %d, %d", port_info->sock_pair[0], port_info->sock_pair[1]); + _LOGI("sock pair : %d, %d", port_info->sock_pair[0], port_info->sock_pair[1]); - fd_list = g_unix_fd_list_new(); - g_unix_fd_list_append(fd_list, port_info->sock_pair[1], &err); - g_unix_fd_list_append(fd_list, port_info->sock_pair[0], &err); + fd_list = g_unix_fd_list_new(); + g_unix_fd_list_append(fd_list, port_info->sock_pair[1], &err); + g_unix_fd_list_append(fd_list, port_info->sock_pair[0], &err); - if (err != NULL) { - _LOGE("g_unix_fd_list_append [%s]", error->message); - ret = MESSAGEPORT_ERROR_IO_ERROR; - g_error_free(err); - goto out; + if (err != NULL) { + _LOGE("g_unix_fd_list_append [%s]", error->message); + ret = MESSAGEPORT_ERROR_IO_ERROR; + g_error_free(err); + goto out; + } } }