mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
srv: add -n flag to reject auth by clients
This commit is contained in:
parent
9b25329723
commit
151b86a037
2 changed files with 17 additions and 5 deletions
|
@ -4,7 +4,7 @@ srv, 9fs \- start network file service
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B srv
|
.B srv
|
||||||
[
|
[
|
||||||
.B -a
|
.B -an
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
.B -k
|
.B -k
|
||||||
|
@ -37,6 +37,14 @@ to post a pre-authenticated connection to the file system
|
||||||
(by default, the empty string;
|
(by default, the empty string;
|
||||||
see
|
see
|
||||||
.IR attach (9p)).
|
.IR attach (9p)).
|
||||||
|
.PP
|
||||||
|
The
|
||||||
|
.B -n
|
||||||
|
option causes
|
||||||
|
.I srv
|
||||||
|
to reject authentication attempts by clients,
|
||||||
|
useful if the remote server is known not to require authentication.
|
||||||
|
.PP
|
||||||
.I Srv
|
.I Srv
|
||||||
authenticates over the 9P connection to establish a valid auth fid.
|
authenticates over the 9P connection to establish a valid auth fid.
|
||||||
.IR Keypattern ,
|
.IR Keypattern ,
|
||||||
|
|
|
@ -41,6 +41,9 @@ threadmain(int argc, char **argv)
|
||||||
case 'a':
|
case 'a':
|
||||||
doauth = 1;
|
doauth = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
doauth = -1;
|
||||||
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
keypattern = EARGF(usage());
|
keypattern = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
@ -55,7 +58,7 @@ threadmain(int argc, char **argv)
|
||||||
if((fd = dial(addr, nil, nil, nil)) < 0)
|
if((fd = dial(addr, nil, nil, nil)) < 0)
|
||||||
sysfatal("dial %s: %r", addr);
|
sysfatal("dial %s: %r", addr);
|
||||||
|
|
||||||
if(doauth)
|
if(doauth > 0)
|
||||||
xauth();
|
xauth();
|
||||||
|
|
||||||
if(argc == 2)
|
if(argc == 2)
|
||||||
|
@ -216,7 +219,7 @@ post9pservice(int fd, char *name)
|
||||||
dup(fd, 1);
|
dup(fd, 1);
|
||||||
for(i=3; i<20; i++)
|
for(i=3; i<20; i++)
|
||||||
close(i);
|
close(i);
|
||||||
if(doauth)
|
if(doauth > 0)
|
||||||
execlp("9pserve", "9pserve", "-u",
|
execlp("9pserve", "9pserve", "-u",
|
||||||
"-M",
|
"-M",
|
||||||
smprint("%d", msize),
|
smprint("%d", msize),
|
||||||
|
@ -225,7 +228,8 @@ post9pservice(int fd, char *name)
|
||||||
smprint("%d", afid),
|
smprint("%d", afid),
|
||||||
s, (char*)0);
|
s, (char*)0);
|
||||||
else
|
else
|
||||||
execlp("9pserve", "9pserve", "-u", s, (char*)0);
|
execlp("9pserve", "9pserve",
|
||||||
|
doauth < 0 ? "-nu" : "-u", s, (char*)0);
|
||||||
fprint(2, "exec 9pserve: %r\n");
|
fprint(2, "exec 9pserve: %r\n");
|
||||||
_exits("exec");
|
_exits("exec");
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue