]> git.lizzy.rs Git - plan9front.git/commitdiff
cpu: add -n flag for the remote site to allow "none" authentification method (inspire...
authorcinap_lenrek <cinap_lenrek@felloff.net>
Thu, 5 Dec 2013 21:39:43 +0000 (22:39 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Thu, 5 Dec 2013 21:39:43 +0000 (22:39 +0100)
sys/man/1/cpu
sys/src/cmd/cpu.c

index 812f2c6369082ed7fe749f9a9e9dbca702e9b7ac..b523911a2b8ad99542171c6c9c0be5b1f0b0344c 100644 (file)
@@ -30,6 +30,8 @@ cpu \- connection to CPU server
 .PP
 .B cpu
 [
+.B -n
+] [
 .B -A
 .I address
 ] [
@@ -127,6 +129,11 @@ back to
 This is used if the local host is in a different protection domain than
 the server or if the user wants to log into the server as a different
 user.
+.TP
+.B none
+This skips authentication. This requires the
+.IR -n
+flag to be specified on the remote side.
 .PD
 .PP
 The
@@ -181,6 +188,16 @@ flag is similar but simulates the pre-9P2000 version
 of the 
 .I cpu
 protocol.
+The
+.B -n
+option allows using the
+.B none
+authentication method for incoming connections and must be
+specified before the
+.B -R
+and
+.B -O
+flags.
 .PP
 The
 .B -p
index a3bf5c37131644c7ddccbbfd6d52fe91d5d7f87a..a7e10fcbce2aef135fc97e291ede3978930a0e6f 100644 (file)
@@ -30,6 +30,7 @@ int   notechan;
 int    exportpid;
 char   *system;
 int    cflag;
+int    nflag;
 int    dbg;
 char   *user;
 char   *patternfile;
@@ -59,7 +60,7 @@ struct AuthMethod {
 {
        { "p9",         p9auth,         srvp9auth,},
        { "netkey",     netkeyauth,     netkeysrvauth,},
-//     { "none",       noauth,         srvnoauth,},
+       { "none",       noauth,         srvnoauth,},
        { nil,  nil}
 };
 AuthMethod *am = authmethod;   /* default is p9 */
@@ -176,6 +177,10 @@ main(int argc, char **argv)
        case 'f':
                /* ignored but accepted for compatibility */
                break;
+       case 'n':
+               /* must be specified before -R/-O */
+               nflag++;
+               break;
        case 'A':
                anstring = EARGF(usage());
                break;
@@ -349,7 +354,7 @@ remoteside(int old)
                if(n < 0)
                        fatal("authenticating: %r");
        }
-       if(setamalg(cmd) < 0){
+       if(setamalg(cmd) < 0 || (nflag == 0 && am->sf == srvnoauth)) {
                writestr(fd, "unsupported auth method", nil, 0);
                fatal("bad auth method %s", cmd);
        } else