# HG changeset patch # User Andreas Monitzer # Date 1199751768 0 # Node ID d63892ade0a68d12a3a0d6cf1cb96fb5bc594480 # Parent 684f9228ae920f1aa2faa8c0a0c68159dc6c1b8a Now checking the hostname supplied by the user, or the host-part of the JID when no host name is given against the CN of the domain. This makes libpurple comply to the RFC. Fixes http://trac.adiumx.com/ticket/8787 diff -r 684f9228ae92 -r d63892ade0a6 libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Mon Jan 07 23:20:40 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Jan 08 00:22:48 2008 +0000 @@ -559,13 +559,12 @@ purple_input_remove(js->gc->inpa); js->gc->inpa = 0; js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, - jabber_login_callback_ssl, jabber_ssl_connect_failure, js->host, js->gc); + jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); } static void jabber_login_connect(JabberStream *js, const char *fqdn, const char *host, int port) { js->serverFQDN = g_strdup(fqdn); - js->host = g_strdup(host); if (purple_proxy_connect(js->gc, js->gc->account, host, port, jabber_login_callback, js->gc) == NULL) @@ -616,6 +615,7 @@ js->write_buffer = purple_circ_buffer_new(512); js->old_length = 0; js->keepalive_timeout = -1; + js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain); if(!js->user) { purple_connection_error_reason (gc, @@ -653,7 +653,7 @@ if(purple_account_get_bool(js->gc->account, "old_ssl", FALSE)) { if(purple_ssl_is_supported()) { js->gsc = purple_ssl_connect(js->gc->account, - connect_server[0] ? connect_server : js->user->domain, + js->certificate_CN, purple_account_get_int(account, "port", 5223), jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc); } else { @@ -1128,6 +1128,7 @@ my_jb->subscription |= JABBER_SUB_BOTH; server = connect_server[0] ? connect_server : js->user->domain; + js->certificate_CN = g_strdup(server); jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); @@ -1304,7 +1305,7 @@ js->commands = g_list_delete_link(js->commands, js->commands); } g_free(js->server_name); - g_free(js->host); + g_free(js->certificate_CN); g_free(js->gmail_last_time); g_free(js->gmail_last_tid); g_free(js->old_msg); diff -r 684f9228ae92 -r d63892ade0a6 libpurple/protocols/jabber/jabber.h --- a/libpurple/protocols/jabber/jabber.h Mon Jan 07 23:20:40 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Tue Jan 08 00:22:48 2008 +0000 @@ -192,7 +192,7 @@ int old_length; char *old_track; - char *host; + char *certificate_CN; /* A purple timeout tag for the keepalive */ int keepalive_timeout;