equal
deleted
inserted
replaced
76 gboolean use_xmpp; |
76 gboolean use_xmpp; |
77 LmSASL *sasl; |
77 LmSASL *sasl; |
78 gchar *resource; |
78 gchar *resource; |
79 LmMessageHandler *features_cb; |
79 LmMessageHandler *features_cb; |
80 LmMessageHandler *starttls_cb; |
80 LmMessageHandler *starttls_cb; |
|
81 gboolean tls_started; |
81 |
82 |
82 /* Communication */ |
83 /* Communication */ |
83 guint open_id; |
84 guint open_id; |
84 LmCallback *open_cb; |
85 LmCallback *open_cb; |
85 |
86 |
992 LmMessage *message, |
993 LmMessage *message, |
993 gpointer user_data) |
994 gpointer user_data) |
994 { |
995 { |
995 if (lm_socket_starttls (connection->socket)) { |
996 if (lm_socket_starttls (connection->socket)) { |
996 connection_send_stream_header (connection); |
997 connection_send_stream_header (connection); |
|
998 connection->tls_started = TRUE; |
997 } else { |
999 } else { |
998 connection_do_close (connection); |
1000 connection_do_close (connection); |
999 connection_signal_disconnect (connection, |
1001 connection_signal_disconnect (connection, |
1000 LM_DISCONNECT_REASON_ERROR); |
1002 LM_DISCONNECT_REASON_ERROR); |
1001 } |
1003 } |
1026 |
1028 |
1027 lm_connection_send (connection, msg, NULL); |
1029 lm_connection_send (connection, msg, NULL); |
1028 lm_message_unref (msg); |
1030 lm_message_unref (msg); |
1029 |
1031 |
1030 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
1032 return LM_HANDLER_RESULT_REMOVE_MESSAGE; |
1031 } else if (lm_ssl_get_require_starttls (connection->ssl)) { |
1033 } else if (!connection->tls_started && |
|
1034 lm_ssl_get_require_starttls (connection->ssl)) { |
1032 /* If there were no starttls features present and we require it, this is |
1035 /* If there were no starttls features present and we require it, this is |
1033 * the place to scream. */ |
1036 * the place to scream. */ |
1034 |
1037 |
1035 g_debug ("%s: required StartTLS feature not supported by server", G_STRFUNC); |
1038 g_debug ("%s: required StartTLS feature not supported by server", G_STRFUNC); |
1036 connection_do_close (connection); |
1039 connection_do_close (connection); |
1122 connection->state = LM_CONNECTION_STATE_CLOSED; |
1125 connection->state = LM_CONNECTION_STATE_CLOSED; |
1123 connection->keep_alive_source = NULL; |
1126 connection->keep_alive_source = NULL; |
1124 connection->keep_alive_rate = 0; |
1127 connection->keep_alive_rate = 0; |
1125 connection->socket = NULL; |
1128 connection->socket = NULL; |
1126 connection->use_xmpp = FALSE; |
1129 connection->use_xmpp = FALSE; |
|
1130 connection->tls_started = FALSE; |
1127 |
1131 |
1128 connection->id_handlers = g_hash_table_new_full (g_str_hash, |
1132 connection->id_handlers = g_hash_table_new_full (g_str_hash, |
1129 g_str_equal, |
1133 g_str_equal, |
1130 g_free, |
1134 g_free, |
1131 (GDestroyNotify) lm_message_handler_unref); |
1135 (GDestroyNotify) lm_message_handler_unref); |