u9fs: fix misuse of Fcall.afid in p9any authentication module. (from sources patch/u9fs-afid)
U9fs(4) misuses Fcall.afid in its p9any authentication module. The afid field of Fcall structure is only valid with Tauth or Tattach. Tread, Twrite, Tclunk should use rx->fid instead. It's been lucky so far to get the job done because rx->afid survives from previous Tauth/Tattach. The issue pops up when several authentications happen concurrently. Test case: u9fs = 'host with u9fs on tcp!*!564' 9fs $u9fs; for(i in 1 2 3 4 5 6 7 8){ 9fs $u9fs & }; wait Should: no errors Should not: mount failed: authentication failed
This commit is contained in:
parent
da6a10c417
commit
b77eda8fc7
1 changed files with 7 additions and 5 deletions
|
@ -367,9 +367,11 @@ p9anyattach(Fcall *rx, Fcall *tx)
|
|||
return ep;
|
||||
if (chatty9p)
|
||||
fprint(2, "p9anyattach: afid %d state %d\n", rx->afid, sp->state);
|
||||
if (sp->state == Established && strcmp(rx->uname, sp->uname) == 0
|
||||
&& strcmp(rx->aname, sp->aname) == 0)
|
||||
if(sp->state == Established && strcmp(rx->uname, sp->uname) == 0
|
||||
&& strcmp(rx->aname, sp->aname) == 0){
|
||||
rx->uname = sp->t.suid;
|
||||
return nil;
|
||||
}
|
||||
return "authentication failed";
|
||||
}
|
||||
|
||||
|
@ -392,7 +394,7 @@ p9anyread(Fcall *rx, Fcall *tx)
|
|||
char *ep;
|
||||
|
||||
Fid *f;
|
||||
f = oldauthfid(rx->afid, (void **)&sp, &ep);
|
||||
f = oldauthfid(rx->fid, (void **)&sp, &ep);
|
||||
if (f == nil)
|
||||
return ep;
|
||||
if (chatty9p)
|
||||
|
@ -437,7 +439,7 @@ p9anywrite(Fcall *rx, Fcall *tx)
|
|||
|
||||
Fid *f;
|
||||
|
||||
f = oldauthfid(rx->afid, (void **)&sp, &ep);
|
||||
f = oldauthfid(rx->fid, (void **)&sp, &ep);
|
||||
if (f == nil)
|
||||
return ep;
|
||||
if (chatty9p)
|
||||
|
@ -515,7 +517,7 @@ p9anyclunk(Fcall *rx, Fcall *tx)
|
|||
AuthSession *sp;
|
||||
char *ep;
|
||||
|
||||
f = oldauthfid(rx->afid, (void **)&sp, &ep);
|
||||
f = oldauthfid(rx->fid, (void **)&sp, &ep);
|
||||
if (f == nil)
|
||||
return ep;
|
||||
if (chatty9p)
|
||||
|
|
Loading…
Reference in a new issue