Commit Graph

377 Commits

Author SHA1 Message Date
Frediano Ziglio
fa2e3371c8 vdagent: Reset properly state of pending large messages upon disconnection
If the client closes the connection while having pending large messages
(split into multiple chunks) the state is not correctly reset causing
next client messages to be not correctly handled.

This can occur for instance if the client is closed (or killed) while
transferring a large file.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1548419.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-05-15 15:22:52 +01:00
Frediano Ziglio
0fe97cc05a Use final capabilities to check client messages
The client is sending messages that are compatible with agent
capabilities but also encoded with capabilities it knows of so to
check them we need to consider final capabilities, not client ones.

This fixes a regression introduced with
"vdagent: Reuse agent_check_message" where some messages were wrongly
interpreted as wrong (particularly some clipboard messages).

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Jakub Janků <jjanku@redhat.com>
2020-05-15 11:50:08 +01:00
Frediano Ziglio
f2ef1094f2 cmake: Force static libraries
Add some settings to both MingW and MSVC to more strongly force
static libraries linking.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-04-28 18:17:47 +01:00
Frediano Ziglio
721cd5a1ef ci: Use magick.exe executable under Windows
On Windows beside the various single executables like Linux there's
a single "magick" executable you can use specifying what you want
to do.
Having a single executable avoids the trick to fix "convert" problem
and is easier to port, you just have to copy the single executable.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-04-28 17:14:04 +01:00
Frediano Ziglio
9de1492446 vdagent: Reuse agent_check_message
That function does also more checks on the message.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jakub Janků <jjanku@redhat.com>
2020-04-28 16:50:13 +01:00
Frediano Ziglio
dd05463f9b Use SPICE_N_ELEMENTS instead of a constant for file_path size
Allows to easily change the size if needed

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 11:22:37 +01:00
Frediano Ziglio
b4776f4291 file_xfer: Return detailed error for no space
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 10:33:34 +01:00
Frediano Ziglio
ab3353b579 vdagent: Return better error if locked
Use specific VD_AGENT_FILE_XFER_STATUS_SESSION_LOCKED error.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 10:33:34 +01:00
Frediano Ziglio
a914784295 vdagent: Allow to return detailed message for file transfer
Reuse AgentFileXferStatusMessageFull and agent_prepare_filexfer_status

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 10:33:34 +01:00
Frediano Ziglio
3cad1e7570 Compile in agent utilities from spice-common
Allows these utilities to be used in the code.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-24 10:33:34 +01:00
Frediano Ziglio
5ed23e95ec spice-protocol: Update to get new message definitions
The EXTRA_DIST part in Makefile.am is needed as spice-protocol
removed support for Autoconf.
We don't need anymore "ignore=untracked" in the submodule as
we are not going to add or modify files anymore.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-01 12:30:38 +01:00
Frediano Ziglio
cf5a336d9b ci: Use a single job
Reduce CI resource usage using a single job instead of 2.
The project is pretty small and the setup of the 2 jobs is pretty
long compared to the build so using a single job (we used the same
container image for both) reduce CI resource usage.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-04-01 10:25:25 +01:00
Frediano Ziglio
0d0df5681b ci: Fix repositories updates
Force sync and update of all git submodules.
Do not install packaged spice-protocol, we are using submodule.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-04-01 10:25:20 +01:00
Frediano Ziglio
5988f86a75 Revert 3 last patches
Revert "try to remove other bugs", commit
57266085b9.
Revert "try to fix previous", commit
8e40377068.
Revert "attempt to fix more warnings!", commit
66b6933a38.

I put by mistake on the MR due to some automatic scripts.
Their state are pretty experimental.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-30 15:11:22 +01:00
Frediano Ziglio
57266085b9 try to remove other bugs 2020-03-23 14:13:48 +00:00
Frediano Ziglio
8e40377068 try to fix previous 2020-03-23 13:57:06 +00:00
Frediano Ziglio
66b6933a38 attempt to fix more warnings! 2020-03-23 13:38:40 +00:00
Frediano Ziglio
c8fd498b7f display_setting: Remove a warning
Avoids:

warning C4267: 'initializing': conversion from 'size_t' to 'DWORD', possible loss of data

Value won't never be that huge to cause overflow (we are reading a string
in a static buffer, we don't expect an encyclopedia).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-23 12:36:59 +00:00
Frediano Ziglio
f920c23e2e file_xfer: Remove a warning
Avoids:

warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-23 12:36:55 +00:00
Frediano Ziglio
f00eb1f7b3 build: Add missing file to distribution
test-shell script is needed for "make check".

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2020-03-19 16:48:29 +00:00
Uri Lublin
383e88cadb spec file: add msi installers
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-19 16:41:21 +00:00
Uri Lublin
07f4992d59 Ignore spice-protocol untracked files
This will help with making a release.

spice-protocol's .gitignore is generated and not committed,
so after running ./autogen.sh (autoreconf) git thinks
spice-protocol is dirty (just because of generated files).

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-19 16:41:21 +00:00
Uri Lublin
3dfcc04435 MSI: Make SourceDir the path to executables
Make it possible to not put the executables under bin/

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-19 16:41:21 +00:00
Uri Lublin
638a49aafe MSI: Package: only allow perMachine installation
When building on Windows with Wix, also add Platform to Package
as follows (wixl warns about it):

   Platform="$(var.Arch)"

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-19 16:39:46 +00:00
Frediano Ziglio
0ad43eed50 Constification, does not make sense to change the messages processing them
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-01-10 12:56:25 +00:00
Frediano Ziglio
e03d347850 build: Remove unneeded library from linking
GetFileVersion* functions are not used.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-16 10:22:13 +00:00
Frediano Ziglio
125387b286 build: Install binaries in CMake
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-16 08:29:02 +00:00
Frediano Ziglio
85fc0b5482 vdservice: Print error on standard error, not standard output
Error stream should be used for error reporting, not output one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-12 21:35:58 +00:00
Frediano Ziglio
725141836a Remove Visual Studio project files
These project files were not correctly tested and updated for a
while.
Now that CMake is present it can be used to generate proper
updated Visual Studio projects instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-11 10:03:42 +00:00
Frediano Ziglio
981b5f0dd1 build: Do not generate CMake config.h in source directory
Allows to build out-of-tree and have a clean working directory.
Autoconf used to work with out-of-tree and "config.h" in the
build directory as a "common" directory in the build directory
was created, so including "../config.h" in version.rc and having
"-I $(top_builddir)/common" used to work.
CMake does not create "common" under the build directory so the
"../config.h" inclusion fails.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
d59123bdee ci: Add testing to CMake
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
3b5f0929c2 build: Generate config.h from CMake
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
266b67e2a7 ci: Integrate with AppVeyor
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
9a36133b85 build: Make sure to use multi-thread library for MSVC
We want to have self-contained executables so link to the static
version of Microsoft CRT, not the DLL ones.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
437ebd11eb build: Generate PDB files for Release configuration
This will make debugging and error reporting easier.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
218d89e6db build: Allows to easily compile using vcpkg and Visual Studio
Add support for MSVC to CMake files.
This settings assume you are using vcpkg to build libpng.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
3995a87476 build: Base CMake support
Although for other projects we started moving to Meson instead of
Autoconf add support for CMake for Windows agent.
Windows has more support for CMake than for Meson, there are
many tools (like Visual Studio, NuGet and vcpkg) and libraries
(like libz and libpng that we use here) that support CMake instead
of Meson.
This will also make easier to add automatic builds using Microsoft
tools.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Frediano Ziglio
7aa46954fd vdlog: Fix compatibility with MSVC
_wstat64 documentation states that we should include sys/types.h
and sys/stat.h.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:52 +00:00
Uri Lublin
1da442ad73 file-xfer: handle_start: use snprintf instead of sprintf_s
When building with older mingw, sprintf_s does not
always work as expected, but snprintf does.

Also it's more consistent in the file.

Note that when building with VS, snprintf becomes sprintf_s

Related: rhbz#1410181

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-06 09:42:39 +00:00
Frediano Ziglio
dc185029ff vdcommon: Do not use GetVersionEx to get Windows version
GetVersionEx was deprecated by Microsoft in favour of utilities
in versionhelpers.h.
The new function returns the same results as:
- GetVersionEx returns maximum 6.2 version and also 6.0 version
  is Vista, not Windows 7 so SYS_VER_WIN_7_CLASS was returned
  for all system from Windows Vista;
- We don't support version earlier than Windows XP and no Windows
  versions had version >= 5.2 and < 6.0 so SYS_VER_WIN_XP_CLASS
  was returned from Windows XP;
- we don't support any system before Windows XP.

Tested under Windows XP, 7 and 10.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-03 17:43:17 +00:00
Frediano Ziglio
615cd463e0 vdlog: Use _wstat64 instead of GetFileSize
This has different advantages:
- code is shorter and more readable;
- does not need to open the file and close;
- works on files bigger than 4gb.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-11-21 14:48:32 +00:00
Frediano Ziglio
1dd3f3586a Add a test for filter_url function
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18 10:30:14 +00:00
Frediano Ziglio
9207d821d2 file_xfer: Open Download directory after a file transfer is finished
Have the same behaviour of Linux machines.
The directory is not opened again and again, only is not already
opened.
This is done checking the directory opened in explorer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-18 10:30:14 +00:00
Frediano Ziglio
8064ae397a file_xfer: Save files in Downloads directory
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-07 16:13:52 +00:00
Frediano Ziglio
5fbeb1af4e file_xfer: Separate code to get download directory location
Allows to reuse code to get download directory.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-07 16:12:35 +00:00
Frediano Ziglio
7a7c3b22e2 display_configuration: Define WINVER to avoid some declaration
Some declarations are available in MingW only defining a more recent
version of WINVER. Set WINVER to 0x0601 (Windows 7) to enable these
definitions.
This allows to clean some files.
The definition were already available in Fedora 22.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-06 09:24:30 +00:00
Yuri Benditovich
66d44f914c win32/vd_agent: Optionally disable installation of x86 MSI on x64 system
Currently the MSI built for x86 system can be easily installed
on x64 system. When the script is processed by WIX this can be
prevented by passing '-dNoWOW=yes' to the WIX-candle.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 14:56:02 +01:00
Yuri Benditovich
d8894046f8 win32/vd_agent: Customize MSI product name and install location
Customize these properties of WIX script during build under
WIXL or Windows.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 14:56:00 +01:00
Yuri Benditovich
886b9450a5 win32/vd_agent: Fix WIX error on .wxs script
Allows the same WIXL script to be used for WIX on Windows.
WIX raises error if Win64 property is not set for x64 MSI.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-10-18 14:55:57 +01:00
Frediano Ziglio
4d4977611f Remove some unused definitions
_ftime_s, vdagent_strcat_s and vdagent_strcpy_s are not used.
Code is using different string functions.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-04-30 09:22:11 +01:00