powered by Jive Software

Smack 4.2.1 snapshot: potential bug when attempting to PopulateHostAddresses in AbstractXMPPConnection

I am trying to implement security features for an android app and have tracked down a problem coming from populateHostAddresses() in AbstractXMPPConnection.

It appears the issue is the specific constructor this function uses for HostAddress(port, HostAddress). The issue is that this constructor calls the main constructor HostAddress(fqdn, port, List of iNetAddresses) while passing null into the FQDN.

I think this is a bug, and should be changed to use the main constructor so that the FQDN is not always null. Alternatively the HostAddress constructor HostAddress(port, hostAddress) could be changed to attempt to extract an FQDN from the hostAddress and pass that into the main constructor.

Trevor

Your problem description is hard to follow if there is no description of what actually does go wrong.

As far as I can see the code is correct. If config.hostAddress is set, then we have an InetAddress, which is usually an IP, we don’t have an DNS name and want to avoid an unnecessary DNS lookup.

But I bet there is some part of Smack that assumes that fqdn is always non null. That’s what should be fixed if it’s the case.

Gotcha,

In that case, the issue in in XMPPTCPConnection.connectUsingConfiguration()

line 565: String host = hostAddress.getFQDN();

edit: saved before I meant to, but that variable should fallback to something when FQDN is null.

another edit: this should be the only instance of this bug, PopulateHostAddresses is only called from connectUsingConfiguration().

Thanks,

Trevor

Created [SMACK-772] HostAddress must deal with ‘fqdn’ being null. - IgniteRealtime JIRA