]> arthur.barton.de Git - netatalk.git/commitdiff
add dperm and fperm permissions default
authordidg <didg>
Fri, 30 Jan 2009 04:57:42 +0000 (04:57 +0000)
committerdidg <didg>
Fri, 30 Jan 2009 04:57:42 +0000 (04:57 +0000)
etc/afpd/directory.c
etc/afpd/filedir.c
etc/afpd/unix.c
etc/afpd/volume.c
etc/afpd/volume.h

index c39aa0e29cf99d5bbd0aa4a4e86df26cf873977e..a108561e06ca26ffc38051ed44f6cbfe225df90a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.89 2008-12-23 07:51:12 didg Exp $
+ * $Id: directory.c,v 1.90 2009-01-30 04:57:42 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1889,7 +1889,7 @@ int setdirparams(const struct vol *vol,
             ma.ma_world = *buf++;
             ma.ma_group = *buf++;
             ma.ma_owner = *buf++;
-            mpriv = mtoumode( &ma ) | vol->v_perm;
+            mpriv = mtoumode( &ma ) | vol->v_dperm;
             if (dir_rx_set(mpriv) && setdirmode( vol, upath, mpriv) < 0 ) {
                 err = set_dir_errors(path, "setdirmode", errno);
                 bitmap = 0;
@@ -1918,7 +1918,7 @@ int setdirparams(const struct vol *vol,
                 change_parent_mdate = 1;
                 memcpy( &upriv, buf, sizeof( upriv ));
                 buf += sizeof( upriv );
-                upriv = ntohl (upriv) | vol->v_perm;
+                upriv = ntohl (upriv) | vol->v_dperm;
                 if (dir_rx_set(upriv)) {
                     /* maybe we are trying to set perms back */
                     if ( setdirunixmode(vol, upath, upriv) < 0 ) {
index ac6f2d5e0396ad54019c33fec70dd38c035a3160..8078d9555a0b918b3ac712842217b00f232ee0d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.51 2008-08-31 13:25:58 didg Exp $
+ * $Id: filedir.c,v 1.52 2009-01-30 04:57:42 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -751,7 +751,7 @@ int ibuflen  _U_, *rbuflen;
 #endif /* DROPKLUDGE */
             /* if unix priv don't try to match perm with dest folder */
             if (!isdir && !vol_unix_priv(vol)) {
-                int  admode = ad_mode("", 0777) | vol->v_perm;
+                int  admode = ad_mode("", 0777) | vol->v_fperm;
 
                 setfilmode(upath, admode, NULL);
                 vol->vfs->rf_setfilmode(vol, upath, admode, NULL);
index d8903e810667aecefdd611829fad5471a323236f..240bfd2a338ebe5e0c4c54677bdb48d9a2cd0db9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unix.c,v 1.50 2008-12-03 18:35:44 didg Exp $
+ * $Id: unix.c,v 1.51 2009-01-30 04:57:42 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -405,7 +405,7 @@ mode_t mode;
         return -1;
     }
         
-    mode |= vol->v_perm;
+    mode |= vol->v_fperm;
 
     if (setfilmode( path->u_name, mode, &path->st) < 0)
         return -1;
@@ -443,7 +443,7 @@ mode_t           mode;
 {
 
     int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
-    mode |= vol->v_perm;
+    mode |= vol->v_dperm;
 
     if (dir_rx_set(mode)) {
        /* extending right? dir first then .AppleDouble in rf_setdirmode */
@@ -473,7 +473,7 @@ mode_t           mode;
     int                 osx = vol->v_adouble == AD_VERSION2_OSX;
     int                 dropbox = (vol->v_flags & AFPVOL_DROPBOX);
     
-    mode |= vol->v_perm;
+    mode |= vol->v_dperm;
     hf_mode = ad_hf_mode(mode);
 
     if (dir_rx_set(mode)) {
index e080b679c481952fcdb22a8d51d4b8b6c4532625..4b9acfd7e35ff77451651a6bc072d7e12e3dae0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.75 2009-01-26 15:09:31 didg Exp $
+ * $Id: volume.c,v 1.76 2009-01-30 04:57:42 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -115,13 +115,13 @@ m=u -> map both ways
 
 #define VOLOPT_FORCEUID  19  /* force uid for username x */
 #define VOLOPT_FORCEGID  20  /* force gid for group x */
-#define VOLOPT_UMASK     21
-#define VOLOPT_DFLTPERM  22
-#else 
-#define VOLOPT_UMASK     19
-#define VOLOPT_DFLTPERM  20
 #endif /* FORCE_UIDGID */
 
+#define VOLOPT_UMASK     21
+#define VOLOPT_DPERM     22  /* dperm default directories perms */
+#define VOLOPT_FPERM     23  /* fperm default files perms */
+#define VOLOPT_DFLTPERM  24  /* perm */
+
 #define VOLOPT_MAX       (VOLOPT_DFLTPERM +1)
 
 #define VOLOPT_NUM        (VOLOPT_MAX + 1)
@@ -499,6 +499,10 @@ static void volset(struct vol_option *options, struct vol_option *save,
        options[VOLOPT_UMASK].i_value = (int)strtol(val +1, NULL, 8);
     } else if (optionok(tmp, "perm:", val)) {
         options[VOLOPT_DFLTPERM].i_value = (int)strtol(val+1, NULL, 8);
+    } else if (optionok(tmp, "dperm:", val)) {
+        options[VOLOPT_DPERM].i_value = (int)strtol(val+1, NULL, 8);
+    } else if (optionok(tmp, "fperm:", val)) {
+        options[VOLOPT_FPERM].i_value = (int)strtol(val+1, NULL, 8);
     } else if (optionok(tmp, "mapchars:",val)) {
         setoption(options, save, VOLOPT_MAPCHARS, val);
 
@@ -653,6 +657,8 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
        if (options[VOLOPT_UMASK].i_value)
            volume->v_umask = (mode_t)options[VOLOPT_UMASK].i_value;
 
+       if (options[VOLOPT_DPERM].i_value)
+
        if (options[VOLOPT_DFLTPERM].i_value)
            volume->v_perm = (mode_t)options[VOLOPT_DFLTPERM].i_value;
 
@@ -691,6 +697,8 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
                 volume->v_root_postexec = volxlate(obj, NULL, MAXPATHLEN, options[VOLOPT_ROOTPOSTEXEC].c_value, pwd, path,  name);
         }
     }
+    volume->v_dperm |= volume->v_perm;
+    volume->v_fperm |= volume->v_perm;
 
     volume->v_next = Volumes;
     Volumes = volume;
index 7e0d5727e4c0ab418cc04f015d577becda1c0b09..23fd19086e9f6d86efe1c23541a949fe7b8071a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.25 2008-08-31 13:26:00 didg Exp $
+ * $Id: volume.h,v 1.26 2009-01-30 04:57:42 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -53,6 +53,8 @@ struct vol {
     char                v_stamp[ADEDLEN_PRIVSYN];
     mode_t             v_umask;
     mode_t             v_perm;             /* default permission value OR with requested perm*/
+    mode_t             v_dperm;             /* default directories permission value OR with requested perm*/
+    mode_t             v_fperm;             /* default files permission value OR with requested perm*/
 
 #ifdef FORCE_UIDGID
     char               *v_forceuid;