From: jmarcus Date: Sat, 15 Dec 2001 06:32:14 +0000 (+0000) Subject: MFH: 1.26 X-Git-Tag: netatalk-1-5-rc1~5 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=fcce7d85cf1c7fc720754799b3b9163608ff74e9 MFH: 1.26 Add patch to allow afpd to correctly share out NFSv3 mounts. Effectively, we replace access() calls with stat() calls. Thanks to Pierre Beyssac for the patch. --- diff --git a/ChangeLog b/ChangeLog index 3b40de36..1e493e13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-12-14 joe c + * etc/afpd/unix.c: MFH: Fix afpd sharing NFSv3 mounts (thanks to + Pierre Beyssac ) + 2001-12-03 joe c * etc/afpd/*.[ch], libatalk/cnid/*.[ch]: Big commit to clean up code with astyle (readable code is hackable code). Also committed a fix diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index e9ec3193..8f6972f1 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -1,5 +1,5 @@ /* - * $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. @@ -150,35 +150,22 @@ struct maccess *ma; /* - * 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 )