Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable sync: make sure passwords for ssh urls are not shown in cleartext

For example, for the URL

ssh://john:mypwd@hg.intevation.org:6666/mercurial/crewXX

the password was visible in cleartext in the UI.

Changeset b2c17f59e17a

Parent 1356bfed839a

by Adrian Buehlmann

Changes to one file · Browse files at b2c17f59e17a Showing diff from parent 1356bfed839a Diff from another changeset...

 
28
29
30
31
32
33
34
35
36
37
 
38
 
 
 
 
 
 
 
 
 
 
39
40
41
 
28
29
30
 
 
 
 
 
 
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@@ -28,14 +28,18 @@
 _schemes = ['local', 'ssh', 'http', 'https']    def parseurl(path): - m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path) - if m: - user = m.group(2) - host = m.group(3) - port = m.group(5) - folder = m.group(7) or '.' - passwd = '' + if path.startswith('ssh://'):   scheme = 'ssh' + p = path[len('ssh://'):] + user, passwd = None, None + if p.find('@') != -1: + user, p = tuple(p.split('@')) + if user.find(':') != -1: + user, passwd = tuple(user.split(':')) + m = re.match(r'([^:/]+)(:(\d+))?(/(.*))?$', p) + host = m.group(1) + port = m.group(3) + folder = m.group(5) or '.'   elif path.startswith('http://') or path.startswith('https://'):   snpaqf = urlparse.urlparse(path)   scheme, netloc, folder, params, query, fragment = snpaqf