equal
deleted
inserted
replaced
43 checkParents(path) |
43 checkParents(path) |
44 |
44 |
45 def getrepo(op, repo): |
45 def getrepo(op, repo): |
46 # First canonicalise, then check the string, then the rules |
46 # First canonicalise, then check the string, then the rules |
47 # and finally the filesystem. |
47 # and finally the filesystem. |
48 repo = repo.rstrip("/") |
48 repo = repo.strip().rstrip("/") |
49 if len(repo) == 0: |
49 if len(repo) == 0: |
50 fail("path to repository seems to be empty") |
50 fail("path to repository seems to be empty") |
51 if repo.startswith("/"): |
51 if repo.startswith("/"): |
52 fail("absolute paths are not supported") |
52 fail("absolute paths are not supported") |
53 checkDots(repo) |
53 checkDots(repo) |
57 checkParents(repo) |
57 checkParents(repo) |
58 return repo |
58 return repo |
59 |
59 |
60 config.initExe() |
60 config.initExe() |
61 |
61 |
|
62 for k,v in config.getEnv(): |
|
63 os.environ[k.upper()] = v |
|
64 |
62 if len(sys.argv) == 3 and sys.argv[1] == "--base64": |
65 if len(sys.argv) == 3 and sys.argv[1] == "--base64": |
63 ruleset.rules.set(user = base64.b64decode(sys.argv[2])) |
66 ruleset.rules.set(user = base64.b64decode(sys.argv[2])) |
64 elif len(sys.argv) == 2: |
67 elif len(sys.argv) == 2: |
65 ruleset.rules.set(user = sys.argv[1]) |
68 ruleset.rules.set(user = sys.argv[1]) |
66 else: |
69 else: |
67 fail("hg-ssh wrongly called, is authorized_keys corrupt? (%s)" |
70 fail("hg-ssh wrongly called, is authorized_keys corrupt? (%s)" |
68 % sys.argv) |
71 % sys.argv) |
69 |
|
70 for k,v in config.getEnv(): |
|
71 os.environ[k.upper()] = v |
|
72 |
72 |
73 os.chdir(config.getReposPath()) |
73 os.chdir(config.getReposPath()) |
74 |
74 |
75 for f in config.getAccessPaths(): |
75 for f in config.getAccessPaths(): |
76 if os.path.isfile(f): |
76 if os.path.isfile(f): |