summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-10-16 17:32:43 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2013-10-16 19:12:27 +0200
commit2cfcb59d87b914df4ad0dc9c53505d0229e90517 (patch)
treecd09a7df137324f6361690ba3666fa134f9d3a39
parent4802c76c88356e859da42f78e257441a4f620ce1 (diff)
sasl: Fix crash when ending a SASL session
When exiting remote-viewer after authenticating through SASL, I got this crash: #0 0x0000000100a51870 in ?? () #1 0x000000314d20c53e in _sasl_log (conn=<optimized out>, level=5, fmt=0x7fffe49893e8 "DIGEST-MD5 client mech dispose") at common.c:1985 #2 0x00007fffe4982d88 in digestmd5_client_mech_dispose (conn_context=0xaf1900, utils=0xaefd10) at digestmd5.c:4580 #3 0x000000314d208654 in client_dispose (pconn=0xaf0710) at client.c:332 #4 0x000000314d20b76b in sasl_dispose (pconn=0xa51898) at common.c:851 #5 0x00007ffff7602dc7 in channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2493 #6 0x00007ffff760f7b7 in spice_inputs_channel_reset (channel=0xa52250, migrating=0) at channel-inputs.c:615 #7 0x00007ffff76030ac in spice_channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2551 #8 0x00007ffff76031e0 in channel_disconnect (channel=0xa52250) at spice-channel.c:2570 #9 0x00007ffff760283d in spice_channel_coroutine (data=0xa52250) at spice-channel.c:2368 #10 0x00007ffff763d14b in coroutine_trampoline (cc=0xa51900) at coroutine_ucontext.c:58 #11 0x00007ffff763ce30 in continuation_trampoline (i0=10819840, i1=0) at continuation.c:49 #12 0x00000031342479c0 in ?? () from /lib64/libc.so.6 #13 0x0000000000a51cc8 in ?? () #14 0x0000000000000000 in ?? () It turns out that the sasl_callback_t data passed when calling sasl_client_new() must be valid until sasl_dispose() is called. I could not find mentions of this in the official documentation but https://mail-archives.apache.org/mod_mbox/subversion-dev/201109.mbox/%3C20110908072256.GN25324@ted.stsp.name%3E describes what happens. Making the sasl_callback_t structure static should be enough to guarantee that the data will stay around long enough.
-rw-r--r--gtk/spice-channel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 2c4d44c..41d5eab 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -1325,7 +1325,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
char *localAddr = NULL, *remoteAddr = NULL;
const void *val;
sasl_ssf_t ssf;
- sasl_callback_t saslcb[] = {
+ static const sasl_callback_t saslcb[] = {
{ .id = SASL_CB_PASS },
{ .id = 0 },
};