[viewvc-dev] viewvc-1.1.0-beta1 issue with svnauthz and username case
eliott <[email protected]> Wed, 18 Feb 2009 10:40:11 -0800
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <428d921d0902181040t7527e39fs63f29c4b3bdd2cf1__30873.3398597271$1234984647$gmane$org@mail.gmail.com> |
Greetings,
Version:
viewvc-1.1.0-beta1
Problem description:
Our svnauthz file has usernames in Mixed_Case. The apache auth
passes the case to the cgi scripts (we are running viewvc as cgi).
However, the python ConfigParser by default does a 'lower' operation
on the results of cp.option(). This causes our usernames to never
match their permissions `as parsed` from the authz file by viewvc.
This happens in def _process_access_section(section) around about line
126 at `cp.options(section)`.
Possible fixes:
I had two potential workarounds, of which I am currently utilizing the first.
1. lib/vcauth/svnauthz/__init__.py line 25.
- self.username = username
+ self.username = username.lower()
This forces the passed in cgi var username to lowercase. This then
matches the cp.option which is forced to lowercase by the
ConfigParser.
2. override the ConfigParser optionxform with a 'monkey patch'.
lib/vcauth/svnauthz/__init__.py line 20.
+ ConfigParser.optionxform = str
Another alternative would be to subclass ConfigParser and override the
optionxform there. That would arguably be cleaner than the monkeypatch
method.
I am using the first method, because monkeypatching 'feels' a bit
dirty to me, I don't believe we have any case collisions with
usernames, and I don't know offhand if the change for #2 would have
any other efffects based on case handling in the existing code.
Hope this is helpful to someone.
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=1187483
To unsubscribe from this discussion, e-mail: [[email protected]].