]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/unix.c
unix.c:
[netatalk.git] / etc / afpd / unix.c
index 4f74c32f545ae63b8bc83c298d9efa65039fdbf4..c5459c1612aa84c95ce9f586cb37d30424e58de3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unix.c,v 1.33 2002-04-14 10:53:37 srittau Exp $
+ * $Id: unix.c,v 1.35 2002-06-06 10:14:26 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -114,6 +114,9 @@ mode_t      bits;
     return( mbits );
 }
 
+/* --------------------------------
+    cf AFP 3.0 page 63
+*/
 void utommode( stat, ma )
 struct stat            *stat;
 struct maccess *ma;
@@ -130,22 +133,28 @@ struct maccess    *ma;
 
     ma->ma_owner = utombits( mode );
 
+    /* ma_user is a union of all permissions */
+
     if ( (uuid == stat->st_uid) || (uuid == 0)) {
         ma->ma_user = ma->ma_owner | AR_UOWN;
-    } else if ( gmem( stat->st_gid )) {
-        ma->ma_user = ma->ma_group;
-    } else {
-        ma->ma_user = ma->ma_world;
     }
+    if ( gmem( stat->st_gid )) {
+        ma->ma_user |= ma->ma_group;
+    } 
+    ma->ma_user |= ma->ma_world;
 
     /*
      * There are certain things the mac won't try if you don't have
      * the "owner" bit set, even tho you can do these things on unix wiht
      * only write permission.  What were the things?
+     * 
+     * FIXME and so what ?
      */
+#if 0
     if ( ma->ma_user & AR_UWRITE ) {
         ma->ma_user |= AR_UOWN;
     }
+#endif    
 }
 
 
@@ -196,16 +205,21 @@ u_char    bits;
     return( mode );
 }
 
+/* ----------------------------------
+   from the finder's share windows (menu--> File--> sharing...)
+   and from AFP 3.0 spec page 63 
+   the mac mode should be save somewhere 
+*/
 mode_t mtoumode( ma )
 struct maccess *ma;
 {
     mode_t             mode;
 
     mode = 0;
-    mode |= mtoubits( ma->ma_owner );
+    mode |= mtoubits( ma->ma_owner |ma->ma_world);
     mode = mode << 3;
 
-    mode |= mtoubits( ma->ma_group );
+    mode |= mtoubits( ma->ma_group |ma->ma_world);
     mode = mode << 3;
 
     mode |= mtoubits( ma->ma_world );