|
|
03cf34 |
diff -up libsoup-2.56.0/libsoup/soup-auth-negotiate.c.negotiate-internals libsoup-2.56.0/libsoup/soup-auth-negotiate.c
|
|
|
03cf34 |
--- libsoup-2.56.0/libsoup/soup-auth-negotiate.c.negotiate-internals 2016-09-16 17:14:27.000000000 +0200
|
|
|
03cf34 |
+++ libsoup-2.56.0/libsoup/soup-auth-negotiate.c 2017-06-20 14:34:42.018592998 +0200
|
|
|
03cf34 |
@@ -83,11 +83,6 @@ typedef struct {
|
|
|
03cf34 |
|
|
|
03cf34 |
typedef struct {
|
|
|
03cf34 |
gboolean is_authenticated;
|
|
|
03cf34 |
-
|
|
|
03cf34 |
- gulong message_finished_signal_id;
|
|
|
03cf34 |
- gulong message_got_headers_signal_id;
|
|
|
03cf34 |
-
|
|
|
03cf34 |
- SoupNegotiateConnectionState *conn_state;
|
|
|
03cf34 |
} SoupAuthNegotiatePrivate;
|
|
|
03cf34 |
|
|
|
03cf34 |
#define SOUP_AUTH_NEGOTIATE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_AUTH_NEGOTIATE, SoupAuthNegotiatePrivate))
|
|
|
03cf34 |
@@ -108,7 +103,6 @@ static GSList *blacklisted_uris;
|
|
|
03cf34 |
static void parse_uris_from_env_variable (const gchar *env_variable, GSList **list);
|
|
|
03cf34 |
|
|
|
03cf34 |
static void check_server_response (SoupMessage *msg, gpointer auth);
|
|
|
03cf34 |
-static void remove_server_response_handler (SoupMessage *msg, gpointer auth);
|
|
|
03cf34 |
|
|
|
03cf34 |
static const char spnego_OID[] = "\x2b\x06\x01\x05\x05\x02";
|
|
|
03cf34 |
static const gss_OID_desc gss_mech_spnego = { sizeof (spnego_OID) - 1, (void *) &spnego_OID };
|
|
|
03cf34 |
@@ -116,12 +110,10 @@ static const gss_OID_desc gss_mech_spneg
|
|
|
03cf34 |
static gpointer
|
|
|
03cf34 |
soup_auth_negotiate_create_connection_state (SoupConnectionAuth *auth)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
- SoupAuthNegotiatePrivate *priv = SOUP_AUTH_NEGOTIATE_GET_PRIVATE (auth);
|
|
|
03cf34 |
SoupNegotiateConnectionState *conn;
|
|
|
03cf34 |
|
|
|
03cf34 |
conn = g_slice_new0 (SoupNegotiateConnectionState);
|
|
|
03cf34 |
conn->state = SOUP_NEGOTIATE_NEW;
|
|
|
03cf34 |
- priv->conn_state = conn;
|
|
|
03cf34 |
|
|
|
03cf34 |
return conn;
|
|
|
03cf34 |
}
|
|
|
03cf34 |
@@ -137,14 +129,11 @@ static void
|
|
|
03cf34 |
soup_auth_negotiate_free_connection_state (SoupConnectionAuth *auth,
|
|
|
03cf34 |
gpointer state)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
- SoupAuthNegotiate *negotiate = SOUP_AUTH_NEGOTIATE (auth);
|
|
|
03cf34 |
- SoupAuthNegotiatePrivate *priv = SOUP_AUTH_NEGOTIATE_GET_PRIVATE (negotiate);
|
|
|
03cf34 |
SoupNegotiateConnectionState *conn = state;
|
|
|
03cf34 |
|
|
|
03cf34 |
free_connection_state_data (conn);
|
|
|
03cf34 |
|
|
|
03cf34 |
g_slice_free (SoupNegotiateConnectionState, conn);
|
|
|
03cf34 |
- priv->conn_state = NULL;
|
|
|
03cf34 |
}
|
|
|
03cf34 |
|
|
|
03cf34 |
static GSList *
|
|
|
03cf34 |
@@ -226,7 +215,6 @@ soup_auth_negotiate_update_connection (S
|
|
|
03cf34 |
#ifdef LIBSOUP_HAVE_GSSAPI
|
|
|
03cf34 |
gboolean success = TRUE;
|
|
|
03cf34 |
SoupNegotiateConnectionState *conn = state;
|
|
|
03cf34 |
- SoupAuthNegotiatePrivate *priv = SOUP_AUTH_NEGOTIATE_GET_PRIVATE (auth);
|
|
|
03cf34 |
GError *err = NULL;
|
|
|
03cf34 |
|
|
|
03cf34 |
if (!check_auth_trusted_uri (auth, msg)) {
|
|
|
03cf34 |
@@ -245,24 +233,19 @@ soup_auth_negotiate_update_connection (S
|
|
|
03cf34 |
|
|
|
03cf34 |
conn->state = SOUP_NEGOTIATE_RECEIVED_CHALLENGE;
|
|
|
03cf34 |
if (soup_gss_build_response (conn, SOUP_AUTH (auth), &err)) {
|
|
|
03cf34 |
- /* Register the callbacks just once */
|
|
|
03cf34 |
- if (priv->message_finished_signal_id == 0) {
|
|
|
03cf34 |
- gulong id = 0;
|
|
|
03cf34 |
- id = g_signal_connect (msg,
|
|
|
03cf34 |
- "finished",
|
|
|
03cf34 |
- G_CALLBACK (remove_server_response_handler),
|
|
|
03cf34 |
- auth);
|
|
|
03cf34 |
- priv->message_finished_signal_id = id;
|
|
|
03cf34 |
- }
|
|
|
03cf34 |
-
|
|
|
03cf34 |
- if (priv->message_got_headers_signal_id == 0) {
|
|
|
03cf34 |
- gulong id = 0;
|
|
|
03cf34 |
+ /* Connect the signal only once per message */
|
|
|
03cf34 |
+ if (!g_object_get_data (G_OBJECT (msg), "negotiate-got-headers-connected")) {
|
|
|
03cf34 |
/* Wait for the 2xx response to verify server response */
|
|
|
03cf34 |
- id = g_signal_connect (msg,
|
|
|
03cf34 |
+ g_signal_connect_data (msg,
|
|
|
03cf34 |
"got_headers",
|
|
|
03cf34 |
G_CALLBACK (check_server_response),
|
|
|
03cf34 |
- auth);
|
|
|
03cf34 |
- priv->message_got_headers_signal_id = id;
|
|
|
03cf34 |
+ g_object_ref (auth),
|
|
|
03cf34 |
+ (GClosureNotify) g_object_unref,
|
|
|
03cf34 |
+ 0);
|
|
|
03cf34 |
+ /* Mark that the signal was connected */
|
|
|
03cf34 |
+ g_object_set_data (G_OBJECT (msg),
|
|
|
03cf34 |
+ "negotiate-got-headers-connected",
|
|
|
03cf34 |
+ GINT_TO_POINTER (1));
|
|
|
03cf34 |
}
|
|
|
03cf34 |
goto out;
|
|
|
03cf34 |
} else {
|
|
|
03cf34 |
@@ -333,7 +316,11 @@ check_server_response (SoupMessage *msg,
|
|
|
03cf34 |
GError *err = NULL;
|
|
|
03cf34 |
SoupAuthNegotiate *negotiate = auth;
|
|
|
03cf34 |
SoupAuthNegotiatePrivate *priv = SOUP_AUTH_NEGOTIATE_GET_PRIVATE (negotiate);
|
|
|
03cf34 |
- SoupNegotiateConnectionState *conn = priv->conn_state;
|
|
|
03cf34 |
+ SoupNegotiateConnectionState *conn;
|
|
|
03cf34 |
+
|
|
|
03cf34 |
+ conn = soup_connection_auth_get_connection_state_for_message (SOUP_CONNECTION_AUTH (auth), msg);
|
|
|
03cf34 |
+ if (!conn)
|
|
|
03cf34 |
+ return;
|
|
|
03cf34 |
|
|
|
03cf34 |
if (auth != soup_message_get_auth (msg))
|
|
|
03cf34 |
return;
|
|
|
03cf34 |
@@ -365,19 +352,6 @@ check_server_response (SoupMessage *msg,
|
|
|
03cf34 |
g_clear_error (&err;;
|
|
|
03cf34 |
}
|
|
|
03cf34 |
|
|
|
03cf34 |
-static void
|
|
|
03cf34 |
-remove_server_response_handler (SoupMessage *msg, gpointer auth)
|
|
|
03cf34 |
-{
|
|
|
03cf34 |
- SoupAuthNegotiate *negotiate = auth;
|
|
|
03cf34 |
- SoupAuthNegotiatePrivate *priv = SOUP_AUTH_NEGOTIATE_GET_PRIVATE (negotiate);
|
|
|
03cf34 |
-
|
|
|
03cf34 |
- g_signal_handler_disconnect (msg, priv->message_got_headers_signal_id);
|
|
|
03cf34 |
- priv->message_got_headers_signal_id = 0;
|
|
|
03cf34 |
-
|
|
|
03cf34 |
- g_signal_handler_disconnect (msg, priv->message_finished_signal_id);
|
|
|
03cf34 |
- priv->message_finished_signal_id = 0;
|
|
|
03cf34 |
-}
|
|
|
03cf34 |
-
|
|
|
03cf34 |
/* Check if scheme://host:port from message matches the given URI. */
|
|
|
03cf34 |
static gint
|
|
|
03cf34 |
match_base_uri (SoupURI *list_uri, SoupURI *msg_uri)
|
|
|
03cf34 |
diff -up libsoup-2.56.0/libsoup/soup-connection-auth.c.negotiate-internals libsoup-2.56.0/libsoup/soup-connection-auth.c
|
|
|
03cf34 |
--- libsoup-2.56.0/libsoup/soup-connection-auth.c.negotiate-internals 2016-02-05 16:05:33.000000000 +0100
|
|
|
03cf34 |
+++ libsoup-2.56.0/libsoup/soup-connection-auth.c 2017-06-20 14:31:00.333517935 +0200
|
|
|
03cf34 |
@@ -71,12 +71,31 @@ soup_connection_auth_finalize (GObject *
|
|
|
03cf34 |
G_OBJECT_CLASS (soup_connection_auth_parent_class)->finalize (object);
|
|
|
03cf34 |
}
|
|
|
03cf34 |
|
|
|
03cf34 |
-static gpointer
|
|
|
03cf34 |
-get_connection_state_for_message (SoupConnectionAuth *auth, SoupMessage *msg)
|
|
|
03cf34 |
+
|
|
|
03cf34 |
+/**
|
|
|
03cf34 |
+ * soup_connection_auth_get_connection_state_for_message:
|
|
|
03cf34 |
+ * @auth: a #SoupConnectionAuth
|
|
|
03cf34 |
+ * @msg: a #SoupMessage
|
|
|
03cf34 |
+ *
|
|
|
03cf34 |
+ * Returns an associated connection state object for the given @auth and @msg.
|
|
|
03cf34 |
+ *
|
|
|
03cf34 |
+ * This function is only useful from within implementations of SoupConnectionAuth
|
|
|
03cf34 |
+ * subclasses.
|
|
|
03cf34 |
+ *
|
|
|
03cf34 |
+ * Return value: (transfer none): the connection state
|
|
|
03cf34 |
+ *
|
|
|
03cf34 |
+ * Since: 2.56
|
|
|
03cf34 |
+ **/
|
|
|
03cf34 |
+gpointer
|
|
|
03cf34 |
+soup_connection_auth_get_connection_state_for_message (SoupConnectionAuth *auth,
|
|
|
03cf34 |
+ SoupMessage *msg)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
SoupConnection *conn;
|
|
|
03cf34 |
gpointer state;
|
|
|
03cf34 |
|
|
|
03cf34 |
+ g_return_val_if_fail (SOUP_IS_CONNECTION_AUTH (auth), NULL);
|
|
|
03cf34 |
+ g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL);
|
|
|
03cf34 |
+
|
|
|
03cf34 |
conn = soup_message_get_connection (msg);
|
|
|
03cf34 |
state = g_hash_table_lookup (auth->priv->conns, conn);
|
|
|
03cf34 |
if (state)
|
|
|
03cf34 |
@@ -98,7 +117,7 @@ soup_connection_auth_update (SoupAuth
|
|
|
03cf34 |
GHashTable *auth_params)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
SoupConnectionAuth *cauth = SOUP_CONNECTION_AUTH (auth);
|
|
|
03cf34 |
- gpointer conn = get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
+ gpointer conn = soup_connection_auth_get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
GHashTableIter iter;
|
|
|
03cf34 |
GString *auth_header;
|
|
|
03cf34 |
gpointer key, value;
|
|
|
03cf34 |
@@ -140,7 +159,7 @@ soup_connection_auth_get_authorization (
|
|
|
03cf34 |
SoupMessage *msg)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
SoupConnectionAuth *cauth = SOUP_CONNECTION_AUTH (auth);
|
|
|
03cf34 |
- gpointer conn = get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
+ gpointer conn = soup_connection_auth_get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
|
|
|
03cf34 |
return SOUP_CONNECTION_AUTH_GET_CLASS (auth)->
|
|
|
03cf34 |
get_connection_authorization (cauth, msg, conn);
|
|
|
03cf34 |
@@ -151,7 +170,7 @@ soup_connection_auth_is_ready (SoupAuth
|
|
|
03cf34 |
SoupMessage *msg)
|
|
|
03cf34 |
{
|
|
|
03cf34 |
SoupConnectionAuth *cauth = SOUP_CONNECTION_AUTH (auth);
|
|
|
03cf34 |
- gpointer conn = get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
+ gpointer conn = soup_connection_auth_get_connection_state_for_message (cauth, msg);
|
|
|
03cf34 |
|
|
|
03cf34 |
return SOUP_CONNECTION_AUTH_GET_CLASS (auth)->
|
|
|
03cf34 |
is_connection_ready (SOUP_CONNECTION_AUTH (auth), msg, conn);
|
|
|
03cf34 |
diff -up libsoup-2.56.0/libsoup/soup-connection-auth.h.negotiate-internals libsoup-2.56.0/libsoup/soup-connection-auth.h
|
|
|
03cf34 |
--- libsoup-2.56.0/libsoup/soup-connection-auth.h.negotiate-internals 2016-09-16 17:14:27.000000000 +0200
|
|
|
03cf34 |
+++ libsoup-2.56.0/libsoup/soup-connection-auth.h 2017-06-20 14:31:00.333517935 +0200
|
|
|
03cf34 |
@@ -46,6 +46,10 @@ typedef struct {
|
|
|
03cf34 |
|
|
|
03cf34 |
GType soup_connection_auth_get_type (void);
|
|
|
03cf34 |
|
|
|
03cf34 |
+SOUP_AVAILABLE_IN_2_56
|
|
|
03cf34 |
+gpointer soup_connection_auth_get_connection_state_for_message
|
|
|
03cf34 |
+ (SoupConnectionAuth *auth,
|
|
|
03cf34 |
+ SoupMessage *message);
|
|
|
03cf34 |
G_END_DECLS
|
|
|
03cf34 |
|
|
|
03cf34 |
#endif /* SOUP_CONNECTION_AUTH_H */
|