powered by Jive Software

Smack 4.1.0 is building a wrong XML (invalid 'from' value)


#1

Hi guys,

I’m using the version 4.1.0 of Smack to develop my XMPP client and I’ve found a problem while constructing one of the XMLs that are being sent to connect to my XMPP server.

The following code:

XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder()
                    .setUsernameAndPassword(UserUtils.userWithDomain(user), password).setSendPresence(false).setResource(PreferenceUtils.getDeviceUUID())
                    .setServiceName(AppConstants.JID_NAME)
                    .setSecurityMode(ConnectionConfiguration.SecurityMode.required)
                    .setCustomSSLContext(NepcomSSLSocketFactory.createNepcomSocketContext())
                    .setHost(AppConstants.XMPP_HOST_NAME)
                    .setCompressionEnabled(true).setEnabledSSLProtocols(new String[]{TLSUtils.PROTO_TLSV1_2, TLSUtils.PROTO_TLSV1_1, TLSUtils.PROTO_TLSV1})
                    .setPort(AppConstants.HOST_XMPP_PORT).setDebuggerEnabled(true).setCallbackHandler(new CallbackHandler() {
                        @Override
                        public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                            Log.d(AppConstants.TAG, "Callback");
                        }
                    });

Is producing the following XML:

<<"<stream:stream xmlns='jabber:client' to='ejabberd.domain.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='username@ejabberd.domain.com@ejabberd.domain.com' xml:lang='en'>">>

That, as you can see, is setting a wrong value to the attribute ‘from’.
In order to provide more info, my “ServiceName” is “ejabberd.domain.com”, which is the same as “Host”.
I suppose that the expected format for the ‘from’ value is something like: “username@hostname/device”, but that’s not happening…

Is there any way to solve this issue without updating the version of Smack?

I’ve already finished almost all my client and updating the version will imply a lot of changes, however, I think that solving the exposed problem will be enough for me.

Thanks a lot!


#2

The value of 'from at this stage is not really meaningful (as the sender hasn’t been authenticated yet). It is more meant as debugging aid here.

Does is anyhow affect the connection establishment?