chiark / gitweb /
chpwd, userv.rc: Change Userv service protocol to parse options properly.
[chopwood] / chpwd
diff --git a/chpwd b/chpwd
index 9f483deb6877e3a77b3fcc7fae3c93f49736852e..b4fc8f547adbc687bebc7e57931b28fc13f47b55 100755 (executable)
--- a/chpwd
+++ b/chpwd
@@ -218,11 +218,13 @@ if __name__ == '__main__':
 
     with cli_errors():
       OPTS, args = OPTPARSE.parse_args()
+      if not args or args[0] != 'userv':
+        raise U.ExpectedError, (500, 'missing userv token')
       CONF.loadconfig(OPTS.config)
       try: CU.set_user(ENV['USERV_USER'])
       except KeyError: raise ExpectedError, (500, 'USERV_USER unset')
       with OUT.redirect_to(O.FileOutput()):
-        OPTPARSE.dispatch('userv', [ENV['USERV_SERVICE']] + args)
+        OPTPARSE.dispatch('userv', [ENV['USERV_SERVICE']] + args[1:])
 
   elif 'SSH_ORIGINAL_COMMAND' in ENV:
     ## This looks like an SSH request; but we present two different