[PATCH 0 of 2] acl: support for getting authenticated user from web server (issue298)

Henrik Stuart hg at hstuart.dk
Sun Jun 7 14:59:03 CDT 2009


The following two patches solve two different, albeit related, things
in hgweb and the acl extension:

1) In hgweb, if REMOTE_HOST is not resolved it may be either empty or
contain REMOTE_ADDR, depending on the web server. If the remote party
is connected using IPv6 then the IP address will contain ":"'s that is
used for the "url" constructed for passing to addchangegroup
(remote:proto:remote_host). Thus, remote_host will be URL encoded to
avoid issues with ":"

2) To let the acl extension use the authenticated user for access
control rather than the web server identity, the addchangegroup "url"
is extended to be on the form: (remote:proto:remote_host:remote_user)
where also the remote_user is URL encoded. The ACL extension is
extended to see whether the given url is from a web server and in that
case use the remote_user variable for access control. An
unauthenticated user will be the empty string.

I have checked and verified that none of the bundled hooks use this
url for anything, but user scripts might potentially use it. Not sure
whether we should/can do anything about that.

-- 
Kind regards,
  Henrik Stuart


More information about the Mercurial-devel mailing list