﻿id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
10826,Authorization errors when authenticating via XmlRpc,rjollos,hasienda,"I'm seeing the following error when trying to execute commands with !XmlRpc.

{{{
2013-01-24 15:01:29,529 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x1f6f7290>
2013-01-24 15:01:29,529 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'anonymous'
2013-01-24 15:01:29,530 Trac[xml_rpc] DEBUG: RPC(xml) call by 'anonymous', method 'ticket.milestone.getAll' with args: ()
2013-01-24 15:01:29,531 Trac[authz_policy] DEBUG: Checking XML_RPC on
2013-01-24 15:01:29,532 Trac[perm] DEBUG: No policy allowed anonymous performing XML_RPC on None
2013-01-24 15:01:29,533 Trac[web_ui] ERROR: RPC(XML-RPC) Error
Traceback (most recent call last):
  File ""build/bdist.linux-x86_64/egg/tracrpc/web_ui.py"", line 149, in _rpc_process
    req.perm.require('XML_RPC') # Need at least XML_RPC
  File ""/usr/local/python26_trac12/lib/python2.6/site-packages/Trac-0.12.3-py2.6.egg/trac/perm.py"", line 576, in require
    raise PermissionError(action, resource, self.env)
PermissionError
}}}

Further up in the logs I see:
{{{
2013-01-24 15:01:29,472 Trac[web_ui] DEBUG: LoginModule._remote_user: Authentication attempted for 'None'
2013-01-24 15:01:29,473 Trac[web_ui] WARNING: LoginModule.authenticate: 'REMOTE_USER' was set to 'jenkins'
2013-01-24 15:01:29,473 Trac[web_ui] DEBUG: LoginModule.authenticate: Set 'REMOTE_USER' = 'None'
}}}

The issue seems to be with this bit of code in `web_ui`'s `LoginModule.authenticate` method:
{{{
#!python
if not 'REMOTE_USER' in req.environ or self.environ_auth_overwrite:
    if 'REMOTE_USER' in req.environ:
        # Complain about another component setting environment
        # variable for authenticated user.
        self.env.log.warn(""LoginModule.authenticate: ""
                          ""'REMOTE_USER' was set to '%s'""
                          % req.environ['REMOTE_USER'])
        self.env.log.debug(""LoginModule.authenticate: Set ""
                           ""'REMOTE_USER' = '%s'"" % user)
        req.environ['REMOTE_USER'] = user
}}}",defect,new,normal,AccountManagerPlugin,normal,,authentication,osimons,0.12
