go9p
go9p copied to clipboard
Mount (without auth) requires nuname
I'm not sure if this is a bug. But the behavior surprised me, and it means I can't use srv_fcall.go with the 9p that comes with Plan 9 from Userspace.
I'm working on a file system that enforces file access permissions for virtual users. The users are defined in the file /adm/users, and don't need to authenticate just be authorized (https://github.com/mbucc/vufs/blob/master/vusers.go).
When 9p tries to mount with authentication (9p -n -a localhost:5640 ls
), it sends a zero for nuname:
Tattach tag 0 fid 0 afid 4294967295 uname 'mark' nuname 0 aname ''
Since nuname != NOUID, srv_fcall.attach checks Uid2User, which fails, as the 0 doesn't match my virtual user's uid defined in adm/users. (I suspect 9p will always send a 0 for nuname in this case.)
Would you be interested in a patch that modifies the user lookup logic to check Uname2User before Uid2User for non-dotu situation?
A comment in fcall.h says that uidnum is a dotu extension:
https://github.com/9fans/plan9port/blob/master/include/fcall.h#L45-L48
So now this looks more like a bug; if I'm not using dotu, I should not need nuname (aka uidnum).
I'm not sure why the last commit to fcall.h, which removed dotu, didn't remove those fields from struct Fcall.
try to cherry-pick the fix i sent to @lionkov lionkov/go9p@11a63487351273ae0c2e0be51ef6331cda11dc81
@mischief, heh found the same spot about one minute before your comment.