* [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module
@ 2013-11-27 10:00 yaroslav
2013-11-27 10:15 ` erik quanstrom
0 siblings, 1 reply; 3+ messages in thread
From: yaroslav @ 2013-11-27 10:00 UTC (permalink / raw)
To: 9fans
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
<patch/diff u9fs-afid
/sys/src/cmd/unix/u9fs/authp9any.c
authp9any.c.orig:369,375 - /n/sources/patch/u9fs-afid/authp9any.c:369,378
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)
+ {
+ rx->uname = sp->t.suid; /* will be valid until afid is clunked */
return nil;
+ }
return "authentication failed";
}
authp9any.c.orig:392,398 - /n/sources/patch/u9fs-afid/authp9any.c:395,401
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)
authp9any.c.orig:437,443 - /n/sources/patch/u9fs-afid/authp9any.c:440,446
Fid *f;
- f = oldauthfid(rx->afid, (void **)&sp, &ep);
+ f = oldauthfid(rx->fid, (void **)&sp, &ep);
if (f == nil)
return ep;
if (chatty9p)
authp9any.c.orig:515,521 - /n/sources/patch/u9fs-afid/authp9any.c:518,524
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module
2013-11-27 10:00 [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module yaroslav
@ 2013-11-27 10:15 ` erik quanstrom
0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2013-11-27 10:15 UTC (permalink / raw)
To: 9fans
> /sys/src/cmd/unix/u9fs/authp9any.c
> authp9any.c.orig:369,375 - /n/sources/patch/u9fs-afid/authp9any.c:369,378
> 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)
> + {
> + rx->uname = sp->t.suid; /* will be valid until afid is clunked */
> return nil;
> + }
> return "authentication failed";
> }
>
without commont on correctness, braces go on the
line on which the if condition ends.
- erik
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module
@ 2013-11-27 13:38 yaroslav
0 siblings, 0 replies; 3+ messages in thread
From: yaroslav @ 2013-11-27 13:38 UTC (permalink / raw)
To: 9fans
> > /sys/src/cmd/unix/u9fs/authp9any.c
> > authp9any.c.orig:369,375 - /n/sources/patch/u9fs-afid/authp9any.c:369,378
> > 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)
> > + {
> > + rx->uname = sp->t.suid; /* will be valid until afid is clunked */
> > return nil;
> > + }
> > return "authentication failed";
> > }
>
> without commont on correctness, braces go on the
> line on which the if condition ends.
>
> - erik
>
The patch has been updated.
BTW, this change was after http://9fans.net/archive/2011/10/157 which
I hadn't then submitted; this time it slipped through.
It worth's to stay though, IMO.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-27 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-27 10:00 [9fans] u9fs(4) misuses Fcall.afid in its p9any authentication module yaroslav
2013-11-27 10:15 ` erik quanstrom
2013-11-27 13:38 yaroslav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).