src/hg-ssh
branchdebian
changeset 248 107d28ce67f5
parent 244 48fab30c38e1
child 275 2e781d52f76e
--- a/src/hg-ssh	Fri Dec 18 13:25:45 2009 +0000
+++ b/src/hg-ssh	Sat Dec 19 19:21:41 2009 +0000
@@ -1,14 +1,4 @@
 #!/usr/bin/env python
-#
-# Copyright 2008-2009 LShift Ltd
-# Copyright 2005-2007 by Intevation GmbH <intevation@intevation.de>
-# Authors:
-# Paul Crowley <paul@lshift.net>
-# Thomas Arendsen Hein <thomas@intevation.de>
-# with ideas from  Mathieu PASQUET <kiorky@cryptelium.net>
-#
-# This software may be used and distributed according to the terms
-# of the GNU General Public License, incorporated herein by reference.
 
 """
 hg-ssh - limit access to hg repositories reached via ssh.  Part of
@@ -55,7 +45,7 @@
 def getrepo(op, repo):
     # First canonicalise, then check the string, then the rules
     # and finally the filesystem.
-    repo = repo.rstrip("/")
+    repo = repo.strip().rstrip("/")
     if len(repo) == 0:
         fail("path to repository seems to be empty")
     if repo.startswith("/"):
@@ -69,6 +59,9 @@
 
 config.initExe()
 
+for k,v in config.getEnv():
+    os.environ[k.upper()] = v
+
 if len(sys.argv) == 3 and sys.argv[1] == "--base64":
     ruleset.rules.set(user = base64.b64decode(sys.argv[2]))
 elif len(sys.argv) == 2:
@@ -77,9 +70,6 @@
     fail("hg-ssh wrongly called, is authorized_keys corrupt? (%s)" 
         % sys.argv)
 
-for k,v in config.getEnv():
-    os.environ[k] = v
-
 os.chdir(config.getReposPath())
 
 for f in config.getAccessPaths():