X-Git-Url: https://git.distorted.org.uk/~mdw/chopwood/blobdiff_plain/71d74dcfa355c55076eca33939f56d6f8a7b87ce..9e574017f801c1bb4b5d4856e988b892d90246a2:/chpwd diff --git a/chpwd b/chpwd index 3872715..9f483de 100755 --- a/chpwd +++ b/chpwd @@ -30,6 +30,7 @@ import optparse as OP import os as OS; ENV = OS.environ import shlex as SL import sys as SYS +import syslog as L from auto import HOME, VERSION import cgi as CGI @@ -200,12 +201,16 @@ def cli_errors(): if __name__ == '__main__': + L.openlog(OS.path.basename(SYS.argv[0]), 0, L.LOG_AUTH) + if 'REQUEST_METHOD' in ENV: ## This looks like a CGI request. The heavy lifting for authentication ## 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 @@ -240,7 +245,6 @@ if __name__ == '__main__': with cli_errors(): cmd = ssh_setup() CU.set_user(ENV['CHPWD_SSH_USER']) - S.SERVICES['master'].find(CU.USER) with OUT.redirect_to(O.FileOutput()): OPTPARSE.dispatch('userv', cmd) @@ -279,6 +283,7 @@ if __name__ == '__main__': ctx = OPTS.context if OPTS.user: CU.set_user(OPTS.user) + CGI.STATE.kw['user'] = OPTS.user if ctx is None: ctx = 'userv' else: D.opendb()