Skip to content
Commit 9f3fde7b authored by Christophe Fergeau's avatar Christophe Fergeau
Browse files

proxy: Fix blocking of notify::ssl-ca-file in ::set_tmp_ca_file()

OvirtProxy listens for OvirtProxy::ssl-ca-file changes so that it can
clear the temp file it uses for it when it's externally changed.
However, when changing it internally from ovirt_proxy_set_tmp_ca_file,
we need to block that handler because it would clear the value we just
set.

This uses g_signal_handler_{un,}block which has this note in its
documentation:
« since the order in which handlers are called during signal emissions
is deterministic, whether the unblocked handler in question is called as
part of a currently ongoing emission depends on how far that emission
has proceeded yet »

This actually causes an issue when using
g_object_set(proxy, "ca-cert", ca, NULL); as the block/unblock will not
be enough to prevent our handler listening for changes for being called,
resulting in the temp file we just set to be removed behind our back.

Another issue with the blocking is that libgovirt users who want to listen
for RestProxy::ssl-ca-file changing would not be able to do so.

This commit takes another approach to avoid ssl_ca_file_changed() firing
when we don't want it to, it sets a gboolean to TRUE before setting
RestProxy::ssl-ca-file. This boolean is tested in ssl_ca_file_changed() before
doing anything. If it's set, ssl_ca_file_changed() only clears it and returns.
parent f0a76320
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment