# HG changeset patch # User Paul Crowley # Date 1255362726 -3600 # Node ID 00b48d7bdfa020c34bd31d1cbe1a31c9b6150b31 # Parent 84e9e33d866b365e1ad630bb47f79ee39a276a52 Improve check on whether user supplied a command diff -r 84e9e33d866b -r 00b48d7bdfa0 src/hg-ssh --- a/src/hg-ssh Mon Oct 12 16:25:02 2009 +0100 +++ b/src/hg-ssh Mon Oct 12 16:52:06 2009 +0100 @@ -89,9 +89,11 @@ if os.path.isfile(f): ruleset.rules.readfile(f) -cmd = os.environ.get('SSH_ORIGINAL_COMMAND', '') +cmd = os.environ.get('SSH_ORIGINAL_COMMAND', None) try: - if cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'): + if cmd is None: + fail("direct logins on the hg account prohibited") + elif cmd.startswith('hg -R ') and cmd.endswith(' serve --stdio'): repo = getrepo("read", cmd[6:-14]) if not os.path.isdir(repo + "/.hg"): fail("no such repository %s" % repo) @@ -104,8 +106,6 @@ if d != "" and not os.path.isdir(d): os.makedirs(d) dispatch.dispatch(['init', repo]) - elif cmd == "": - fail("direct logins on the hg account prohibited ") else: fail("illegal command %r" % cmd) except ruleset.AccessException: