From: Alexei Kosut Date: Wed, 14 May 2003 16:50:47 +0000 (+0000) Subject: STABLE12-osx-fake-mode-bits-20030513 X-Git-Tag: openafs-stable-1_2_10~87 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=136fa3235bc6e54b4d63e219e12c434c8fbb6c7f;p=packages%2Fo%2Fopenafs.git STABLE12-osx-fake-mode-bits-20030513 FIXES 1362 give up on waiting for apple to get things right, which probably means they never will. (cherry picked from commit ffeb03ae952b671691387421e0e4319fef97a7c9) --- diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index a873baad7..f78dafe44 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -64,6 +64,23 @@ afs_CopyOutAttrs(avc, attrs) if (tcell && (tcell->states & CNoSUID)) attrs->va_mode &= ~(VSUID|VSGID); } +#if defined(AFS_DARWIN_ENV) + /* Mac OS X uses the mode bits to determine whether a file or directory + * is accessible, and believes them, even though under AFS they're almost + * assuredly wrong, especially if the local uid does not match the AFS + * ID. So we set the mode bits conservatively. + */ + if (S_ISDIR(attrs->va_mode)) { + /* all access bits need to be set for directories, since even + * a mode 0 directory can still be used normally. + */ + attrs->va_mode |= ACCESSPERMS; + } else { + /* for other files, replicate the user bits to group and other */ + mode_t ubits = (attrs->va_mode & S_IRWXU) >> 6; + attrs->va_mode |= ubits | (ubits << 3); + } +#endif /* AFS_DARWIN_ENV */ attrs->va_uid = fakedir ? 0 : avc->m.Owner; attrs->va_gid = fakedir ? 0 : avc->m.Group; /* yeah! */ #if defined(AFS_SUN56_ENV)