[libgovirt] Add GOVIRT_NO_SSL_STRICT debug environment variable
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Add GOVIRT_NO_SSL_STRICT debug environment variable
- Date: Tue, 7 Apr 2015 16:38:23 +0000 (UTC)
commit 53af194d94c19be7e66f80e79ebdc97fa6ed6647
Author: Christophe Fergeau <cfergeau redhat com>
Date: Fri Apr 3 17:47:35 2015 +0200
Add GOVIRT_NO_SSL_STRICT debug environment variable
During development or for debugging, it might be insteresting to access
the oVirt REST API without a full TLS setup (ie with invalid
certificates) as this can be a pain to put in place. The
GOVIRT_NO_SSL_STRICT environment variable instructs libgovirt not to
fail when it encounters invalid certificates during an HTTPS session.
govirt/ovirt-proxy.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 6593c71..98c095f 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -783,6 +783,20 @@ ovirt_proxy_finalize(GObject *obj)
G_OBJECT_CLASS(ovirt_proxy_parent_class)->finalize(obj);
}
+
+static void ovirt_proxy_constructed(GObject *gobject)
+{
+ if (g_getenv("GOVIRT_NO_SSL_STRICT") != NULL) {
+ g_warning("Disabling strict checking of SSL certificates");
+ g_object_set(OVIRT_PROXY(gobject), "ssl-strict", FALSE, NULL);
+ }
+
+ /* Chain up to the parent class */
+ if (G_OBJECT_CLASS(ovirt_proxy_parent_class)->constructed)
+ G_OBJECT_CLASS(ovirt_proxy_parent_class)->constructed(gobject);
+}
+
+
static void
ovirt_proxy_class_init(OvirtProxyClass *klass)
{
@@ -790,6 +804,7 @@ ovirt_proxy_class_init(OvirtProxyClass *klass)
oclass->dispose = ovirt_proxy_dispose;
oclass->finalize = ovirt_proxy_finalize;
+ oclass->constructed = ovirt_proxy_constructed;
oclass->get_property = ovirt_proxy_get_property;
oclass->set_property = ovirt_proxy_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]