Edgewall Software

Ticket #6982: x509-strip-patch.txt

File x509-strip-patch.txt, 1.6 KB (added by dirkx@…, 4 years ago)

x509 patch against trunk (r6673)

Line 
1ndex: versioncontrol/svn_fs.py
2===================================================================
3--- versioncontrol/svn_fs.py    (revision 6673)
4+++ versioncontrol/svn_fs.py    (working copy)
5@@ -848,6 +848,15 @@
6        # we _hope_ it's UTF-8, but can't be 100% sure (#4321)
7        message = message and to_unicode(message, 'utf-8')
8        author = author and to_unicode(author, 'utf-8')
9+
10+        # If the author looks like an x509 Distingished Name (DN)
11+        # then extract just the CN (Common Name). XX and emailAddress?
12+        if author:
13+          if author.find('/CN=') > -1:
14+           author= author[author.find('/CN=')+4:];
15+           if (author.find('/') > -1):
16+              author= author[:author.find('/')]
17+
18        _date = self._get_prop(core.SVN_PROP_REVISION_DATE)
19        if _date:
20            ts = core.svn_time_from_cstring(_date, self.pool()) / 1000000
21Index: web/auth.py
22===================================================================
23--- web/auth.py (revision 6673)
24+++ web/auth.py (working copy)
25@@ -75,6 +75,18 @@
26        if self.ignore_case:
27            authname = authname.lower()
28
29+        # If the author looks like an x509 Distingished Name (DN)
30+        # then extract just the CN (Common Name). Note that we
31+        # should not concat things like <emailAddress> as the
32+        # very same name is also used for XS controls - and then
33+        # becomes hard to enter from trac-admin.
34+        #
35+        if author:
36+          if author.find('/CN=') > -1:
37+           author= author[author.find('/CN=')+4:];
38+           if (author.find('/') > -1):
39+              author= author[:author.find('/')]
40+
41        return authname
42