summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2013-09-16 13:11:04 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-08-27 17:34:09 +0200
commit7d14e6ee60ad9348908293c98252aed99b1474e2 (patch)
treea6bc00d4c9f3d73d82373a6931bb771354afbd16
parentc29965df2b3ad62b1aac39eb35ee3d1ecd80b763 (diff)
Add RestProxy::ssl-ca-file propertyy
This property maps to the SoupSession::ssl-ca-file property, and allows to specify a file that contains the CAs to use to verify the certificates we'll get during a TLS session. (cherry picked from commit 4d2c76683116156048fa06185ca116bd8458929c) Conflicts: rest/rest-proxy.c
-rw-r--r--rest/rest-proxy.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index 78dc6b0..d3ebaba 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -49,6 +49,7 @@ struct _RestProxyPrivate {
SoupSession *session;
SoupSession *session_sync;
gboolean disable_cookies;
+ char *ssl_ca_file;
};
enum
@@ -60,7 +61,8 @@ enum
PROP_DISABLE_COOKIES,
PROP_USERNAME,
PROP_PASSWORD,
- PROP_SSL_STRICT
+ PROP_SSL_STRICT,
+ PROP_SSL_CA_FILE
};
enum {
@@ -123,6 +125,10 @@ rest_proxy_get_property (GObject *object,
g_value_set_boolean (value, ssl_strict);
break;
}
+ case PROP_SSL_CA_FILE:
+ g_value_set_string (value, priv->ssl_ca_file);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -175,6 +181,10 @@ rest_proxy_set_property (GObject *object,
"ssl-strict", g_value_get_boolean (value),
NULL);
break;
+ case PROP_SSL_CA_FILE:
+ g_free(priv->ssl_ca_file);
+ priv->ssl_ca_file = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -260,6 +270,7 @@ rest_proxy_finalize (GObject *object)
g_free (priv->user_agent);
g_free (priv->username);
g_free (priv->password);
+ g_free (priv->ssl_ca_file);
G_OBJECT_CLASS (rest_proxy_parent_class)->finalize (object);
}
@@ -348,6 +359,15 @@ rest_proxy_class_init (RestProxyClass *klass)
PROP_SSL_STRICT,
pspec);
+ pspec = g_param_spec_string ("ssl-ca-file",
+ "SSL CA file",
+ "File containing SSL CA certificates.",
+ NULL,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class,
+ PROP_SSL_CA_FILE,
+ pspec);
+
/**
* RestProxy::authenticate:
* @proxy: the proxy
@@ -399,6 +419,12 @@ rest_proxy_init (RestProxy *self)
g_object_set (priv->session_sync,
"ssl-ca-file", REST_SYSTEM_CA_FILE,
NULL);
+ g_object_bind_property (self, "ssl-ca-file",
+ priv->session, "ssl-ca-file",
+ G_BINDING_BIDIRECTIONAL);
+ g_object_bind_property (self, "ssl-ca-file",
+ priv->session_sync, "ssl-ca-file",
+ G_BINDING_BIDIRECTIONAL);
#if WITH_GNOME
soup_session_add_feature_by_type (priv->session,