comparison libpurple/protocols/jabber/jabber.c @ 16996:37a2d6eadd34

fix #699 People usually enter IP addresses into Connect Server, and that's not gonna be a FQDN, which we need for SASL to work correctly. If this causes problems for people (i.e. they were depending on the old behavior of assuming that the connect server was the fqdn), then we'll have to implement something smarter to detect IP addresses vs hostnames, and make TheRightDecision(TM)
author Nathan Walp <nwalp@pidgin.im>
date Fri, 11 May 2007 00:15:12 +0000
parents 919515748253
children efb5d0fe4895 4b4eb353cf9f 988102692e39
comparison
equal deleted inserted replaced
16995:830c0cc9b9d4 16996:37a2d6eadd34
506 js->gc->inpa = 0; 506 js->gc->inpa = 0;
507 js->gsc = purple_ssl_connect_fd(js->gc->account, js->fd, 507 js->gsc = purple_ssl_connect_fd(js->gc->account, js->fd,
508 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc); 508 jabber_login_callback_ssl, jabber_ssl_connect_failure, js->gc);
509 } 509 }
510 510
511 static void jabber_login_connect(JabberStream *js, const char *server, int port) 511 static void jabber_login_connect(JabberStream *js, const char *fqdn, const char *host, int port)
512 { 512 {
513 #ifdef HAVE_CYRUS_SASL 513 #ifdef HAVE_CYRUS_SASL
514 js->serverFQDN = g_strdup(server); 514 js->serverFQDN = g_strdup(fqdn);
515 #endif 515 #endif
516 516
517 if (purple_proxy_connect(js->gc, js->gc->account, server, 517 if (purple_proxy_connect(js->gc, js->gc->account, host,
518 port, jabber_login_callback, js->gc) == NULL) 518 port, jabber_login_callback, js->gc) == NULL)
519 purple_connection_error(js->gc, _("Unable to create socket")); 519 purple_connection_error(js->gc, _("Unable to create socket"));
520 } 520 }
521 521
522 static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data) 522 static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data)
525 525
526 js = data; 526 js = data;
527 js->srv_query_data = NULL; 527 js->srv_query_data = NULL;
528 528
529 if(results) { 529 if(results) {
530 jabber_login_connect(js, resp->hostname, resp->port); 530 jabber_login_connect(js, resp->hostname, resp->hostname, resp->port);
531 g_free(resp); 531 g_free(resp);
532 } else { 532 } else {
533 jabber_login_connect(js, js->user->domain, 533 jabber_login_connect(js, js->user->domain, js->user->domain,
534 purple_account_get_int(js->gc->account, "port", 5222)); 534 purple_account_get_int(js->gc->account, "port", 5222));
535 } 535 }
536 } 536 }
537 537
538 void 538 void
602 602
603 /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll 603 /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll
604 * invoke the magic of SRV lookups, to figure out host and port */ 604 * invoke the magic of SRV lookups, to figure out host and port */
605 if(!js->gsc) { 605 if(!js->gsc) {
606 if(connect_server[0]) { 606 if(connect_server[0]) {
607 jabber_login_connect(js, connect_server, purple_account_get_int(account, "port", 5222)); 607 jabber_login_connect(js, js->user->domain, connect_server, purple_account_get_int(account, "port", 5222));
608 } else { 608 } else {
609 js->srv_query_data = purple_srv_resolve("xmpp-client", 609 js->srv_query_data = purple_srv_resolve("xmpp-client",
610 "tcp", js->user->domain, srv_resolved_cb, js); 610 "tcp", js->user->domain, srv_resolved_cb, js);
611 } 611 }
612 } 612 }
947 } 947 }
948 } 948 }
949 949
950 if(!js->gsc) { 950 if(!js->gsc) {
951 if (connect_server[0]) { 951 if (connect_server[0]) {
952 jabber_login_connect(js, server, 952 jabber_login_connect(js, js->user->domain, server,
953 purple_account_get_int(account, 953 purple_account_get_int(account,
954 "port", 5222)); 954 "port", 5222));
955 } else { 955 } else {
956 js->srv_query_data = purple_srv_resolve("xmpp-client", 956 js->srv_query_data = purple_srv_resolve("xmpp-client",
957 "tcp", 957 "tcp",