diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-10 10:11:45 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-10 10:11:45 +0200 |
commit | 23742053f5ee70cd394c33f28f3e6547e9e8e31d (patch) | |
tree | 0ce952aeda0f616e7a79701b514ba7a07cbd2bd6 /sys/src/cmd/srv.c | |
parent | b241dd11596ac16cb21ba1ffc24abd7a46153a09 (diff) |
mount, srv: add -N flag to skip authentication and attach anonymously as "none"
Diffstat (limited to 'sys/src/cmd/srv.c')
-rw-r--r-- | sys/src/cmd/srv.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/src/cmd/srv.c b/sys/src/cmd/srv.c index c42132e25..b706e3fa7 100644 --- a/sys/src/cmd/srv.c +++ b/sys/src/cmd/srv.c @@ -10,12 +10,13 @@ void rpc(int, int); void post(char*, int); void mountfs(char*, int); int doauth = 1; +int asnone = 0; void usage(void) { - fprint(2, "usage: %s [-abcCm] [net!]host [srvname [mtpt]]\n", argv0); - fprint(2, " or %s -e [-abcCm] command [srvname [mtpt]]\n", argv0); + fprint(2, "usage: %s [-abcCmnNq] [net!]host [srvname [mtpt]]\n", argv0); + fprint(2, " or %s -e [-abcCmnNq] command [srvname [mtpt]]\n", argv0); exits("usage"); } @@ -106,6 +107,9 @@ main(int argc, char *argv[]) domount = 1; reallymount = 1; break; + case 'N': + asnone = 1; + /* no break */ case 'n': doauth = 0; break; @@ -197,6 +201,15 @@ Mount: if(domount == 0 || reallymount == 0) exits(0); + if(asnone){ + try = open("#c/user", OWRITE); + if(try < 0 || write(try, "none", 4) != 4){ + fprint(2, "srv %s: can't become none: %r\n", dest); + exits("becomenone"); + } + try = 0; + } + if((!doauth && mount(fd, -1, mtpt, mountflag, "") < 0) || (doauth && amount(fd, mtpt, mountflag, "") < 0)){ err[0] = 0; |