[Spice-commits] src/channel-base.c src/channel-main.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 3 16:58:56 UTC 2019


 src/channel-base.c |    4 ---
 src/channel-main.c |   69 ++++++++++++++++++++++-------------------------------
 2 files changed, 29 insertions(+), 44 deletions(-)

New commits:
commit f944ad6935f12efe47f78cbde1c5e6db31442597
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Dec 17 09:07:23 2018 +0000

    More cleanup for old protocol support
    
    Support for protocol version 1 was dropped in commit f77a1d50.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/src/channel-base.c b/src/channel-base.c
index d8fe769..eb85f8a 100644
--- a/src/channel-base.c
+++ b/src/channel-base.c
@@ -163,10 +163,6 @@ spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
     if (mig->flags & SPICE_MIGRATE_NEED_FLUSH) {
         /* if peer version > 1: pushing the mark msg before all other messgages and sending it,
          * and only it */
-        if (c->peer_hdr.major_version == 1) {
-            /* iterate_write is blocking and flushing all pending write */
-            SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
-        }
         out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MIGRATE_FLUSH_MARK);
         spice_msg_out_send_internal(out);
     }
diff --git a/src/channel-main.c b/src/channel-main.c
index 4c6bc70..d902f37 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2295,47 +2295,36 @@ static gboolean migrate_connect(gpointer data)
 
     spice_session_set_migration_state(mig->session, SPICE_SESSION_MIGRATION_CONNECTING);
 
-    if ((c->peer_hdr.major_version == 1) &&
-        (c->peer_hdr.minor_version < 1)) {
-        OldRedMigrationBegin *info = (OldRedMigrationBegin *)mig->info;
-        SPICE_DEBUG("migrate_begin old %s %d %d",
-                    info->host, info->port, info->sport);
-        port = info->port;
-        sport = info->sport;
-        host = info->host;
+    SpiceMigrationDstInfo *info = mig->info;
+    SPICE_DEBUG("migrate_begin %u %s %d %d",
+                info->host_size, info->host_data, info->port, info->sport);
+    port = info->port;
+    sport = info->sport;
+    host = (char*)info->host_data;
+
+    if (c->peer_hdr.major_version == 2 && c->peer_hdr.minor_version < 1) {
+        GByteArray *pubkey = g_byte_array_new();
+
+        g_byte_array_append(pubkey, info->pub_key_data, info->pub_key_size);
+        g_object_set(mig->session,
+                     "pubkey", pubkey,
+                     "verify", SPICE_SESSION_VERIFY_PUBKEY,
+                     NULL);
+        g_byte_array_unref(pubkey);
+    } else if (info->cert_subject_size == 0 ||
+               strlen((const char*)info->cert_subject_data) == 0) {
+        /* only verify hostname if no cert subject */
+        g_object_set(mig->session, "verify", SPICE_SESSION_VERIFY_HOSTNAME, NULL);
     } else {
-        SpiceMigrationDstInfo *info = mig->info;
-        SPICE_DEBUG("migrate_begin %u %s %d %d",
-                    info->host_size, info->host_data, info->port, info->sport);
-        port = info->port;
-        sport = info->sport;
-        host = (char*)info->host_data;
-
-        if ((c->peer_hdr.major_version == 1) ||
-            (c->peer_hdr.major_version == 2 && c->peer_hdr.minor_version < 1)) {
-            GByteArray *pubkey = g_byte_array_new();
-
-            g_byte_array_append(pubkey, info->pub_key_data, info->pub_key_size);
-            g_object_set(mig->session,
-                         "pubkey", pubkey,
-                         "verify", SPICE_SESSION_VERIFY_PUBKEY,
-                         NULL);
-            g_byte_array_unref(pubkey);
-        } else if (info->cert_subject_size == 0 ||
-                   strlen((const char*)info->cert_subject_data) == 0) {
-            /* only verify hostname if no cert subject */
-            g_object_set(mig->session, "verify", SPICE_SESSION_VERIFY_HOSTNAME, NULL);
-        } else {
-            gchar *subject = g_alloca(info->cert_subject_size + 1);
-            strncpy(subject, (const char*)info->cert_subject_data, info->cert_subject_size);
-            subject[info->cert_subject_size] = '\0';
-
-            // session data are already copied
-            g_object_set(mig->session,
-                         "cert-subject", subject,
-                         "verify", SPICE_SESSION_VERIFY_SUBJECT,
-                         NULL);
-        }
+        gchar *subject = g_alloca(info->cert_subject_size + 1);
+        strncpy(subject, (const char*)info->cert_subject_data, info->cert_subject_size);
+        subject[info->cert_subject_size] = '\0';
+
+        // session data are already copied
+        g_object_set(mig->session,
+                     "cert-subject", subject,
+                     "verify", SPICE_SESSION_VERIFY_SUBJECT,
+                     NULL);
     }
 
     if (g_getenv("SPICE_MIG_HOST"))


More information about the Spice-commits mailing list