summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-09Switch to spice-vdagent.service by defaultHEADmasterFabian Vogt2-0/+6
Add an [Install] section to the user unit and tell systemd to ignore the .desktop file explicitly. Also add missing ordering dependencies. Without this, the service fails if it is started before e.g. $DISPLAY is set.
2023-01-13vdagent: Remove watch event on vdagent_display_destroy()Victor Toso1-2/+4
To avoid main loop calling it when GIOChannel for x11 was already destroyed. Related: https://bugzilla.redhat.com/show_bug.cgi?id=2145004 Signed-off-by: Victor Toso <victortoso@redhat.com>
2022-09-28Makefile.am: don't create /var/run/spice-vdagentdAbderrahim Kitouni1-3/+0
/var/run is generally a symlink to /run, which is a tmpfs.
2022-02-14Release 0.22.1spice-vdagent-0.22.1Victor Toso2-1/+5
Signed-off-by: Victor Toso <victortoso@redhat.com>
2022-02-14Do not process X11 events in vdagent_x11_createFrediano Ziglio1-3/+0
Processing events requires some more initialisation between VDAgentDisplay and vdagent_x11. Postpone that after initialisation. This fix a crash on Fedora 36, see https://bugzilla.redhat.com/show_bug.cgi?id=2042877. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2022-02-07Release 0.22.0spice-vdagent-0.22.0Victor Toso2-1/+8
Signed-off-by: Victor Toso <victortoso@redhat.com>
2022-01-18vdagentd/uinput: Handle side mouse buttons (BTN_SIDE and BTN_EXTRA)Kevin Pouget1-0/+4
Adds support for handling the side mouse buttons some mouses have, typically used in web browsers for previous/next website in history. spice-gtk requires a corresponding patch to capture and forward the buttons. At the spice and protocol level, the required changes were previously merged: * https://gitlab.freedesktop.org/spice/spice/-/issues/45 * https://gitlab.freedesktop.org/spice/spice/-/merge_requests/140 * https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/22 This commit is a rebased and revised version of the patch by Kevin Pouget: https://www.spinics.net/lists/spice-devel/msg42582.html (I have confirmed with him that it's OK that I submit the updated patches.) Co-Authored-By: Kevin Pouget <kpouget@redhat.com> Co-Authored-By: Joan Bruguera <joanbrugueram@gmail.com>
2021-12-20udscs: udscs_connect: return error to callerVictor Toso3-10/+17
This way we can have the log in one place and avoid flooding the journal. Signed-off-by: Victor Toso <victortoso@redhat.com>
2021-12-20vdagent: udscs: limit retry to connect to vdagentdVictor Toso1-0/+21
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2005802 Related: https://bugzilla.redhat.com/show_bug.cgi?id=2028013 Signed-off-by: Victor Toso <victortoso@redhat.com>
2021-12-02configure.ac: autoconf 2.71 compatibilityAdrian Bunk1-1/+1
"y" is not "set", but both have non-zero lengths.
2021-07-16Provide systemd user spice-vdagent.serviceRex Dieter3-0/+12
2021-05-06tests: Invoke ps in a way that does not truncate wide output.Maxim Cournoyer1-1/+1
By default, 'ps' truncates its output to about 100 characters. The test-termination test depends on finding the socket file name in the output of the 'ps' command; it could fail depending on the file name length of the directory where the test was run. * tests/test-termination.c (get_daemon_pid) <ps>: Invoke with the -ww option to preserve all the output.
2021-05-04Fix g_memdup deprecation warning with glib >= 2.68Marc-André Lureau4-7/+11
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1943059 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-03-25build: replace bashism in configuration for GTK 4Chris Mayo1-1/+1
Else with dash as /bin/sh, GTK 4 support cannot be selected.
2021-01-13Release 0.21.0spice-vdagent-0.21.0Julien Ropé2-1/+12
Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <freddy77@gmail.com>
2020-11-19Use the Mutter API from display.cJulien Ropé1-10/+22
Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-11-19Add implementation of the DBUS interface to Mutter.Julien Ropé3-0/+311
This can be used to retrieve monitor resolutions directly from the Mutter compositor under Wayland. Under environments using a different compositor, the X11 lib will keep being used. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-11-19Move some reusable code at a higher level.Julien Ropé1-26/+25
Adding disabled displays to the list is something that we will need to do with multiple backends, not just GTK. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-11-19Make the connector mappings available whatever the build optionsJulien Ropé1-22/+12
Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-11-15ci: run checks only with --with-session-info=noneJakub Janků1-2/+6
In the container environment, neither systemd nor console kit is running, thus test-session-info fails. To fix the pipeline, run "make distcheck" with the aforementioned option, which disables this test. Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-11-15build: test session info only with non-dummy implementationJakub Janků1-3/+2
The test, as it is written at the moment, only makes sense with console-kit or systemd implementation. With the dummy one, the test fails, but it's not an error in the vdagent code. Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-11-15build: test-session-info: include only what's necessaryJakub Janků1-8/+2
The test doesn't depend on udscs.c in common_sources, for example, so don't include it. Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-11-15test-session-info: rename misleading "ck_uid"Jakub Janků1-5/+6
The source code refers to "console-kit uid", but we have console-kit as well as systemd and dummy implementation of session-info. Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-11-03Add a test for session_infoFrediano Ziglio2-0/+88
Test from Uri, integrated in test suite. Signed-off-by: Uri Lublin <uril@redhat.com> Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-11-03vdagentd: do not allow to use an already used file-xfer idUri Lublin1-0/+7
Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-11-03cleanup active_xfers when the client disconnectsUri Lublin1-0/+1
Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-29vdagentd: Limit number of agents per session to 1Frediano Ziglio1-0/+24
Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-29Better check for sessionsFrediano Ziglio5-1/+93
Do not allow other users to hijack a session checking that the process is launched by the owner of the session. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-29Avoids user session hijackingFrediano Ziglio3-14/+43
Avoids user hijacking sessions by reusing PID. In theory an attacker could: - open a connection to the daemon; - fork and exit the process but keep the file descriptor open (inheriting or duplicating it in forked process); - force OS to recycle the initial PID, by creating many short lived processes. Daemon would detect the old PID as having the new session. Check the user to avoid such replacements. This issue was reported by SUSE security team. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-29Avoids unlimited agent connectionsFrediano Ziglio1-0/+12
Limit the number of agents that can be connected. Avoids reaching the maximum number of files in a process. Beside one file descriptor per agent the daemon open just some other fixed number of files. This issue was reported by SUSE security team. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-10-29Avoids uncontrolled "active_xfers" allocationsFrediano Ziglio1-0/+23
Limit the number of active file transfers possibly causing DoSes consuming memory in "active_xfers". This issue was reported by SUSE security team. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-29Avoids unchecked file transfer IDs allocation and usageFrediano Ziglio1-6/+22
Avoid agents allocating file transfers. The "active_xfers" entries are now inserted when client start sending files. Also different agents cannot mess with other agent transfers as a transfer is bound to a single agent. This issue was reported by SUSE security team. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-29vdagentd: Avoid calling chmodFrediano Ziglio1-10/+2
Create the socket with the right permissions using umask. This also prevents possible symlink exploitation in case socket path is not secure. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-28x11-randr: fix leak on vdagent_x11 destroyJakub Janků3-1/+9
In vdagent_x11_destroy(), only x11->randr.failed_conf is freed and x11->randr.{res, outputs, crtcs} are left allocated. To fix it, create a new function vdagent_x11_randr_destroy() that frees all randr resources, and call it from vdagent_x11_destroy(). Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-10-27CI: fix build failureJulien Ropé1-0/+1
With latest fedora container using F33, we get gtk4 3.99, where vulkan is enabled by default. This require to get the vulkan headers as a dependency. Signed-off-by: Julien Ropé <jrope@redhat.com>
2020-10-21vdagentd: Fix clipboard serial for big endian machinesFrediano Ziglio1-1/+2
The GUINT32_TO_LE in case of big endian machine can expand the argument multiple times so avoid to pass argument that could have side effects. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-10-21vdagentd: Simplify handling VD_AGENT_GRAPHICS_DEVICE_INFOFrediano Ziglio1-5/+1
g_free does nothing if pointer is NULL. device_info and device_info_size will be overwritten in any case. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-10-21vdagentd: Constify vdagent_message_min_sizeFrediano Ziglio1-1/+1
The array is not supposed to be changed. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
2020-10-19When using GTK for monitors, we should not update the X11 structures.Julien Ropé1-0/+4
X11 events are still used to notify the daemon of monitor resolution changes, but the X11 structures themselves do not need to be updated, because we will get all required informations from the GTK library. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Using GTK, there is no way to modify the monitor resolution.Julien Ropé2-1/+9
Since vdagent_x11_set_monitor_config() can work only under the X11 backend, make sure we don't call it when under Wayland - it will fail anyway. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Send guest resolution using GDK functions.Julien Ropé1-3/+146
- Implement the vdagent_gtk_get_resolutions() function. Use gdk_monitor_*() functions to retrieve the resolution of each monitor. Associate them to the right display ID using the connector_mapping hash Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Split the "lookup_xrandr_output_for_device_info()" function to reuseJulien Ropé5-28/+63
some of it with different backends. Most display drivers will number their outputs starting with "1", but some (like older QXL drivers) will start from 0. As we need to map device names with SPICE display IDs, we need to know what to expect. The logic that finds whether we have a O-based index or not is independent from the backend, and can be reused outside of the X11 implementation. This commit separates this logic for that purpose, to prevent code duplication. - create the has_zero_based_display_id() function to call whatever the backend, and learn whether our IDs should be decremented or not. Its code is taken out of lookup_xrandr_output_for_device_info() - keep the lookup_xrandr_output_for_device_info() for x11 implementation - add parameters to some functions to give them the information that IDs should be decremented because of the 0-based index. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Prepare mapping based on connector name.Julien Ropé3-69/+139
Split the lookup_xrandr_output_for_device_info to access the part retrieving the expected connector name. Call that separate function in the "non-X11" part of the code, and use a hashtable to map Spice display ID to its expected connector name. This hashtable will later be used when we need to report resolution changes to the daemon/server. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Copy the 'debug' flag and 'vdagentd' socket into the VDAgentDisplayJulien Ropé1-3/+8
structure. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-19Add a non-X11 function to send the guest resolution to theJulien Ropé5-35/+88
daemon/server. The purpose here is to further separate X11-specific code, and have the actual sending to the daemon to be out of X11 code, and reusable by other APIs. - Replace vdagent_x11_send_daemon_guest_res() with a function that builds and returns the list of monitor resolutions. - Create the vdagent_display_send_daemon_guest_res() that uses this to send the resolutions to the daemon. - Call this function in place of vdagent_x11_send_daemon_guest_res() In later commits, we will be able to use a different API to generate the list of monitor resolution, without having to change the X11 code. Signed-off-by: Julien Ropé <jrope@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-10-05ci: Upload test results in case of failureFrediano Ziglio1-0/+6
Allows to see tests results in case "make check" fails. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jakub Janků <jjanku@redhat.com>
2020-09-28clipboard: enable copying files from client using webdavJakub Janků5-1/+425
When the user wants to copy files, new spice-gtk can share those files using the existing phodav server. In that case, it advertises the VD_AGENT_CLIPBOARD_FILE_LIST type in the clipboard grab message. Upon request of the clipboard data in the mentioned type, spice-gtk provides a list of absolute paths in the phodav server - these are the files that are supposed to be copied/moved. The role of the vdagent is to: 1) ensure that the phodav share is mounted, 2) adjust the provided paths given the mountpoint, 3) provide the uri list in various formats depending on which one was requested (different file managers use differenct formats) The code that accomplishes these tasks is located in a new file webdav-cb.c - the main reason for it is that vdagent currently supports two clibpoard backends: x11, gtk+. Implement this new feature only in the x11 backend since the future of the gtk+ one is not clear. Copy and move was tested with GNOME Nautilus, KDE Dolphin, Cinnamon Nemo, Mate Caja, Xfce Thunar, LXDE PCManFM, Krusader. The functionality with other file managers might be limited. Copying files from the vdagnet side to the client is not supported yet. Signed-off-by: Jakub Janků <jjanku@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-28build: require spice-protocol 0.14.3Jakub Janků1-1/+1
This adds the VD_AGENT_CLIPBOARD_FILE_LIST necessary for the following commits. Signed-off-by: Jakub Janků <jjanku@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-28x11: move code to clipboard_data_send_to_requestor()Jakub Janků1-40/+61
With the upcoming patch, clipboard data will be sent to the requestor outside of vdagent_x11_clipboard_data() so extract the necessary code into a new function to avoid repetition. The function takes "take_ownership" argument. If set to True, the caller doesn't have to free the passed data which will also be useful with the following changes. Improve style by adding brackets to single-line if statements. Signed-off-by: Jakub Janků <jjanku@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-25audio: Change percentage formattingFrediano Ziglio1-6/+6
Use XX% instead of %XX. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Jakub Janků <jjanku@redhat.com>