Commit Graph

1359 Commits

Author SHA1 Message Date
Daniel P. Berrange
e71cb83680 Ensure config.h is the first include in the file
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:34 +01:00
Daniel P. Berrange
f056a53b99 Add a few more syntax-check exemptions
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:32 +01:00
Daniel P. Berrange
8646341983 Add recent new committers to AUTHORS file / mailmap
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:29 +01:00
Daniel P. Berrange
d986fb466b Enable many more compiler warnings
* m4/manywarnings.m4m, m4/warnings.m4: Import GNULIB warnings
  modules
* m4/spice-compile-warnings.m4: Define SPICE_COMPILE_WARNINGS
* configure.ac: Replace compile warning check with a call to
  SPICE_COMPILE_WARNINGS
* client/Makefile.am: Use WARN_CXXFLAGS instead of WARN_CFLAGS

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:25 +01:00
Daniel P. Berrange
39565707a9 Make some int->pointer casts explicit
Tell the compiler that was really do intend to cast from int
to pointer, to prevent warnings about implicit casts

* server/tests/test_display_base.c: Add explicit casts

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:49:25 +01:00
Daniel P. Berrange
e1633c65cc Fix broken -I../common to be -I../spice-common in client
* Makefile.am: s/common/spice-common/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
7af613362a VSCMsgHeader.reader_id is unsigned, so don't check for >= 0
* server/smartcard.c: Fix assertion to not check for >= 0 on
  unsigned variable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
84c7a95c22 Avoid jumping across variables declarations with initializers
If a 'goto' statement jumps across a variable declaration
which also has an initializer, the variable is in an undefined
state. Splitting the the declaration & initialization doesn't
change that, but the compiler can at least now detect use of
the unintialized variable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
3be7df0980 Convert cases of () to (void)
* server/reds.c, server/smartcard.c: s/()/(void)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
93d8ca8191 Remove 2 *MB* stack frame in red_worker_main
The red_worker_main method allocates a RedWorker struct instance
on the stack. This struct is a full 2 MB in size which is not
at all resonable to allocate on the stack.

* server/red_worker.c: Move RedWorker struct to the heap

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
eeb2b65a7d Mark some variables as volatile
When using setjmp/longjmp the state of local variables can be
undefined in certain scenarios:

[quote man(longjmp)]
       The values of automatic variables are unspecified  after  a
       call to longjmp() if they meet all the following criteria:

       ·  they are local to the function that made the correspond‐
          ing setjmp(3) call;

       ·  their values are changed between the calls to  setjmp(3)
          and longjmp(); and

       ·  they are not declared as volatile.
[/quote]

* server/red_worker.c: Mark some vars as volatile

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
456634a63e Mark functions which never return control
* client/red_channel.cpp:  AbortTrigger::on_event can't return
  given its current impl
* server/red_worker.c: red_worker_main can't return

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:15 +01:00
Daniel P. Berrange
6a8b7585e2 Fix multiple printf format problems
All printf var-args style methods should be annotation with
their format. All format strings must be const strings.

* client/application.cpp, client/cmd_line_parser.cpp,
  client/hot_keys.cpp: Avoid non-const format
* client/client_net_socket.cpp: Fix broken format specifier
* client/red_peer.cpp: Fix missing format specifier
* client/platform.h: Add SPICE_GNUC_PRINTF annotation to term_printf
* client/utils.h: Add SPICE_GNUC_PRINTF annotation to string_printf
* server/glz_encoder_config.h, server/red_worker.c: Add
  SPICE_GNUC_PRINTF annotation to warning callbacks

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:42:11 +01:00
Daniel P. Berrange
832a98800d Fix const-ness violations
* server/red_worker.c: Add missing const for return type
* server/reds.c: Static strings must be declared const

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:40:18 +01:00
Daniel P. Berrange
e139521928 Don't do arithmetic on void * type, use uint8_t instead
Arithmetic on void * types is non-portable & trivially avoided

* server/dispatcher.c: Use uint8_t for arithmetic

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25 09:40:18 +01:00
Alon Levy
1871295c07 spice-common: update submodule to verify_subject MSVC++ fix 2012-04-18 17:57:00 +03:00
Alon Levy
34101510ee spice-common: update submodule 2012-04-18 17:00:57 +03:00
Alon Levy
8a6307c65a update spice-common for MSVC++ build fixes 2012-04-18 16:04:36 +03:00
Aric Stewart
b87ef5170d update visual studio project file
Note, there may be line-ending issues here is we are not careful.  This file is a msdos formatted file.

There was some inconsistencies in those line-ending that I have normalized.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
2012-04-18 16:01:27 +03:00
Alon Levy
42758228fc client/windows/redc.vcproj: switch to unix EOL (dos2unix) 2012-04-18 16:00:17 +03:00
Aric Stewart
962f239159 Update win32 generate(1).bat files to match modern usage
This involves:
 generating .c instead of .cpp files
 Not including "common.h"
 Standardizing some parameters

Signed-off-by: Aric Stewart <aric@codeweavers.com>
2012-04-18 14:06:04 +03:00
Aric Stewart
4aca52309c we do not need afxres.h included in redc.rc
It is not an MFC project so simply including windef.h is better and
allows for compiling with the Express editions of Visual Studio.
2012-04-18 14:05:50 +03:00
Michael Tokarev
351fe52ca7 fix error-path return in snd_set_record_peer()
The error_{1,2} labels in this functions are backwards.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-04-18 11:30:14 +03:00
Aric Stewart
197620e43a Copy getopt.h from old common/win/my_getopt-1.5/my_getopt
This patch completes the copy from
4d8f39020a which missed this file.
2012-04-17 10:27:17 +03:00
Aric Stewart
3cd2f843b5 update windows client generate.bat and generate1.bat
the python script is now in spice-common and client_marshallers.h needs
to be included instead of marshallers.h
2012-04-17 10:24:19 +03:00
Alon Levy
2ec2dbc78a server: allow failure in getvirt
This patch changed getvirt to continue working even if spice_critical
doesn't abort (i.e. SPICE_ABORT_LEVEL != -1). This is in preparation to
make getvirt not abort at all. The reason is that getvirt is run on
guest provided memory, so a bad driver can crash the vm.
2012-04-05 18:28:49 +03:00
Christophe Fergeau
2439c0dc90 Replace sprintf with snprintf use
The hotkey parser was generating a string with sprintf and data it got
from the controller socket (ie data which can have an arbitrary
length). Using sprintf there is a bad idea, replace it with snprintf.
2012-04-02 12:14:55 +02:00
Marc-André Lureau
8cd92109d4 spice-common: update to fix quic-encode warnings 2012-03-28 14:04:14 +02:00
Alon Levy
5dd5b70223 server: export spice_server_is_server_mouse predicate
To be used by qemu query-spice / info spice commands.
2012-03-26 14:41:03 +02:00
Marc-André Lureau
3fc870ad55 Remove files moved to spice-common 2012-03-26 02:40:17 +02:00
Marc-André Lureau
4d8f39020a Copy common/win/my_getopt-1.5/my_getopt client/windows 2012-03-25 19:00:00 +02:00
Marc-André Lureau
b34fd7432d Use the spice-common logging functions
It will abort by default for critical level messages. That behaviour
can be tuned at runtime.
2012-03-25 19:00:00 +02:00
Marc-André Lureau
359fc1cb5d Use the spice-common submodule
This patch will replace the common/ directory with the spice-common
project. It is for now a simple project subdirectory shared with
spice-gtk, but the goal is to make it a proper library later on.

With this change, the spice-server build is broken. The following
commits fix the build, and have been seperated to ease the review.

v2
- moves all the generated marshallers to spice-common library
- don't attempt to fix windows VS build, which should somehow be
  splitted with spice-common (or built from tarball only to avoid
  generation tools/libs deps)
v3
- uses libspice-common-client
- fix a mutex.h inclusion reported by Alon
2012-03-25 18:59:10 +02:00
Marc-André Lureau
4df135c858 sasl: small refactoring, check memcheck != NULL 2012-03-23 13:10:54 +01:00
Marc-André Lureau
d4ba4ee690 Use spice_strdup() to avoid crashing on NULL
qemu can call spice_server_set_name(s, NULL) when the name is not
given. Let's not crash in this case
2012-03-23 13:10:54 +01:00
Alon Levy
a7d3f1de82 server/tests: add resolution changes tester 2012-03-22 11:18:37 +02:00
Alon Levy
a6f9797c79 server/tests/test_display_base: add Command
add parameters to the commands used for display tests.
2012-03-22 11:18:37 +02:00
Alon Levy
c36bf55971 server/tests/test_display_base: remove 64bit arch assumptions 2012-03-21 17:58:25 +02:00
Alon Levy
aef7eaf9bb server/red_memslots: don't assume 64 bit environment
assumption that unsigned long == QXLPHYSICAL causes get_virt to compute
the wrong slot. Fix by replacing addr variables to be of type
QXLPHYSICAL.
2012-03-21 17:58:25 +02:00
Alon Levy
07f55e49f5 server/red_worker: fix for case where ASSERT is compiled out 2012-03-21 17:58:25 +02:00
Alon Levy
5391736c29 server/red_memslots: use QXLPHYSICAL for addresses
Cannot assume unsigned long == QXLPHYSICAL, not true for 32 bit
architectures.
2012-03-21 17:57:32 +02:00
Alon Levy
f360273614 server/red_memslots: drop two unused functions
cb_get_virt and cb_validate_virt have disappeared a long time ago,
not needed since:

commit 5ac88aa79f
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Thu Jul 1 17:55:33 2010 +0200

    Properly parse QXLImage to the new-world SpiceImage

    SpiceImage now replaces RedImage and has all image types in it.
    All image data are now chunked (and as such not copied when demarshalling).
2012-03-21 17:56:39 +02:00
Christophe Fergeau
64e0974114 Don't truncate SPICE_FOREIGN_MENU_SOCKET
When we get the socket name for the foreign menu socket from
an environment variable, we cannot make assumptions about its length.
Currently, we are strncpying to a 50 byte buffer which is easily
too small.
2012-03-20 16:53:50 +01:00
Christophe Fergeau
3d452a312b Don't limit spice controller socket name to 50 chars
The spice controller socket name used to be hardcoded to
/tmp/SpiceController-%lu.uds and generated using snprintf. A 50 bytes
buffer was enough for that, but this was changed in commit 79fffbf95
because this was predictable and allowed other users on the system
to sniff the browser/client communication. spicec now uses the value
of the environment SPICE_XPI_SOCKET as the name of the socket to use.
However, since the name that is used is no longer generated by spicec,
no assumption can be made about its size. Currently, the socket is
created inside the user home directory, which means that if the
user name is too long, spicec will not be able to read the controller
socket name.
This commit directly uses the string from getenv as he name of the
controller socket (on Linux) instead of limiting its size to 50 characters,
which should fix this issue.
This fixes rhbz #804561
2012-03-20 16:53:40 +01:00
Christophe Fergeau
01c6f4d2c6 Remove unused Canvas members
The various Canvas have _max and _base variables which are not
used, better to remove them.
2012-03-20 16:53:35 +01:00
Alon Levy
910a3f8419 server/red_worker: don't typedef SpiceWatch twice
First defined in spice.h, fixes build failure with gcc 4.4.6
2012-03-20 15:39:02 +02:00
Hans de Goede
914e50814f red_worker: Check for NULL watches
If we run out of watches slots, we return NULL from watch_add, which
means that the other watch_foo functions may get called with a NULL
parameter, protect them against this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-13 16:41:02 +01:00
Nahum Shalman
42ac95e125 server: remove superfluous check
no need to duplicate the check that the fd isn't -1
2012-03-12 22:58:49 +02:00
Nahum Shalman
198ffb92d4 server: listen on a pre-opened file descriptor
Allow applications to pre-open a file descriptor and have spice listen
on it.

Thanks to Daniel Berrange for his comments
2012-03-12 12:33:20 +01:00
Nahum Shalman
20c7323c9e server: don't fail on ENOPROTOOPT from setsockopt
If we allow listening on arbitrary sockets like unix sockets,
we can get ENOPROTOOPT errors from setsockopt calls that set TCP
specific options.  This should be allowed to happen.
2012-03-12 12:32:58 +01:00