sr6582924 / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

problem login to gtalk and livejournal servers in android emulator #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

2. 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

Original issue reported on code.google.com by avayalab...@gmail.com on 25 Jan 2010 at 9:07

Attachments:

GoogleCodeExporter commented 9 years ago
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/XMPPC
onnection.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é

Original comment by rtreffer@gmail.com on 5 Feb 2010 at 12:53

GoogleCodeExporter commented 9 years ago
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é

Original comment by rtreffer@gmail.com on 6 Feb 2010 at 3:56

GoogleCodeExporter commented 9 years ago
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

Original comment by avayalab...@gmail.com on 12 Mar 2010 at 9:07

Attachments:

GoogleCodeExporter commented 9 years ago
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): <iq id="575KV-0" 
type="get"><query
xmlns="jabber:i
q:auth"><username>username@gmail.com</username></query></iq>"
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....

Original comment by rtreffer@gmail.com on 13 Mar 2010 at 2:09

GoogleCodeExporter commented 9 years ago
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....

Original comment by rtreffer@gmail.com on 14 Mar 2010 at 11:30

Attachments:

GoogleCodeExporter commented 9 years ago
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

Original comment by avayalab...@gmail.com on 23 Mar 2010 at 8:06

GoogleCodeExporter commented 9 years ago
The zip isn't intended for building, use the asmack github repository if needed 
:)

Original comment by rtreffer@gmail.com on 23 Mar 2010 at 11:13

GoogleCodeExporter commented 9 years ago
Can you tell me if this bug still exists?

Original comment by rtreffer@gmail.com on 23 Mar 2010 at 11:35

GoogleCodeExporter commented 9 years ago
Mo updates for more than 4 weeks -> closed

Original comment by rtreffer@gmail.com on 3 May 2010 at 9:06