]> arthur.barton.de Git - netatalk.git/commitdiff
MFH: 1.26
authorjmarcus <jmarcus>
Sat, 15 Dec 2001 06:32:14 +0000 (06:32 +0000)
committerjmarcus <jmarcus>
Sat, 15 Dec 2001 06:32:14 +0000 (06:32 +0000)
Add patch to allow afpd to correctly share out NFSv3 mounts.  Effectively,
we replace access() calls with stat() calls.  Thanks to
Pierre Beyssac <beyssac@enst.fr> for the patch.

ChangeLog
etc/afpd/unix.c

index 3b40de36b65cfb87528a56b11a46b4ea2945518d..1e493e1328be3cbebbff76e6525f5645777a15f5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+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
index e9ec3193df406da3bc70a312e283f14b0ddea95b..8f6972f16aec5598a5fa4d5bc8f0b9d84e500d9a 100644 (file)
@@ -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 )