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

index 577a425484db00c3c237eec1ed67f02a1afc5b25..fb4d7d52bd18f6d630e44c9f10d1ab3e30de510f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.71.2.4.2.15.2.10 2008-11-25 15:16:32 didg Exp $
+ * $Id: directory.c,v 1.71.2.4.2.15.2.11 2009-01-28 05:37:57 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1706,7 +1706,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;
@@ -1735,7 +1735,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 93a9c9940c90afdcbf60a9e58289f5dc5556f13c..49b6118167f55dc3366d0638325629c248a3e23b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.45.2.2.2.14.2.5 2008-11-25 15:16:33 didg Exp $
+ * $Id: filedir.c,v 1.45.2.2.2.14.2.6 2009-01-28 05:37:58 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -748,7 +748,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);
                 setfilmode(vol->ad_path( upath, ADFLAGS_HF ), ad_hf_mode(admode), NULL);
index 58170528941c6f6f38ccfab6c28b511709c7b816..05a647f4080490b4c993240625f7a86fc7845fe5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: unix.c,v 1.43.2.1.2.10.2.4 2008-11-25 15:16:33 didg Exp $
+ * $Id: unix.c,v 1.43.2.1.2.10.2.5 2009-01-28 05:37:58 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -404,7 +404,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;
 char *adouble = vol->ad_path( name, ADFLAGS_DIR );
 
     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 */
@@ -487,7 +487,7 @@ mode_t           mode;
     char                *adouble = vol->ad_path( name, ADFLAGS_DIR );
     char                *adouble_p = ad_dir(adouble);
     
-    mode |= vol->v_perm;
+    mode |= vol->v_dperm;
     hf_mode = ad_hf_mode(mode);
 
     if (dir_rx_set(mode)) {
index 57bca6cdbfc787218d4ed3a3fd3160c7f6f9f454..53a0bc23ee4c123fd106dc4058e729cf05edf03a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.51.2.7.2.33.2.18 2009-01-26 15:06:31 didg Exp $
+ * $Id: volume.c,v 1.51.2.7.2.33.2.19 2009-01-28 05:37:58 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -114,13 +114,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  /* dperm default files perms */
+#define VOLOPT_DFLTPERM  24  /* perm */
+
 #define VOLOPT_MAX       (VOLOPT_DFLTPERM +1)
 
 #define VOLOPT_NUM        (VOLOPT_MAX + 1)
@@ -489,6 +489,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);
 
@@ -675,6 +679,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;
 
@@ -711,6 +717,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;
 
     initvoladouble(volume);
     volume->v_next = Volumes;
index e68e1ce2e5a3f5e6af72ebcfe20fcce414e42fa6..5aafab77378cb26b45ad1c9c853f08094269a98f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.19.2.5.2.7.2.4 2009-01-13 01:05:53 didg Exp $
+ * $Id: volume.h,v 1.19.2.5.2.7.2.5 2009-01-28 05:37:58 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -49,6 +49,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;