if (err != NULL) {
_LOGE("Failed to get pid [%s]", err->message);
g_error_free(err);
+ } else {
+ _LOGE("Failed to get pid");
}
goto out;
}
return true;
}
+static void __close_socket(GDBusMethodInvocation *invocation)
+{
+ GDBusMessage *msg;
+ GUnixFDList *fd_list;
+ int fd_len;
+ int *returned_fds = NULL;
+
+ msg = g_dbus_method_invocation_get_message(invocation);
+ fd_list = g_dbus_message_get_unix_fd_list(msg);
+ if (fd_list != NULL) {
+ returned_fds = g_unix_fd_list_steal_fds(fd_list, &fd_len);
+ if (returned_fds != NULL) {
+ close(returned_fds[0]);
+ }
+ }
+}
static void __dbus_method_call_handler(GDBusConnection *conn,
const gchar *sender, const gchar *object_path,
const gchar *iface_name, const gchar *method_name,
_LOGI("method_name: %s, sender: %s", method_name, sender);
gpointer sender_appid = g_hash_table_lookup(__sender_appid_hash, sender);
if (sender_appid == NULL) {
- if (!__check_sender_validation(parameters, sender, conn))
+ if (!__check_sender_validation(parameters, sender, conn)) {
+ _LOGE("Failed to validate");
+ __close_socket(invocation);
goto out;
+ }
}
+
if (g_strcmp0(method_name, "send_message") == 0)
__receive_message(parameters, invocation);
out: