anonymous
2009-08-01 18:27:44 UTC
URL:
<http://gna.org/bugs/?14048>
Summary: starttls failure not caught correctly, cause
exception
Project: XMPP4R
Submitted by: None
Submitted on: Saturday 08/01/2009 at 20:27 CEST
Category: None
Severity: 4 - Important
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email: ppgengler-***@public.gmane.org
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
In the 0.5 version, connection.rb around line 138 there is a ServerError
raised if a 'proceed' is not received in reply to the 'starttls'. However,
the error is blindly grabbing reply.first_element('error'). This is bad for
two reasons:
1) The XMPP Core spec (http://xmpp.org/rfcs/rfc3920.html) says that this
should be 'failure' not error; I can confirm this as I see exceptions being
thrown from errors.rb on the .to_s method of ServerError with a call stack
that points back here. TLS is failing and on the failure its passing in a
nil object to the ServerError.new in connection.rb.
2) Regardless of #1, the raising of the Server error needs to be guarded with
a check on whether reply.first_element('failure') returns anything. If not
then a different error should be generated since there is no known
ErrorResponse to grab.
I've patched my version to solve these issues this way:
if reply.name != 'proceed'
error = reply.first_element('failure')
raise ServerError.new(error) unless error.nil?
raise JabberError.new("Unhandled reply type: #{reply.name}")
end
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?14048>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
<http://gna.org/bugs/?14048>
Summary: starttls failure not caught correctly, cause
exception
Project: XMPP4R
Submitted by: None
Submitted on: Saturday 08/01/2009 at 20:27 CEST
Category: None
Severity: 4 - Important
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email: ppgengler-***@public.gmane.org
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
In the 0.5 version, connection.rb around line 138 there is a ServerError
raised if a 'proceed' is not received in reply to the 'starttls'. However,
the error is blindly grabbing reply.first_element('error'). This is bad for
two reasons:
1) The XMPP Core spec (http://xmpp.org/rfcs/rfc3920.html) says that this
should be 'failure' not error; I can confirm this as I see exceptions being
thrown from errors.rb on the .to_s method of ServerError with a call stack
that points back here. TLS is failing and on the failure its passing in a
nil object to the ServerError.new in connection.rb.
2) Regardless of #1, the raising of the Server error needs to be guarded with
a check on whether reply.first_element('failure') returns anything. If not
then a different error should be generated since there is no known
ErrorResponse to grab.
I've patched my version to solve these issues this way:
if reply.name != 'proceed'
error = reply.first_element('failure')
raise ServerError.new(error) unless error.nil?
raise JabberError.new("Unhandled reply type: #{reply.name}")
end
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?14048>
_______________________________________________
Message sent via/by Gna!
http://gna.org/