Commit Graph

238 Commits

Author SHA1 Message Date
Marc-André Lureau
e3f6941895 Bypass certicate verification failure if PUBKEY check only
During switch-host migration, only PUBKEY verification is required.
Couldn't it just load the certificate again for the new session?
perhaps, but that's they way the code used to work until I introduced
a regression in spice commit d46f9d3f4e006d3bca9b99fac25169b17e7ac803.
2012-03-30 14:10:00 +02:00
Marc-André Lureau
a0339261d4 ssl-verify: improve logging report in case of errors
Use the log.h system, and report a bit more information in the debug level
2012-03-30 14:10:00 +02:00
Marc-André Lureau
1b41d15a99 Fix harmless warnings in quic_encode()
The quic code has been changed recently this way:

-    ASSERT(encoder->usr, line);
+    if (line == NULL) {
+        spice_warn_if_reached();
+        return QUIC_ERROR;
+    }

It appears that the only caller of quic_encode() gives a NULL line and
rely on the more_lines() callback to return new lines instead.

Adjust the code accordingly, adding a few more checks to verify the
caller gives/returns correct values.
2012-03-28 13:30:18 +02:00
Marc-André Lureau
fb24e4e28b build-sys: split client marshallers in seperate lib 2012-03-25 18:38:09 +02:00
Marc-André Lureau
c1e4e1be63 build-sys: make it a seperately buildable spice-common library
- autotoolize
- fix headers inclusion
- generate gitignores
- workaround serverSMARTCARD support with dirty hack...
2012-03-22 20:21:05 +01:00
Marc-André Lureau
f7af6264ea Add SPICE_ATTR_NORETURN and use it for a few functions 2012-03-20 15:30:24 +01:00
Marc-André Lureau
a1df67b3c5 Fix build with SPICE_DISABLE_ABORT 2012-03-20 15:30:24 +01:00
Marc-André Lureau
13fb823795 Remove need for SPICE_CANVAS_INTERNAL
Why is this useful?
2012-03-20 15:30:24 +01:00
Marc-André Lureau
61c30fcdcf fix void* arithmetic
marshaller.c:528:50: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
2012-03-20 15:30:24 +01:00
Marc-André Lureau
f87bb23ad2 build: replace INCLUDES with AM_CPPFLAGS
Fix warning `INCLUDES' is the old name for `AM_CPPFLAGS' (or `*_CPPFLAGS')
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
fbb6b9984a Add missing includes & make some functions static
A number of functions were used without prior declaration. In
some cases this was due to missing include files. In other cases
the functions should have just been static.

Ideally this would allow -Wmissing-declarations to be enabled, but
the files generated by spice_codegen.py will still trip up on this.
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
985ec9d6ec Add printf format annotations to all '...' functions
To allow the compile to detect incorrect printf formats, any
var-args function should have a format annotation

* common/macros.h: Helper to define ATTR_PRINTF for code
  which can't depend on glib
* common/canvas_base.c, common/lz.h, common/macros.h: Annotate
  some var-args methods
2012-03-20 15:30:24 +01:00
Daniel P. Berrange
9f7d6175e7 Fix some integer range checks which always evaluate false
There are some integer range checks which always evaluate false
due to use of unsigned integer types. One of these would prevent
detection of encoding errors from celt. The others are simply
no-ops.

* common/pixman_utils.c: SpiceROP is an enum & thus unsigned
2012-03-20 15:30:23 +01:00
Daniel P. Berrange
3bc7d096b6 Avoid warnings about empty conditional statement bodies
Add extra {} braces around if/else statements which only
call SPICE_DEBUG to avoid:

../common/ssl_verify.c: In function 'verify_pubkey':
../common/ssl_verify.c:87:50: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_hostname':
../common/ssl_verify.c:254:53: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
../common/ssl_verify.c: In function 'verify_subject':
../common/ssl_verify.c:381:41: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
2012-03-20 15:30:23 +01:00
Marc-André Lureau
0a96fe9364 build: remove 'win' directory
Let's use the only included file directly instead.
2012-03-20 15:30:23 +01:00
Christophe Fergeau
4feaffad8e messages.h: add smartcard bits 2012-03-20 15:30:23 +01:00
Marc-André Lureau
508547c100 Add client_marshallers.h client_demarshallers.h from spice-gtk
spice-gtk uses a more up to date version of client/marshallers.h and client/demarshallers.h
2012-03-20 15:30:23 +01:00
Marc-André Lureau
c4482c7ff2 Use SPICE_{BEGIN,END}_DECLS 2012-03-20 15:30:23 +01:00
Christophe Fergeau
e800e51d4e add const to arrays in marshalling functions 2012-03-20 15:30:23 +01:00
Christophe Fergeau
c968e76f96 ssl_verify: include <string.h>
ssl_verify.c is using memcmp which comes from string.h, this was
breaking compilation with -Werror -Wall on Mac OS X
2012-03-20 15:30:23 +01:00
Marc-André Lureau
3e4b2571a2 ssl_verify: comment X509_NAME undef 2012-03-20 15:30:23 +01:00
Marc-André Lureau
c1403ee6bf Use a log handler to modify abort() behaviour
Be more library friendly, by not aborting in library errors.

spice_common now includes a proper log handler that will abort by
default when reaching a warning.

SPICE_ABORT_LEVEL can be changed to modify run-time abort level.

SPICE_DEBUG_LEVEL can be changed to be more verbose. By default, only
log level more importants than WARNING.

Only memory-related functions are allowed to abort(), since they are
not recoverable errors in the library.
2012-03-20 15:30:23 +01:00
Marc-André Lureau
bb133148d8 update gitignore 2012-03-20 15:30:23 +01:00
Marc-André Lureau
cf705650d4 common: remove unnecessary outdated c++ debug 2012-03-20 15:30:23 +01:00
Marc-André Lureau
124f767b94 common: ring.h should include stddef for NULL usage 2012-03-20 15:30:05 +01:00
Marc-André Lureau
1a9f61dd17 Send name & uuid to capable clients
Add spice_server_set_name() and spice_server_set_uuid() that allows
the client to identify a Spice server (useful to associate settings
with a particular server)

The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent
to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
2012-03-20 15:25:56 +01:00
Christophe Fergeau
5d02123499 mingw: workaround weird openssl build failure
If X509_NAME isn't undefined before including x509v3.h, very
weird compilation error occurs. It seems to be caused by duplicate
definitions for this symbols coming from wincrypto.h
2012-03-20 15:25:56 +01:00
Christophe Fergeau
ea9e91cd8d mingw: don't try to redefine alloca
mingw already has a #define alloca __builtin_alloca so trying to
redefine it triggers a warning.
2012-03-20 15:25:56 +01:00
Christophe Fergeau
a107b62a74 mingw: use uintptr_t when converting a pointer to an int
win64 uses 32 bit long, so we cannot use a long to hold a 64 bit
pointer. Thankfully, there's a [u]intptr_t type available exactly
for these uses.
2012-03-20 15:25:56 +01:00
Dan McGee
a14a8c83e0 Remove extra '\n' from red_printf() calls
red_printf() takes care of adding a newline to all messages; remove the
extra newline from all messages and macros that were doubling them up.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:56 +01:00
Dan McGee
df2dcb496e Add casts for compatibility purposes
Some non-Linux platforms return a (caddr_t *) result for the return
value of mmap(), which is very unfortunate. Add a (void *) cast to
explicitly avoid the warning when compiling with -Werror.

For the IO vector related stuff, signed vs. unsigned comes into play so
adding a (void *) cast here is technically correct for all platforms.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:55 +01:00
Dan McGee
e571bd02c9 Update .gitignore with a few more generated files
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
95f2f77839 Remove trailing whitespace from end of lines 2012-03-20 15:25:55 +01:00
Daniel P. Berrange
14ca077df3 Add missing includes of config.h
Not all files were including config.h
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
4930ef7239 Remove unused backup file
The common/glc.c.save file appears to be a obsolete copy of
glc.c
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
f83432a685 Remove trailing blank lines
Remove any blank lines at the end of all source files
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
457892cb9f Fix up copyright decl to always use 'Copyright (C) Red Hat, Inc.'
A couple of files were missing '(C)' in the copyright header
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
6142b84cd4 Remove casts from void * with xrealloc() calls
The xrealloc() function returns void*, so the return value
never needs to be cast
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
4a9f7971fc Remove useless if() before free()
The free() function allows NULL to be passed in, so any
code which puts a if() before free() is wasting time
2012-03-20 15:25:55 +01:00
Daniel P. Berrange
bcdf929c79 Death to all TABs
Source files should all use spaces instead of tabs for
indentation. Update the few files not already in
compliance
2012-03-20 15:25:55 +01:00
Alon Levy
a2e0db03a9 common/ssl_verify: special case to WIN32 that isn't MINGW32 2012-03-20 15:25:55 +01:00
Alon Levy
533358acf5 common/bitops: mingw32: reorder so __GNUC__ define is checked first 2012-03-20 15:25:55 +01:00
Alon Levy
db2057fa4c common/backtrace: for mingw32 no pipe/wait_pid, just disable 2012-03-20 15:25:55 +01:00
Alon Levy
a2cc577747 client/windows: fix several assigned but not used errors 2012-03-20 15:25:54 +01:00
Alon Levy
e8efd344c0 client/common: mingw32: workaround HAVE_STDLIB_H redefined in jconfig.h 2012-03-20 15:25:54 +01:00
Alon Levy
5846dec251 server: add prefix argument to red_printf_debug
printed before function name. No central location for prefixes.
Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
2012-03-20 15:25:54 +01:00
Alon Levy
cc30c6d833 common/spice_common.h: red_printf_debug: fix wrong sign 2012-03-20 15:25:54 +01:00
Yonit Halperin
9cf6d39b36 server,proto: tell the clients to connect to the migration target before migraton starts
(1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect
    (to all the clients that support it)
(2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) from all the relevant clients,
    or a timeout, in order to complete client_migrate_info monitor command
(cherry picked from commit 5560c56ef05c74da5e0e0825dc1f134019593cad branch 0.8;
 Was modified to support the separation of main channel from reds, and multiple clients)

Conflicts:

	server/reds.c
2012-03-20 15:25:54 +01:00
Christophe Fergeau
264ccc73f1 server: fix function prototypes
Several functions in server/ were not specifying an argument list,
ie they were declared as void foo(); When compiling with
-Wstrict-prototypes, this leads to:
test_playback.c:93:5: erreur: function declaration isn’t a prototype
[-Werror=strict-prototypes]
2012-03-20 15:25:54 +01:00
Christophe Fergeau
6130d4602d add C++ guards to backtrace.h
Without these, spice_backtrace() can't be used from the C++ client
code.
2012-03-20 15:25:54 +01:00