Export to GitHub

asmack - issue #2

problem login to gtalk and livejournal servers in android emulator


Posted on Jan 25, 2010 by Quick Kangaroo

What steps will reproduce the problem? 1. create a gmail account on www.google.com or an accont on www.livejournal.com;

for google, use these settings: host = talk.google.com domain = gmail.com login = somename@gmail.com

for livejournal, use these settings: host = xmpp.service.livejournal.com domain = livejournal.com login = somename

  1. paste the code below to an activity and set a break point at login(): try { ConnectionConfiguration config = new ConnectionConfiguration(host, 5222, domain); config.setTruststorePath("/system/etc/security/cacerts.bks"); config.setTruststorePassword("changeit"); config.setTruststoreType("bks"); XMPPConnection m_connection = new XMPPConnection(config); m_connection.connect(); m_connection.login(login1, password1, resource1); System.out.println(m_connection.isAuthenticated()); Presence presence = new Presence(Presence.Type.available); m_connection.sendPacket(presence); m_connection.disconnect(); } catch (Exception e) { e.printStackTrace(); }

What is the expected output? What do you see instead? The login() call will always result in an Exception. for gtalk server, the exception is in attached gtalk_logcat.txt.

for livejournal, the exception is in attached livejournal_logcat.txt.

What version of the product are you using? On what operating system? The latest Android SDK with Plug-in on Eclipse. Application was deployed to android platform 1.6.

Please provide any additional information below. The above code works fine for both servers in regular java application with smack 3.1.0.

Many thanks.

Li

Attachments

Comment #1

Posted on Feb 5, 2010 by Grumpy Rhino

Hi Li,

The issue you've posted looks very wired.

I've been successfully logged in to google talk via my googlemail account.

However I've never used the explicit host notation (DNS/SRV works for googlemail.com and gmail.com. And I've never tried to set the ca store.

Could you please try without the ca store and with the constructor http://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smack/XMPPConnection.java#L129 (new XMPPConnection("gmail.com");)

You should also set "XMPPConnection.DEBUG_ENABLED=true" before starting the connection, this will dump all stanzas (including your password as base64 encoding!) to the logcat, and is pretty much essential for debugging (you can see which stanzas is last).

My idea is that either the sasl uses the wrong domain for authentification or the ca store fails and TLS dies.

Thanks in advance, René

Comment #2

Posted on Feb 6, 2010 by Grumpy Rhino

Hi,

I for the first time have seen this exception, caused by extremly slow network connection and high drop rates.

Can you verify that your network speed is decent? Is there some throttling involved?

Regards, René

Comment #3

Posted on Mar 12, 2010 by Quick Kangaroo

Hi,

Thanks for the suggestions and here are some new test results by enabling the debug mode.

1) I reran the step 2) in my previous post and recorded the trace in logcat_1.txt, which shows that login failed after connection.

2) I tested the following code following your suggestion: XMPPConnection m_connection = new XMPPConnection("gmail.com"); m_connection.connect(); if (!m_connection.isAuthenticated()) { m_connection.login(login, password); }

Again, the login failed (see logcat_2.txt). Here it shows that jks keystore is not supported.

3) As for network speed, the ping has the following results from the test machine:

Pinging talk.l.google.com [209.85.229.125] with 32 bytes of data:

Reply from 209.85.229.125: bytes=32 time=160ms TTL=48 Reply from 209.85.229.125: bytes=32 time=161ms TTL=48 Reply from 209.85.229.125: bytes=32 time=160ms TTL=48 Reply from 209.85.229.125: bytes=32 time=162ms TTL=48

Ping statistics for 209.85.229.125: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 160ms, Maximum = 162ms, Average = 160ms

Pinging gmail.com [209.85.229.83] with 32 bytes of data:

Reply from 209.85.229.83: bytes=32 time=160ms TTL=48 Reply from 209.85.229.83: bytes=32 time=161ms TTL=48 Reply from 209.85.229.83: bytes=32 time=160ms TTL=48 Reply from 209.85.229.83: bytes=32 time=160ms TTL=48

Ping statistics for 209.85.229.83: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 160ms, Maximum = 161ms, Average = 160ms

Do you have idea what might be the problem? Thanks.

Li

Attachments

Comment #4

Posted on Mar 13, 2010 by Grumpy Rhino

The jks store waring is irrelevant (would matter if you setup your own keystore, mainly for users accepting self-signed certs),

I've deleted your second log as it contained the base64 encoded credentials.

echo -n 'YW5[...]zNg==' | base64 -d | tr '\0' '\n' ; echo

I've tried the pwd, with psi and XML console. Psi omits the @gmail.com, looks like gmail.com user can login as plain users.

I've used the same credentials with my client and it just works, with the very same SASL package.

However I've not yet seen a "D/SMACK ( 757): 02:58:50 PM SENT (1131993696): username@gmail.com" this look suspicious. You do a SASL and NON-SASL auth at the same time....

The TLS error might be livejournal related, I'll created an account soon and try it....

Comment #5

Posted on Mar 14, 2010 by Grumpy Rhino

I've successfully logged in to livejournal.com. See attached log.

However "connect" isn't blocking. Sorry for that, I didn't see it. You should wait for connect to succeed. I'm personally using

    int i = 0;
    while (!isConnected() && i < 100) {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        i += 1;
    }
    if (!isConnected()) {
        return;
    }

Please tell me if that helps....

Attachments

Comment #6

Posted on Mar 23, 2010 by Quick Kangaroo

Hi,

Thanks for the tip. I'm trying to build from your source at http://asmack.googlecode.com/files/asmack-2010.03.03-source.zip. But the following classes in XmlUtil.java are missing:

import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource;

Do you know/have a jar file with these classes? Thanks. Li

Comment #7

Posted on Mar 23, 2010 by Grumpy Rhino

The zip isn't intended for building, use the asmack github repository if needed :)

Comment #8

Posted on Mar 23, 2010 by Grumpy Rhino

Can you tell me if this bug still exists?

Comment #9

Posted on May 3, 2010 by Grumpy Rhino

Mo updates for more than 4 weeks -> closed

Status: WontFix

Labels:
Type-Defect Priority-High