diff -r a286d6c6b19c -r 7a1d6b228af6 src/hg-ssh --- a/src/hg-ssh Wed Mar 05 12:16:46 2014 +0100 +++ b/src/hg-ssh Sun Dec 14 20:30:25 2014 +0100 @@ -38,13 +38,26 @@ os.environ[k.upper()] = v if len(sys.argv) == 3 and sys.argv[1] == "--base64": - ruleset.rules.set(user = base64.b64decode(sys.argv[2])) + user = base64.b64decode(sys.argv[2]) + ruleset.rules.set(user = user) elif len(sys.argv) == 2: - ruleset.rules.set(user = sys.argv[1]) + user = sys.argv[1] + ruleset.rules.set(user = user) else: fail("hg-ssh wrongly called, is authorized_keys corrupt? (%s)" % sys.argv) +paths = [] +path = user +while path: + path, tail = os.path.split(path) + paths.append(tail) +paths.reverse() +i = config.getUserPathIndex() +if i >= 0 and i < len(paths): + user = paths[i] +os.environ['LOGNAME'] = user + os.chdir(config.getReposPath()) for f in config.getAccessPaths():