--- gtk/spice-session-priv.h | 2 ++ gtk/spice-session.c | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h index 13345b4..804658d 100644 --- a/gtk/spice-session-priv.h +++ b/gtk/spice-session-priv.h @@ -40,6 +40,7 @@ struct _SpiceSessionPrivate { char *ca_file; char *ciphers; GByteArray *pubkey; + GByteArray *ca; char *cert_subject; guint verify; gboolean read_only; @@ -135,6 +136,7 @@ const gchar* spice_session_get_host(SpiceSession *session); const gchar* spice_session_get_cert_subject(SpiceSession *session); const gchar* spice_session_get_ciphers(SpiceSession *session); const gchar* spice_session_get_ca_file(SpiceSession *session); +void spice_session_get_ca(SpiceSession *session, guint8 **ca, guint *size); void spice_session_set_caches_hints(SpiceSession *session, uint32_t pci_ram_size, diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 526d05b..28f3e21 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -103,6 +103,7 @@ enum { PROP_GLZ_WINDOW_SIZE, PROP_UUID, PROP_NAME, + PROP_CA, }; /* signals */ @@ -233,8 +234,8 @@ spice_session_finalize(GObject *gobject) spice_session_images_clear(session); glz_decoder_window_destroy(s->glz_window); - if (s->pubkey) - g_byte_array_unref(s->pubkey); + g_clear_pointer(&s->pubkey, g_byte_array_unref); + g_clear_pointer(&s->ca, g_byte_array_unref); /* Chain up to the parent class */ if (G_OBJECT_CLASS(spice_session_parent_class)->finalize) @@ -437,6 +438,9 @@ static void spice_session_get_property(GObject *gobject, case PROP_PUBKEY: g_value_set_boxed(value, s->pubkey); break; + case PROP_CA: + g_value_set_boxed(value, s->ca); + break; case PROP_CERT_SUBJECT: g_value_set_string(value, s->cert_subject); break; @@ -596,6 +600,9 @@ static void spice_session_set_property(GObject *gobject, case PROP_GLZ_WINDOW_SIZE: s->glz_window_size = g_value_get_int(value); break; + case PROP_CA: + g_clear_pointer(&s->ca, g_byte_array_unref); + s->ca = g_value_dup_boxed(value); default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); break; @@ -950,6 +957,22 @@ static void spice_session_class_init(SpiceSessionClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** + * SpiceSession:ca: + * + * The CA certificates data + * + * Since: 0.15 + **/ + g_object_class_install_property + (gobject_class, PROP_CA, + g_param_spec_boxed("ca", + "CA", + "The CA certificates data", + G_TYPE_BYTE_ARRAY, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** * SpiceSession::channel-new: * @session: the session that emitted the signal * @channel: the new #SpiceChannel @@ -1772,6 +1795,19 @@ void spice_session_get_pubkey(SpiceSession *session, guint8 **pubkey, guint *siz } G_GNUC_INTERNAL +void spice_session_get_ca(SpiceSession *session, guint8 **ca, guint *size) +{ + SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); + + g_return_if_fail(s != NULL); + g_return_if_fail(ca != NULL); + g_return_if_fail(size != NULL); + + *ca = s->ca ? s->ca->data : NULL; + *size = s->ca ? s->ca->len : 0; +} + +G_GNUC_INTERNAL guint spice_session_get_verify(SpiceSession *session) { SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session); -- 1.7.11.7 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel