]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/tlssrv.c
awk: make empty FS unicodely-correct.
[plan9front.git] / sys / src / cmd / tlssrv.c
index 853e208d6ea665d05d218de12a79c3b99fd233a0..cd94e03c045e5ee1c58cc836f9b5d481ce4e17f9 100644 (file)
@@ -32,8 +32,7 @@ reporter(char *fmt, ...)
 void
 usage(void)
 {
-       fprint(2, "usage: tlssrv [-a [-k keyspec]] [-c cert] [-D] [-l logfile] [-r remotesys] cmd [args...]\n");
-       fprint(2, "  after  auth/secretpem key.pem > /mnt/factotum/ctl\n");
+       fprint(2, "usage: tlssrv [-D] -[aA] [-k keyspec]] [-c cert] [-l logfile] [-r remotesys] cmd [args...]\n");
        exits("usage");
 }
 
@@ -50,7 +49,10 @@ main(int argc, char *argv[])
                debug++;
                break;
        case 'a':
-               auth++;
+               auth = 1;
+               break;
+       case 'A':
+               auth = -1;      /* authenticate, but dont change user */
                break;
        case 'k':
                keyspec = EARGF(usage());
@@ -82,8 +84,18 @@ main(int argc, char *argv[])
                if(ai == nil)
                        sysfatal("auth_proxy: %r");
 
-               if(auth_chuid(ai, nil) < 0)
-                       sysfatal("auth_chuid: %r");
+               if(auth == 1){
+                       Dir nd;
+
+                       if(auth_chuid(ai, nil) < 0)
+                               sysfatal("auth_chuid: %r");
+
+                       /* chown network connection */
+                       nulldir(&nd);
+                       nd.mode = 0660;
+                       nd.uid = ai->cuid;
+                       dirfwstat(0, &nd);
+               }
 
                conn->pskID = "p9secret";
                conn->psk = ai->secret;