shithub: ext4srv

Download patch

ref: 268054fa0999ee700bfdc5bababd66a1e227f992
parent: a875b1c2e05d20b03887869c1b1588dbe43eba97
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Jan 18 09:02:23 EST 2021

fix root permissions on wstat

--- a/ext4srv.c
+++ b/ext4srv.c
@@ -632,7 +632,7 @@
 
 	wrperm = haveperm(a, OWRITE, &inode);
 	uid = ext4_inode_get_uid(&inode);
-	isowner = a->uid == Root || a->uid == uid;
+	isowner = uid == Root || a->uid == uid;
 
 	/* permission to truncate */
 	isdir = ext4_inode_type(a->p->sb, &inode) == EXT4_INODE_MODE_DIRECTORY;
@@ -678,7 +678,7 @@
 	/* permission to change gid */
 	if(r->d.gid != nil && r->d.gid[0] != 0){
 		/* has to be the owner, group has to exist, must be in that group */
-		if(a->uid == Root || (!isowner || (g = findgroup(&a->p->groups, r->d.gid, &gid)) == nil || !ingroup(g, a->uid))){
+		if(!isowner || (g = findgroup(&a->p->groups, r->d.gid, &gid)) == nil || !ingroup(g, a->uid)){
 			err = Eperm;
 			goto error;
 		}