chiark / gitweb /
backend.py: Use configured delimiter for joining fields.
[chopwood] / chpwd
diff --git a/chpwd b/chpwd
index 38727152669596a67963e0d24f473a9177cff286..9f483deb6877e3a77b3fcc7fae3c93f49736852e 100755 (executable)
--- 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()