--- a/src/hg-ssh Wed Oct 31 13:21:37 2018 -0700
+++ b/src/hg-ssh Wed Oct 31 13:22:13 2018 -0700
@@ -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():