[Spice-commits] 2 commits - server/smartcard.c server/smartcard-channel-client.c subprojects/spice-common

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 8 15:04:25 UTC 2019


 server/smartcard-channel-client.c |    7 +++----
 server/smartcard.c                |    1 +
 subprojects/spice-common          |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit bae2d1f00fb361ee8dd3568e3fd79cbf10184979
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sat Oct 5 21:35:31 2019 +0100

    smartcard: Use generated parse for messages
    
    The generated code handle possible endianess mismatch and check
    for message format.
    The copy back to "write_buf" allows to use that buffer to send
    data back to device.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index 08af49df..f71b6523 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -274,17 +274,15 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
                                              uint32_t size,
                                              void *message)
 {
-    uint8_t *msg = message;
     VSCMsgHeader* vheader = message;
     SmartCardChannelClient *scc = SMARTCARD_CHANNEL_CLIENT(rcc);
 
     if (type != SPICE_MSGC_SMARTCARD_DATA) {
         /* Handles seamless migration protocol. Also handles ack's,
          * spicy sends them while spicec does not */
-        return red_channel_client_handle_message(rcc, type, size, msg);
+        return red_channel_client_handle_message(rcc, type, size, message);
     }
 
-    spice_assert(size == vheader->length + sizeof(VSCMsgHeader));
     switch (vheader->type) {
         case VSC_ReaderAdd:
             smartcard_channel_client_add_reader(scc);
@@ -315,7 +313,8 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
                             vheader->reader_id, vheader->type, vheader->length);
         return FALSE;
     }
-    spice_assert(scc->priv->write_buf->buf == msg);
+    spice_assert(scc->priv->write_buf->buf_size >= size);
+    memcpy(scc->priv->write_buf->buf, message, size);
     smartcard_channel_client_write_to_reader(scc);
 
     return TRUE;
diff --git a/server/smartcard.c b/server/smartcard.c
index 17794b06..3f51f529 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -547,6 +547,7 @@ red_smartcard_channel_class_init(RedSmartcardChannelClass *klass)
 
     object_class->constructed = red_smartcard_channel_constructed;
 
+    channel_class->parser = spice_get_client_channel_parser(SPICE_CHANNEL_SMARTCARD, NULL);
     channel_class->handle_message = smartcard_channel_client_handle_message,
 
     channel_class->send_item = smartcard_channel_send_item;
commit 5d2b204e48bb4349f281fc64e97d73c0b9531cb2
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sat Oct 5 20:53:55 2019 +0100

    Update spice-common submodule
    
    This brings in the following changes:
    
    Frediano Ziglio (1):
          proto: Demarshal Smartcard data field
    
    Kevin Pouget (1):
          common/recorder.h: do not complain on unused (dummy) recorders
    
    This is in preparation to use the generated code for Smartcard
    (currently not used so won't create regressions).
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/subprojects/spice-common b/subprojects/spice-common
index 4727c19d..62b44b30 160000
--- a/subprojects/spice-common
+++ b/subprojects/spice-common
@@ -1 +1 @@
-Subproject commit 4727c19d36b33071928500adaa832ecef6bdd942
+Subproject commit 62b44b3073d337c92123e0fff9c5f6683bfdb4ff


More information about the Spice-commits mailing list