GNOME Bugzilla – Bug 787485
g_tls_backend_supports_dtls () returns true when the backend doesn't
Last modified: 2017-09-13 16:39:46 UTC
g_tls_backend_supports_dtls (GTlsBackend *backend) { if (G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls) return G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls (backend); else if (G_IS_DUMMY_TLS_BACKEND (backend)) return FALSE; else return TRUE; } Looks like the GnuTLS backend *Doesn't* support DTLS. I get a SEGV when I try to establish a DTLS conenction, because its .get_dtls_client_connection_type pointer is NULL. But g_tls_backend_supports_dtls() is returning 'TRUE' because the backend doesn't provide a ->supports_dtls method either. *Is* there a backend that supports DTLS, and any way to actually *use* GDtlsClientConnection?
(In reply to David Woodhouse from comment #0) > g_tls_backend_supports_dtls (GTlsBackend *backend) > { > if (G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls) > return G_TLS_BACKEND_GET_INTERFACE (backend)->supports_dtls (backend); > else if (G_IS_DUMMY_TLS_BACKEND (backend)) > return FALSE; > else > return TRUE; > } > > Looks like the GnuTLS backend *Doesn't* support DTLS. I get a SEGV when I > try to establish a DTLS conenction, because its > .get_dtls_client_connection_type pointer is NULL. But > g_tls_backend_supports_dtls() is returning 'TRUE' because the backend > doesn't provide a ->supports_dtls method either. I can’t remember what the original reasoning for defaulting to returning TRUE from supports_dtls was, but it’s obviously wrong for backends which have never been updated to support DTLS and hence don’t have a supports_dtls vfunc. Patch upcoming. > *Is* there a backend that supports DTLS, and any way to actually *use* > GDtlsClientConnection? That’s bug #697908, which is sadly *still* waiting for review. If you want to help out with the review there, that would be much appreciated. I should be able to find time to rebase and update the patches in response to review feedback.
Created attachment 359514 [details] [review] gtlsbackend: Default to indicating no support for DTLS in GTlsBackend I’m unsure what the original reasoning for returning TRUE by default from supports_dtls was, but it is not backwards-compatible. If a pre-existing GTlsBackend implementation never implements the supports_dtls vfunc, the supports_dtls() method will magically return TRUE rather than FALSE. Since any backend which does implement DTLS should be implementing the supports_dtls vfunc (and no DTLS-supporting backends have actually been merged yet; see bug #697908), it seems safer to make this slight API break in the name of backwards compatibility than to leave it as returning TRUE incorrectly. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 359514 [details] [review]: Signed-off-by: me
Thanks for the review. Hopefully someone will take a look at bug #697908 sometime soon, before it bitrots for another year; but I won’t ask you to do that, Emmanuele. Yet. Attachment 359514 [details] pushed as 5e55a4e - gtlsbackend: Default to indicating no support for DTLS in GTlsBackend