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

ChangeLog
etc/afpd/unix.c

index 4b164e0c06f0a752ad99f9374268ff65c23ef4f8..081eb855b8738adabf03079587698b66d7afa2d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-04  joe c   <marcus@marcuscom.com>
+       * etc/afpd/unix.c: Fix afpd sharing NFSv3 mounts (thanks to 
+       Pierre Beyssac <beyssac@enst.fr>)
+
 2001-12-03  joe c   <marcus@marcuscom.com>
        * etc/afpd/*.[ch]: Big commit to clean up code with astyle (readable code 
        is hackable code).  Also committed a fix to give CNID DB a shot in
index e56ba0078170c6a96ff6ade1adcc1eb79d7065b5..97a7242ad0b3fcc9ffbc61b3be76fae1d03b6585 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unix.c,v 1.25 2001-12-03 05:03:38 jmarcus Exp $
+ * $Id: unix.c,v 1.26 2001-12-04 16:57:45 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 )