+2001-12-14 joe c <marcus@marcuscom.com>
+ * etc/afpd/unix.c: MFH: Fix afpd sharing NFSv3 mounts (thanks to
+ Pierre Beyssac <beyssac@enst.fr>)
+
2001-12-03 joe c <marcus@marcuscom.com>
* etc/afpd/*.[ch], libatalk/cnid/*.[ch]: Big commit to clean up code
with astyle (readable code is hackable code). Also committed a fix
/*
- * $Id: unix.c,v 1.24.2.1 2001-12-03 05:01:04 jmarcus Exp $
+ * $Id: unix.c,v 1.24.2.2 2001-12-15 06:32:14 jmarcus Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
/*
- * Calculate the mode for a directory using Posix access() calls to
- * estimate permission, a la mdw.
+ * Calculate the mode for a directory using a stat() call to
+ * estimate permission.
+ *
+ * Note: the previous method, using access(), does not work correctly
+ * over NFS.
*/
void accessmode( path, ma, dir )
char *path;
struct maccess *ma;
struct dir *dir;
{
- if ( access( path, R_OK|W_OK|X_OK ) == 0 ) {
- ma->ma_user = AR_UREAD|AR_UWRITE|AR_USEARCH|AR_UOWN;
- ma->ma_owner = AR_UREAD|AR_UWRITE|AR_USEARCH;
- } else if ( access( path, R_OK|X_OK ) == 0 ) {
- ma->ma_user = AR_UREAD|AR_USEARCH;
- ma->ma_owner = AR_UREAD|AR_USEARCH;
- } else {
- ma->ma_user = ma->ma_owner = 0;
- if ( access( path, R_OK ) == 0 ) {
- ma->ma_user |= AR_UREAD;
- ma->ma_owner |= AR_UREAD;
- }
- if ( access( path, X_OK ) == 0 ) {
- ma->ma_user |= AR_USEARCH;
- ma->ma_owner |= AR_USEARCH;
- }
- if ( access( path, W_OK ) == 0 ) {
- ma->ma_user |= AR_UWRITE|AR_UOWN;
- ma->ma_owner |= AR_UWRITE;
- }
- }
+ struct stat sb;
+ ma->ma_user = ma->ma_owner = 0;
+ if ( stat( path, &sb ) == 0 )
+ utommode( &sb, ma );
+ return;
}
int gmem( gid )