[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

1.11h3: tosfs and xattr again...



 Even this tosfs still first assigns access permissions globally for each
drive and then or's in execute permission later so that whatever you may
assign everybody is allowed to execute each program. Here's a fix.

ciao,
TeSche
--
Torsten Scherer (TeSche, Schiller...), itschere@techfak.uni-bielefeld.de
Faculty of Technology, University of Bielefeld, Germany, Europe, Earth...
| Use any of "finger itschere@129.70.131.2-15" for adresses and more.	|


--- tosfs.c.orig	Tue Nov 15 11:21:54 1994
+++ tosfs.c	Tue Nov 15 12:34:20 1994
@@ -611,7 +611,7 @@
 	return r;
 }
 
-static long ARGS_ON_STACK 
+static long ARGS_ON_STACK
 tos_getxattr(fc, xattr)
 	fcookie *fc;
 	XATTR *xattr;
@@ -637,13 +637,13 @@
 	xattr->rdev = fc->dev;
 	xattr->nlink = 1;
 
-	xattr->uid = xattr->gid = 0;
-
 #ifdef ROOTPERMS
 	if (tp) {
 		xattr->uid = tp->uid;
 		xattr->gid = tp->gid;
 	}
+#else
+	xattr->uid = xattr->gid = 0;
 #endif
 
 #ifndef NEWWAY
@@ -694,9 +694,6 @@
 	xattr->mode = (ti->attr & FA_DIR) ? (S_IFDIR | DEFAULT_DIRMODE) :
 			 (S_IFREG | DEFAULT_MODE);
 
-/* TOS files have permissions rwxrwx--- */
-	xattr->mode &= ~(S_IROTH|S_IWOTH|S_IXOTH);
-
 #ifdef ROOTPERMS
 	/* when root permissions are set, use them. For regular files,
 	unmask x bits */
@@ -705,18 +702,21 @@
 		xattr->mode &= ~DEFAULT_DIRMODE;
 		xattr->mode |= (tp->mode & DEFAULT_DIRMODE);
 
-		if (! (ti->attr & FA_DIR))
+		if (!(ti->attr & FA_DIR) && !(ti->attr & FA_EXEC))
 			xattr->mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH);
 	}
+#else
+	if (ti->attr & FA_EXEC) {
+		xattr->mode |= (S_IXUSR|S_IXGRP);
+	}
+
+	/* TOS files have permissions rwxrwx--- */
+	xattr->mode &= ~(S_IROTH|S_IWOTH|S_IXOTH);
 #endif
 
 	if (ti->attr & FA_RDONLY) {
 		xattr->mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH);
 	}
-
-	if (ti->attr & FA_EXEC) {
-		xattr->mode |= (S_IXUSR|S_IXGRP|S_IXOTH);
-	}
 
 	xattr->attr = ti->attr & 0xff;
 	return 0;