#2964: TypeError when trying to check authentication level in RPC Server.
----------------------------------------+----------------------------------
 Reporter:  georgetg                    |      Owner:
     Type:  bug                         |     Status:  new
 Priority:  trivial                     |  Milestone:  needs verified
Component:  Core                        |    Version:  other (please
 Keywords:  rpc server exception error  |  specify)
----------------------------------------+----------------------------------
 In file deluge/core/rpcserver.py:

 (connectionMade) - Line 208:
 {{{
 self.factory.authorized_sessions[self.transport.sessionno] =
 AUTH_LEVEL_NONE
 }}}

 Then in (dispatch) - Line 293:

 {{{
 auth_level = self.factory.authorized_sessions[self.transport.sessionno][0]
 if auth_level < method_auth_requirement:
     # This session is not allowed to call this method
     log.debug("Session %s is trying to call a method it is not authorized
 to call!", self.transport.sessionno)
     raise NotAuthorizedError("Auth level too low: %s < %s" % (auth_level,
 method_auth_requirement))
 }}}

 This will throw a **TypeError** if the user is not authenticated, since

 {{{self.factory.authorized_sessions[self.transport.sessionno]}}}
 is AUTH_LEVEL_NONE which is an int.
 The type error would be handled by the following
 {{{except Exception, e:}}}
 which is not the expected behavior of an unauthenticated call.

 A trivial fix would be:
 {{{
 self.factory.authorized_sessions[self.transport.sessionno] =
 (AUTH_LEVEL_NONE, None)
 }}}
 at line 208, but I am not sure if it breaks something else.

--
Ticket URL: <http://dev.deluge-torrent.org/ticket/2964>
Deluge <http://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/deluge-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to