X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/blobdiff_plain/7f0fea566faade7979801728ca4f2a6a4bb53732..fef231404844ba34cfc0394db8967f0aa016763a:/chpwd diff --git a/chpwd b/chpwd index 7190ddf..b4fc8f5 100755 --- a/chpwd +++ b/chpwd @@ -208,7 +208,9 @@ if __name__ == '__main__': ## over HTTP is done in `dispatch_cgi'. with OUT.redirect_to(CGI.HTTPOutput()): - with CGI.cgi_errors(cgi_setup): dispatch_cgi() + with U.Escape() as CGI.HEADER_DONE: + with CGI.cgi_errors(cgi_setup): + dispatch_cgi() elif 'USERV_SERVICE' in ENV: ## This is a Userv request. The caller's user name is helpfully in the @@ -216,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