AdrianSzymczak / jabber-net

Automatically exported from code.google.com/p/jabber-net
0 stars 0 forks source link

Ignored: AutoLogin = false #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Create a new jabberClient instance, set the proper server and host, and set 
AutoLogin to false.  
Also, setup OnReadText and OnWriteText so you can see what's actually 
happening.  Then simply 
call Connect();

What is the expected output? What do you see instead?

You would expect the jabber client to create a proper connection, but stop 
short of trying to 
authenticate.  Especially since we didn't set a username and password.

What version of the product are you using? On what operating system?
1.0.1  on Windows Vista.

Please provide any additional information below.

After configuring the jabber client as stated above, with AutoLogin = false, I 
get this output:

ExecuteConnect
jabberClient_OnConnect
Warning: overriding existing packet factory
SND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" 
id="28c38991" 
xmlns="jabber:client" to="robbiehanson.com" version="1.0">
RCV: <?xml version='1.0'?><stream:stream xmlns='jabber:client' 
xmlns:stream='http://etherx.jabber.org/streams' id='1008840260' 
from='robbiehanson.com' 
version='1.0' xml:lang='en'>
RCV: <stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-
sasl'><mechanism>DIGEST-
MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><register 
xmlns='http://jabber.org/features/iq-register'/></stream:features>
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-
sasl'>bm9uY2U9IjI3NjY5MDk2MTYiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09b
WQ1LXNlc3M=</challenge>
jabberClient_OnError: jabber.connection.sasl.SASLException: Missing SASL 
username directive

Original issue reported on code.google.com by robbieha...@gmail.com on 30 Mar 2008 at 3:35

GoogleCodeExporter commented 9 years ago
Apparently, this never worked with SASL.  What sort of action are you going to 
take
in OnLoginRequired?  I'm trying to picture the use case so I can figure out how 
the
API should change.  I guess I could add a new state, and make the Login() method
start the SASL process when you're in that state.

Original comment by hil...@gmail.com on 31 Mar 2008 at 8:18

GoogleCodeExporter commented 9 years ago
What I am looking to do is simply register a user.  This is within a welcome 
screen that prompts the user to create an account.  Looking into the issue 
further:

If username and password are null, then this happens:

SND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" 
id="cd16dc41" xmlns="jabber:client" to="robbiehanson.com" version="1.0">
Warning: overriding existing packet factory
RCV: <?xml version='1.0'?><stream:stream xmlns='jabber:client' 
xmlns:stream='http://etherx.jabber.org/streams' id='1490986094' 
from='robbiehanson.com' version='1.0' xml:lang='en'>
RCV: <stream:features><mechanisms 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mecha
nism>PLAIN</mechanism></mechanisms><register 
xmlns='http://jabber.org/features/iq-
register'/></stream:features>
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
jabberClient_OnError: jabber.connection.sasl.SASLException: Missing SASL 
username directive

Now if we check for a SASLException in the OnError method, and call Register at 
this point, we get an infinite loop:

[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
jabberClient_OnError: jabber.connection.sasl.SASLException: Missing SASL 
username directive
SND: <iq id="JN_1" type="get" to="robbiehanson.com"><query 
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_1' type='result'><query 
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnError: jabber.connection.sasl.SASLException: Invalid SASL 
protocol
SND: <iq id="JN_2" type="get" to="robbiehanson.com"><query 
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_2' type='result'><query 
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnError: jabber.connection.sasl.SASLException: Invalid SASL 
protocol
...etc

Now if we instead use an empty string for both username and password, then we 
get this:

[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
SND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">...</response>
RCV: <failure 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>
jabberClient_OnError: jabber.connection.sasl.AuthenticationFailedException: 
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>

And registering at this point will work correctly:

[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
SND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">...</response>
RCV: <failure 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>
jabberClient_OnError: jabber.connection.sasl.AuthenticationFailedException: 
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
SND: <iq id="JN_1" type="get" to="robbiehanson.com"><query 
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_1' type='result'><query 
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnRegisterInfo
SND: <iq type="set" id="JN_2" to="robbiehanson.com"><query 
xmlns="jabber:iq:register"><instructions>...</instructions><username>johndoe</us
ername><password>...</password></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_2' type='result'><query 
xmlns='jabber:iq:register'><instructions>..</instructions><username>johndoe</use
rname><password>...</password></query></iq>
jabberClient_OnRegistered

I should note, that all of these examples had AutoLogin set to false.
Also, I had an event setup for OnLoginRequired, which was never called.  I 
tested it multiple times to be sure.

Let me know if there's anything else I can answer for you.

Original comment by robbieha...@gmail.com on 1 Apr 2008 at 1:21

GoogleCodeExporter commented 9 years ago
Fixed.  Just call Login() when you're done with registration.

Original comment by hil...@gmail.com on 17 Apr 2008 at 7:54