[Spice-commits] 3 commits - server/red-stream.c server/reds.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Dec 19 16:55:34 UTC 2017


 server/red-stream.c |    8 +++-----
 server/reds.c       |   12 ++++++------
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit f7ca5d4a155673bb584cec413c5a50f8da9daee4
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    red-stream: Use mechname for mechname
    
    There's no reason to copy mechname into mechlist to use mechlist
    instead of mechname.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/red-stream.c b/server/red-stream.c
index 5ddf8c54..55e2c3e0 100644
--- a/server/red-stream.c
+++ b/server/red-stream.c
@@ -886,9 +886,9 @@ RedSaslError red_sasl_handle_auth_start(RedStream *stream, AsyncReadDone read_cb
     }
 
     spice_debug("Start SASL auth with mechanism %s. Data %p (%d bytes)",
-               sasl->mechlist, clientdata, datalen);
+               sasl->mechname, clientdata, datalen);
     err = sasl_server_start(sasl->conn,
-                            sasl->mechlist,
+                            sasl->mechname,
                             clientdata,
                             datalen,
                             &serverout,
@@ -1001,9 +1001,6 @@ bool red_sasl_handle_auth_mechname(RedStream *stream, AsyncReadDone read_cb, voi
         }
     }
 
-    g_free(sasl->mechlist);
-    sasl->mechlist = g_strdup(sasl->mechname);
-
     spice_debug("Validated mechname '%s'", sasl->mechname);
 
     red_stream_async_read(stream, (uint8_t *)&sasl->len, sizeof(uint32_t),
commit a7b8ea4b7a2c9a58e46903793fea2ddb8647cd78
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    red-stream: Remove SASL "data" field leak
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/red-stream.c b/server/red-stream.c
index 45e92a57..5ddf8c54 100644
--- a/server/red-stream.c
+++ b/server/red-stream.c
@@ -357,6 +357,7 @@ void red_stream_free(RedStream *s)
         g_free(s->priv->sasl.mechlist);
         g_free(s->priv->sasl.mechname);
         s->priv->sasl.mechlist = NULL;
+        g_free(s->priv->sasl.data);
         sasl_dispose(&s->priv->sasl.conn);
         s->priv->sasl.conn = NULL;
     }
commit 58e8bf643974a7cac998c73a5a97f0ce6be0dac3
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    reds: Remove argument from reds_handle_link
    
    RedLinkInfo stores reds in it no need to pass every time.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index 9102c512..9338b78b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2019,8 +2019,10 @@ static void reds_handle_other_links(RedsState *reds, RedLinkInfo *link)
     reds_link_free(link);
 }
 
-static void reds_handle_link(RedsState *reds, RedLinkInfo *link)
+static void reds_handle_link(RedLinkInfo *link)
 {
+    RedsState *reds = link->reds;
+
     if (link->link_mess->channel_type == SPICE_CHANNEL_MAIN) {
         reds_handle_main_link(reds, link);
     } else {
@@ -2079,7 +2081,7 @@ static void reds_handle_ticket(void *opaque)
         }
     }
 
-    reds_handle_link(reds, link);
+    reds_handle_link(link);
     goto end;
 
 error:
@@ -2118,12 +2120,11 @@ static void reds_handle_auth_sasl_steplen(void *opaque);
 static void reds_handle_auth_sasl_step(void *opaque)
 {
     RedLinkInfo *link = (RedLinkInfo *)opaque;
-    RedsState *reds = link->reds;
     RedSaslError status;
 
     status = red_sasl_handle_auth_step(link->stream, reds_handle_auth_sasl_steplen, link);
     if (status == RED_SASL_ERROR_OK) {
-        reds_handle_link(reds, link);
+        reds_handle_link(link);
     } else if (status != RED_SASL_ERROR_CONTINUE) {
         reds_link_free(link);
     }
@@ -2159,12 +2160,11 @@ static void reds_handle_auth_sasl_steplen(void *opaque)
 static void reds_handle_auth_sasl_start(void *opaque)
 {
     RedLinkInfo *link = (RedLinkInfo *)opaque;
-    RedsState *reds = link->reds;
     RedSaslError status;
 
     status = red_sasl_handle_auth_start(link->stream, reds_handle_auth_sasl_steplen, link);
     if (status == RED_SASL_ERROR_OK) {
-        reds_handle_link(reds, link);
+        reds_handle_link(link);
     } else if (status != RED_SASL_ERROR_CONTINUE) {
         reds_link_free(link);
     }


More information about the Spice-commits mailing list