ref: ee51c91f6ff25df2db7181043ec42fe83d06732b
parent: 23e7a571724aa78dd33ffdde9da1c0fa330c3aae
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jul 13 11:55:37 EDT 2024
gefs: copy mode down on create, don't truncate walks with no DMEXEC we were copying the owner and group of the parent dir into the fid on create, but we forgot the mode; fix that, so that we don't check perms against the wrong dir.
--- a/sys/src/cmd/gefs/fs.c
+++ b/sys/src/cmd/gefs/fs.c
@@ -1255,7 +1255,7 @@
if(strlen(name) > Maxname)
error(Elength);
if(fsaccess(o, d.mode, d.uid, d.gid, DMEXEC) != 0)
- error(Eperm);
+ break;
if(d.qid.path == Qdump){
if((mnt = getmount(m->wname[i])) == nil)
error(Esrch);
@@ -1604,7 +1604,7 @@
fscreate(Fmsg *m)
{
char *p, *e, buf[Kvmax], upkbuf[Keymax], upvbuf[Inlmax];
- int nm, duid, dgid;
+ int nm, duid, dgid, dmode;
Dent *de;
vlong oldlen;
Qid old;
@@ -1650,6 +1650,7 @@
}
duid = de->uid;
dgid = de->gid;
+ dmode = de->mode;
runlock(de);
nm = 0;
@@ -1703,6 +1704,7 @@
f->dent = de;
f->duid = duid;
f->dgid = dgid;
+ f->dmode = dmode;
if(m->mode & ORCLOSE)
f->rclose = emalloc(sizeof(Amsg), 1);