After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691930 - set_ssl_ca_file try unreffing a NULL GObject if TLS is not supported
set_ssl_ca_file try unreffing a NULL GObject if TLS is not supported
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
: 694729 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-01-17 09:54 UTC by Guillaume Desmottes
Modified: 2013-02-26 09:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
set_ssl_ca_file: don't try unreffing tlsdb if it's NULL (967 bytes, patch)
2013-01-17 10:00 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2013-01-17 09:54:32 UTC
In soup-session.c : set_ssl_ca_file() we use /dev/null as fallback DB only if:
		if (!g_error_matches (error, G_TLS_ERROR, G_TLS_ERROR_UNAVAILABLE)) {

So for any other error ('error TLS support is not available' in my jhbuild), we don't create any tlsdb but then still try to unref it once we have called set_tlsdb(), raising a warning.

Any reason to not always use /dev/null as fallback if something went wrong?
Comment 1 Guillaume Desmottes 2013-01-17 09:58:27 UTC
(In reply to comment #0)

> Any reason to not always use /dev/null as fallback if something went wrong?

Hum actually that doesn't work as I still get this error. So we should just check if the tlsdb is not NULL before unreffing.
Comment 2 Guillaume Desmottes 2013-01-17 10:00:36 UTC
Created attachment 233655 [details] [review]
set_ssl_ca_file: don't try unreffing tlsdb if it's NULL

If g_tls_file_database_new() failed for any reason but
G_TLS_ERROR_UNAVAILABLE, we don't create a fallback DB and so tlsdb stays
NULL.
Comment 3 Dan Winship 2013-01-17 16:30:52 UTC
Comment on attachment 233655 [details] [review]
set_ssl_ca_file: don't try unreffing tlsdb if it's NULL

(In reply to comment #1)
> (In reply to comment #0)
> > Any reason to not always use /dev/null as fallback if something went wrong?
> 
> Hum actually that doesn't work as I still get this error.

right, g_tls_file_database_new() will return NULL (with another G_TLS_ERROR_UNAVAILABLE) if you have the fallback TLS backend. so the only-unref-if-not-NULL patch is correct. thanks.
Comment 4 Guillaume Desmottes 2013-01-18 08:57:09 UTC
Attachment 233655 [details] pushed as 91f1eea - set_ssl_ca_file: don't try unreffing tlsdb if it's NULL
Comment 5 Dan Winship 2013-02-26 09:50:38 UTC
*** Bug 694729 has been marked as a duplicate of this bug. ***