mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 06:32:10 +01:00
tls: Add support for copying session data
Add support for copying session data between client connections. This is needed for implementing FTP over SSL. Most servers use a separate session for each control connection and enforce sharing of each control connection's session between the related data connection. Copying session data between two connections is needed for two reasons: 1) The data connection runs on a separate port and so has a different server_identity which means it would not normally share the session with the control connection using the session caching currently implemented. 2) It is typical to have multiple control connections, each of which uses a different session with the same server_identity, so only one of these sessions gets stored in the cache. If a data connection is opened, (ignoring the port issue) it may try and reuse the wrong control connection's session, and fail. This operation is conceptually the same as OpenSSL's SSL_copy_session_id operation. https://bugzilla.gnome.org/show_bug.cgi?id=745255
This commit is contained in:
parent
eac975c682
commit
95d300eac5
@ -338,3 +338,29 @@ g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn)
|
||||
g_object_get (G_OBJECT (conn), "accepted-cas", &accepted_cas, NULL);
|
||||
return accepted_cas;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_tls_client_connection_copy_session_state:
|
||||
* @conn: a #GTlsClientConnection
|
||||
* @other: a #GTlsClientConnection
|
||||
*
|
||||
* Copies session state from one connection to another. This is
|
||||
* not normally needed, but may be used when the same session
|
||||
* needs to be used between different endpoints as is required
|
||||
* by some protocols such as FTP over TLS. @source should have
|
||||
* already completed a handshake, and @conn should not have
|
||||
* completed a handshake.
|
||||
*
|
||||
* Since: 2.46
|
||||
*/
|
||||
void
|
||||
g_tls_client_connection_copy_session_state (GTlsClientConnection *conn,
|
||||
GTlsClientConnection *source)
|
||||
{
|
||||
g_return_if_fail (G_IS_TLS_CLIENT_CONNECTION (conn));
|
||||
g_return_if_fail (G_IS_TLS_CLIENT_CONNECTION (source));
|
||||
g_return_if_fail (G_TLS_CLIENT_CONNECTION_GET_INTERFACE (conn)->copy_session_state != NULL);
|
||||
|
||||
G_TLS_CLIENT_CONNECTION_GET_INTERFACE (conn)->copy_session_state (conn,
|
||||
source);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ struct _GTlsClientConnectionInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void ( *copy_session_state ) (GTlsClientConnection *conn,
|
||||
GTlsClientConnection *source);
|
||||
};
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
@ -74,6 +76,10 @@ void g_tls_client_connection_set_use_ssl3 (GTlsClientCo
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
GList * g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn);
|
||||
|
||||
GLIB_AVAILABLE_IN_2_46
|
||||
void g_tls_client_connection_copy_session_state (GTlsClientConnection *conn,
|
||||
GTlsClientConnection *source);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __G_TLS_CLIENT_CONNECTION_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user