Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
mikie #1
Member since Jun 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
Subject: StartTLS before Compress
Hello, first of all, thank you very much for this great SDK.
I got my own xmpp server (ejabberd 2.1.4) and i have discovered, that if I use StartTLS+Compress, client with agsXMPP (latest trunk) connects compressed without StartTLS. I would like to share my patch with all.

--- agsxmpp/XmppClientConnection.cs    Wed Jun 09 13:21:07 2010
+++ agsxmpp/XmppClientConnection_new.cs    Wed Jun 09 13:32:44 2010
@@ -1387,7 +1387,14 @@
                 // Stream Features
                 // StartTLS stuff
                 Features f = e as Features;
-                if (m_UseCompression &&
+#if SSL || MONOSSL || BCCRYPTO
+                if (f.SupportsStartTls && m_UseStartTLS)
+                {
+                    DoChangeXmppConnectionState(XmppConnectionState.Securing);
+                    this.Send(new StartTls());
+                }
+#endif
+                else if (m_UseCompression &&
                     f.SupportsCompression &&
                     f.Compression.SupportsMethod(CompressionMethod.zlib))
                 {
@@ -1397,13 +1404,6 @@
                     DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
                     this.Send(new Compress(CompressionMethod.zlib));                   
                 }
-#if SSL || MONOSSL || BCCRYPTO
-                else if (f.SupportsStartTls && m_UseStartTLS)
-                {
-                    DoChangeXmppConnectionState(XmppConnectionState.Securing);
-                    this.Send(new StartTls());
-                }
-#endif
                 else if (f.SupportsRegistration && m_RegisterAccount)
                 {
                     // Do registration after TLS when possible

according to comments, it was correct in past. just switch "if compress" with "if starttls". may be server changed the way of sending stream features, but i think this is the right way, starttls, then compress :)
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this is correct. TLS must be negotiated first.
see also:
http://xmpp.org/extensions/xep-0170.html

I commited new code to SVN.

TLS has build in compression. So when using TLS I recommend to disable compression.

Alex
Avatar
mikie #3
Member since Jun 2010 · 4 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex, after your yesterday commit, the agsXMPP is not buildable :(

Error    1    Source file 'C:\.CVS\agsxmpp\agsxmpp\sasl\Gssapi\SSPIHelper.cs' could not be opened
Error    2    Source file 'C:\.CVS\agsxmpp\agsxmpp\sasl\Gssapi\GssapiMechanism.cs' could not be opened

Could you have a look at it? Thx a lot
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Fixed. Please try again now.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS