mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
gefs: only allow 'none' attach when previously authenticated
For each connection, remember if authentication protocol ran successfully and only then, allow attach as 'none' user. This prevents anonymous remote mounts of none. The 'none' user also shouldnt attach to the dump file system.
This commit is contained in:
parent
9645ae07eb
commit
f384231c60
2 changed files with 8 additions and 2 deletions
|
@ -659,6 +659,7 @@ struct Conn {
|
|||
int wfd;
|
||||
int iounit;
|
||||
int versioned;
|
||||
int authok;
|
||||
|
||||
/* fid hash table */
|
||||
Lock fidtablk[Nfidtab];
|
||||
|
|
|
@ -1158,10 +1158,15 @@ fsattach(Fmsg *m)
|
|||
putfid(af);
|
||||
if(af->uid != uid)
|
||||
error(Ebadu);
|
||||
}else if(!fs->noauth && strcmp(m->uname, "none") != 0)
|
||||
error(Ebadu);
|
||||
m->conn->authok = 1; /* none attach allowed now */
|
||||
}else if(!fs->noauth){
|
||||
if(uid != noneid || !m->conn->authok)
|
||||
error(Ebadu);
|
||||
}
|
||||
|
||||
if(strcmp(m->aname, "dump") == 0){
|
||||
if(uid == noneid)
|
||||
error(Eperm);
|
||||
memset(&d, 0, sizeof(d));
|
||||
filldumpdir(&d);
|
||||
}else{
|
||||
|
|
Loading…
Reference in a new issue