Subject: kern/3787: adosfs interprets execute protection on directories as S_IX*
To: None <gnats-bugs@gnats.netbsd.org>
From: Michael van Elst <mlelstv@serpens.swb.de>
List: netbsd-bugs
Date: 06/24/1997 23:00:21
>Number:         3787
>Category:       kern
>Synopsis:       adosfs interprets execute protection on directories as S_IX*
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 24 14:20:00 1997
>Last-Modified:
>Originator:     Michael van Elst
>Organization:
dis-
>Release:        NetBSD-current 20 June 1997
>Environment:
Amiga A3000/060, NetBSD-current, adosfs
System: NetBSD lemming 1.2G NetBSD 1.2G (LEMMING) #10: Sun Jun 22 21:26:36 MEST 1997 root@lemming:/usr/src/sys/arch/amiga/compile/LEMMING amiga


>Description:
	adosfs translates AmigaOS protection flags into UNIX mode bits.
	PROTECTION_READ becomes S_IRUSR, PROTECTION_WRITE becomes S_IWUSR
	and PROTECTION_EXECUTE becomes S_IXUSR (and similar for group
	and other permissions).
	For files this is a correct interpretation of semantics, however for
	directories this is not true. AmigaOS ignores the PROTECTION_EXECUTE
	bit on directories completely. There is no difference between a
	readable directory and an accessible directory as in UNIX.
	As a result a directory without PROTECTION_EXECUTE can be used under
	AmigaOS but not under NetBSD.

>How-To-Repeat:
	Under AmigaOS:
	protect a_directory -e
	Under NetBSD
	mount_ados the partition and try to access the directory.

>Fix:
	Apply the following patch to ados/advfsops.c:

diff -c advfsops.c.orig advfsops.c
*** advfsops.c.orig     Tue Jun 24 22:04:43 1997
--- advfsops.c  Sun Jun 22 21:25:27 1997
***************
*** 511,516 ****
--- 511,526 ----
        } else {
                ap->adprot = adoswordn(bp, ap->nwords - 48) ^ 15;
                /*
+                * ADOS directories don't have a valid 'x' mode
+                *
+                * you can use them and read them as soon as they
+                * have read permission
+                *
+                */
+               if (ap->type == ADIR || ap->type == ALDIR)
+                       ap->adprot = ap->adprot |
+                                    (ap->adprot & 0x888) >> 2;
+               /*
                 * Get uid/gid from extensions in file header
                 * (really need to know if this is a muFS partition)
                 */

>Audit-Trail:
>Unformatted: