Bug 63371

Summary: Zimbra Server 7.0 doesn't like <?xml header after <starttls>
Product: Wocky Reporter: Will Thompson <will>
Component: GeneralAssignee: Telepathy bugs list <telepathy-bugs>
Status: NEW --- QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: will
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Will Thompson 2013-04-10 10:44:37 UTC
Jaromír Svoboda reported not being able to connect to Zimbra Server 7.0 using Telepathy, while Pidgin works fine. I had a look. Everything goes fine until just after the starttls handshake. Then:

(lt-wocky-receive-messages:2078): wocky-DEBUG: real_verify_async: wocky-tls-handler.c:248: Cert error: 'SSL Certificate for mk-pc.cz is insecure (unknown signer)', but ignore-ssl-errors is set
(lt-wocky-receive-messages:2078): wocky-DEBUG: xmpp_init: wocky-connector.c:1106: sending XMPP stream open to server
(lt-wocky-receive-messages:2078): wocky-DEBUG: wocky_xmpp_writer_stream_open: wocky-xmpp-writer.c:302: Writing stream opening: <?xml version='1.0' encoding='UTF-8'?>
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to="mk-pc.cz" version="1.0">

(lt-wocky-receive-messages:2078): wocky-DEBUG: xmpp_init_sent_cb: wocky-connector.c:1127: waiting for stream open from server
(lt-wocky-receive-messages:2078): wocky-DEBUG: Parsing chunk: </stream:stream>
(lt-wocky-receive-messages:2078): wocky-DEBUG: _error: wocky-xmpp-reader.c:687: Parsing failed StartTag: invalid element name

(lt-wocky-receive-messages:2078): wocky-DEBUG: xmpp_init_recv_cb: wocky-connector.c:1159: TLS Negotiated: received XMPP version=(unspecified) stream open from server

** (lt-wocky-receive-messages:2078): WARNING **: Couldn't connect: Server not XMPP 1.0 Compliant

So we send <?xml ...?><stream:stream ...>, and the server replies with </stream:stream>. Weird!

I looked at what Pidgin does. The difference is that Pidgin only sends the <?xml ?> header when first opening the (unencrypted stream), whereas Wocky sends it when re-opening the stream after <starttls/> <proceed/> and the SSL handshake.

I commented out the "<?xml ..." \ line in wocky_xmpp_writer_stream_open() and the problem went away:

(lt-wocky-receive-messages:6283): wocky-DEBUG: xmpp_init: wocky-connector.c:1106: sending XMPP stream open to server
(lt-wocky-receive-messages:6283): wocky-DEBUG: wocky_xmpp_writer_stream_open: wocky-xmpp-writer.c:301: Writing stream opening: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to="mk-pc.cz" version="1.0">

(lt-wocky-receive-messages:6283): wocky-DEBUG: xmpp_init_sent_cb: wocky-connector.c:1127: waiting for stream open from server
(lt-wocky-receive-messages:6283): wocky-DEBUG: Parsing chunk: <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="mk-pc.cz" id="4fa528ee" xml:lang="en" version="1.0"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/></stream:features>

So, the server sends back the <?xml ?> header in its stream re-opening reply, but chokes if we send one.

I think this is a bug in Zimbra.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.