[Spice-commits] Branch '0.8' - 7 commits - client/cmd_line_parser.cpp client/inputs_channel.cpp client/inputs_channel.h client/red_peer.cpp common/canvas_base.c configure.ac server/red_worker.c

Alon Levy alon at kemper.freedesktop.org
Tue Jan 18 05:12:49 PST 2011


 client/cmd_line_parser.cpp |    7 +++++--
 client/inputs_channel.cpp  |   14 +++++++++++++-
 client/inputs_channel.h    |    2 ++
 client/red_peer.cpp        |   10 +++++-----
 common/canvas_base.c       |    2 +-
 configure.ac               |    7 +++----
 server/red_worker.c        |    5 +++--
 7 files changed, 32 insertions(+), 15 deletions(-)

New commits:
commit d51e213eab8c2a65525557f9ab0cf3a13ae196d5
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Jan 17 20:28:54 2011 +0200

    client: log subject-host mismatch, and raise ssl warnings to errors

diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index 88fc9ad..63b66bb 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -365,7 +365,7 @@ bool RedPeer::verify_subject(X509* cert, const HostAuthOptions::CertFieldValueLi
     }
 
     if (X509_NAME_entry_count(cert_subject) != subject.size()) {
-        DBG(0, "subject mismatch: #entries cert=%d, input=%d",
+        LOG_ERROR("subject mismatch: #entries cert=%d, input=%d",
             X509_NAME_entry_count(cert_subject), subject.size());
         return false;
     }
@@ -396,7 +396,7 @@ bool RedPeer::verify_subject(X509* cert, const HostAuthOptions::CertFieldValueLi
          DBG(0, "subjects match");
          return true;
     } else {
-         DBG(0, "subjects mismatch");
+         LOG_ERROR("host-subject mismatch");
          return false;
     }
 }
@@ -505,7 +505,7 @@ void RedPeer::connect_secure(const ConnectionOptions& options, const char* host)
                     auth_data.info.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_PUBKEY;
                 }
                 else {
-                    LOG_WARN("SSL_CTX_load_verify_locations failed CA_file=%s", CA_file.c_str());
+                    LOG_ERROR("SSL_CTX_load_verify_locations failed CA_file=%s", CA_file.c_str());
                     ssl_error();
                 }
             }
@@ -517,7 +517,7 @@ void RedPeer::connect_secure(const ConnectionOptions& options, const char* host)
 
         return_code = SSL_CTX_set_cipher_list(_ctx, options.ciphers.c_str());
         if (return_code != 1) {
-            LOG_WARN("SSL_CTX_set_cipher_list failed, ciphers=%s", options.ciphers.c_str());
+            LOG_ERROR("SSL_CTX_set_cipher_list failed, ciphers=%s", options.ciphers.c_str());
             ssl_error();
         }
 
@@ -537,7 +537,7 @@ void RedPeer::connect_secure(const ConnectionOptions& options, const char* host)
         return_code = SSL_connect(_ssl);
         if (return_code <= 0) {
             int ssl_error_code = SSL_get_error(_ssl, return_code);
-            LOG_WARN("failed to connect w/SSL, ssl_error %s",
+            LOG_ERROR("failed to connect w/SSL, ssl_error %s",
                      ERR_error_string(ssl_error_code, NULL));
             ssl_error();
         }
commit e5bfed8194851cf9b096bf1c908e6d2c0f2e4472
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Nov 1 23:45:43 2010 +0100

    client inputs: stop blinking keyboard when out of focus
    
    We could introduce another boolean to prevent changes, or just reuse
    _active_modifiers_event = true to prevent further update.
    
    Additionaly this patch restore the keyboard state when focusing out,
    which is fine when dealing with full remote desktop, but should be
    reconsidered if/when SPICE supports remote windows managed by client
    window manager for instance, imho.

diff --git a/client/inputs_channel.cpp b/client/inputs_channel.cpp
index 9ff5479..c527580 100644
--- a/client/inputs_channel.cpp
+++ b/client/inputs_channel.cpp
@@ -404,10 +404,14 @@ void InputsChannel::set_local_modifiers()
 
 void InputsChannel::on_focus_in()
 {
+    Lock lock(_update_modifiers_lock);
+    _active_modifiers_event = false;
+    _on_focus_modifiers = Platform::get_keyboard_lock_modifiers();
+
 #ifdef SYNC_REMOTE_MODIFIERS
     Message* message = new Message(SPICE_MSGC_INPUTS_KEY_MODIFIERS);
     SpiceMsgcKeyModifiers modifiers;
-    modifiers.modifiers = Platform::get_keyboard_lock_modifiers();
+    modifiers.modifiers = _on_focus_modifiers;
     _marshallers->msgc_inputs_key_modifiers(message->marshaller(), &modifiers);
     post_message(message);
 #else
@@ -415,6 +419,14 @@ void InputsChannel::on_focus_in()
 #endif
 }
 
+void InputsChannel::on_focus_out()
+{
+    Lock lock(_update_modifiers_lock);
+    _active_modifiers_event = true;
+    _modifiers = _on_focus_modifiers;
+    set_local_modifiers();
+}
+
 void InputsChannel::init_scan_code(int index)
 {
     ASSERT((index & 0x80) == 0);
diff --git a/client/inputs_channel.h b/client/inputs_channel.h
index 00e185c..254ed45 100644
--- a/client/inputs_channel.h
+++ b/client/inputs_channel.h
@@ -34,6 +34,7 @@ public:
     virtual void on_key_down(RedKey key);
     virtual void on_key_up(RedKey key);
     virtual void on_focus_in();
+    virtual void on_focus_out();
 
     void on_mouse_position(int x, int y, int buttons_state, int display_id);
 
@@ -72,6 +73,7 @@ private:
     bool _active_motion;
     int _motion_count;
     uint32_t _modifiers;
+    uint32_t _on_focus_modifiers;
     Mutex _update_modifiers_lock;
     bool _active_modifiers_event;
 
commit f0e27a2636361bc0336cdebd69a44ecde2752ca2
Author: Alon Levy <alevy at redhat.com>
Date:   Wed Jan 5 15:31:46 2011 +0200

    common, canvas_get_jpeg_alpha: let top_down be any value
    
    Allow top_down flag to have any value, only ASSERT it is positive
    when needs to be positive and zero otherwise. Allows older server
    bug of sending 4 instead of 1 in top down flag to not affect newer
    clients (previous patch fixes server).

diff --git a/common/canvas_base.c b/common/canvas_base.c
index c2763bc..0b7ef74 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -612,7 +612,7 @@ static pixman_image_t *canvas_get_jpeg_alpha(CanvasBase *canvas,
                     &lz_alpha_width, &lz_alpha_height, &n_comp_pixels,
                     &lz_alpha_top_down, NULL);
     ASSERT(lz_alpha_type == LZ_IMAGE_TYPE_XXXA);
-    ASSERT(lz_alpha_top_down == alpha_top_down);
+    ASSERT(!!lz_alpha_top_down == !!alpha_top_down);
     ASSERT(lz_alpha_width == width);
     ASSERT(lz_alpha_height == height);
     ASSERT(n_comp_pixels == width * height);
commit 2a9f35a98f4dabd8e1e0412d498907df3a04f71a
Author: Alon Levy <alevy at redhat.com>
Date:   Tue Jan 4 18:11:25 2011 +0200

    server/red_worker: use 1, not 4 when lz_encoding a top down image

diff --git a/server/red_worker.c b/server/red_worker.c
index 937e0aa..dc7bc9e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -5439,7 +5439,8 @@ static inline int red_lz_compress_image(DisplayChannel *display_channel,
     lz_data->data.u.lines_data.reverse = 0;
     lz_data->usr.more_lines = lz_usr_more_lines;
 
-    size = lz_encode(lz, type, src->x, src->y, (src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN),
+    size = lz_encode(lz, type, src->x, src->y,
+                     !!(src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN),
                      NULL, 0, src->stride,
                      (uint8_t*)lz_data->data.bufs_head->buf,
                      sizeof(lz_data->data.bufs_head->buf));
@@ -5588,7 +5589,7 @@ static int red_jpeg_compress_image(DisplayChannel *display_channel, SpiceImage *
      lz_data->usr.more_lines = lz_usr_more_lines;
 
      alpha_lz_size = lz_encode(lz, LZ_IMAGE_TYPE_XXXA, src->x, src->y,
-                               (src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN),
+                               !!(src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN),
                                NULL, 0, src->stride,
                                lz_out_start_byte,
                                comp_head_left);
commit c002a0784ff758ddcb99ca59d7dc505ba54c1012
Author: Alon Levy <alevy at redhat.com>
Date:   Tue Jan 11 16:59:29 2011 +0200

    server: remove dep on libcacard
    
    Only the client needs this, and erronously using SPICE_REQUIRES
    results in libcacard dep in spice-server.pc, which is then dragged
    into qemu when linking, beeing used instead of the builtin libcacard.

diff --git a/configure.ac b/configure.ac
index 6b6c8c9..ed0d989 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,7 +182,6 @@ if test "x$have_smartcard" = "xyes"; then
     PKG_CHECK_MODULES(CAC_CARD, libcacard >= 0.1.0)
     SMARTCARD_LIBS="$CAC_CARD_LIBS"
     SMARTCARD_CFLAGS="$CAC_CARD_CFLAGS"
-    SPICE_REQUIRES+=" libcacard"
     AC_SUBST(SMARTCARD_LIBS)
     AC_SUBST(SMARTCARD_CFLAGS)
 fi
commit 609105a27658d0849e0e218a5f355b302c820c05
Author: Alon Levy <alevy at redhat.com>
Date:   Thu Jan 6 12:54:28 2011 +0200

    client/cmd_line_parser: fix wrong reporting of bad argument in --bla=val case
    
    We use get_opt_long, which allows non ambiguous abbreviations, but
    since we didn't like that we have code that checks for abbreviations and
    issues an error. But that code only handled separate argument and key like:
    --bla value
    and didn't handle them in the same arguemnts, like:
    --bla=value
    This patch fixes that, and gives a slightly better error report (it still
    contains the =value part though)

diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp
index a813629..7c396ba 100644
--- a/client/cmd_line_parser.cpp
+++ b/client/cmd_line_parser.cpp
@@ -346,10 +346,13 @@ int CmdLineParser::get_option(char** val)
         }
 
 #ifdef DISABLE_ABBREVIATE
-        int name_pos = (opt_obj->type == REQUIRED_ARGUMENT) ? optind - 2 : optind - 1;
+        int name_pos =
+            (opt_obj->type == REQUIRED_ARGUMENT && optarg[-1] != '=')
+            ? optind - 2
+            : optind - 1;
         std::string cmd_name(_argv[name_pos] + 2);
         if (cmd_name.find(opt_obj->name) != 0) {
-            Platform::term_printf("%s: invalid option '--%s'\n", _argv[0], cmd_name.c_str());
+            Platform::term_printf("%s: invalid abbreviated option '--%s'\n", _argv[0], cmd_name.c_str());
             return OPTION_ERROR;
         }
 #endif
commit d0fa80641daf9d49ea6590d4106c32c79b872d4e
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Jan 17 01:26:39 2011 +0200

    configure.ac: use AC_LANG_SOURCE in AC_COMPILE_IFELSE, silence remaining warnings

diff --git a/configure.ac b/configure.ac
index a9e9d2d..6b6c8c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -294,7 +294,7 @@ AC_DEFUN([SPICE_CC_TRY_FLAG], [
   spice_save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $1"
 
-  AC_COMPILE_IFELSE([ ], [spice_cc_flag=yes], [spice_cc_flag=no])
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([ ])], [spice_cc_flag=yes], [spice_cc_flag=no])
   CFLAGS="$spice_save_CFLAGS"
 
   if test "x$spice_cc_flag" = "xyes"; then
@@ -384,13 +384,13 @@ dnl -fvisibility stuff
 
 have_gcc4=no
 AC_MSG_CHECKING(for -fvisibility)
-AC_COMPILE_IFELSE([
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 #if defined(__GNUC__) && (__GNUC__ >= 4)
 #else
 error Need GCC 4.0 for visibility
 #endif
 int main () { return 0; }
-], have_gcc4=yes)
+])], have_gcc4=yes)
 
 if test "x$have_gcc4" = "xyes"; then
    VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden"


More information about the Spice-commits mailing list