git: 9front

Download patch

ref: f1d960f16b91397404fd60178a28cc2a4c26f3a3
parent: dc1c2297ac350872f766dc5de716b790ca302416
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);
 
--