]> arthur.barton.de Git - netatalk.git/commitdiff
Remove stickydirmode wrapper
authorFrank Lahm <franklahm@googlemail.com>
Fri, 27 Jan 2012 14:24:23 +0000 (15:24 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 27 Jan 2012 14:24:23 +0000 (15:24 +0100)
etc/afpd/directory.c
etc/afpd/unix.c
include/atalk/unix.h
libatalk/acl/unix.c
libatalk/vfs/unix.c
libatalk/vfs/vfs.c

index cc3fb839886a3e418c8f7bd24000c18e64d9f328..905c3bd99deb27f0e8c3f3a8845bbff633104cf1 100644 (file)
@@ -2070,8 +2070,11 @@ setdirparam_done:
                     goto setprivdone;
                 }
             }
-            if (setdirunixmode(vol, upath, mpriv) < 0)
+            if (setdirunixmode(vol, upath, mpriv) < 0) {
+                LOG(log_info, logtype_afpd, "setdirparams(\"%s\"): setdirunixmode: %s",
+                    fullpathname(upath), strerror(errno));
                 err = set_dir_errors(path, "setdirmode", errno);
+            }
         }
         if ((set_upriv == true) && vol_unix_priv(vol)) {
             if (dir->d_did == DIRDID_ROOT) {
index fb842b274545424c876cd823a8f08d57ff2552ec..1688c9abbf06854f8b6954b30c7586c6c27211b1 100644 (file)
@@ -322,14 +322,14 @@ int setdirunixmode(const struct vol *vol, const char *name, mode_t mode)
 
     if (dir_rx_set(mode)) {
        /* extending right? dir first then .AppleDouble in rf_setdirmode */
-       if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
+       if (chmod_acl(name, (DIRBITS | mode) & ~vol->v_umask) < 0 )
                return -1;
     }
     if (vol->vfs->vfs_setdirunixmode(vol, name, mode, NULL) < 0) {
         return  -1 ;
     }
     if (!dir_rx_set(mode)) {
-       if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
+       if (chmod_acl(name, (DIRBITS | mode) & ~vol->v_umask) < 0 )
             return -1;
     }
     return 0;
index c7a2bc38cdd03edda656180547e434cc9ada7dd8..05d71059a2b7693ea4c61773c651ef8c7c8b4f8e 100644 (file)
@@ -39,7 +39,6 @@ extern int netatalk_rmdir_all_errors(int dirfd, const char *name);
 
 extern int setfilmode(const char *, mode_t, struct stat *, mode_t);
 extern int dir_rx_set(mode_t mode);
-extern int stickydirmode(const char *name, const mode_t mode, const int dropbox, const mode_t v_umask);
 extern int unix_rename(int sfd, const char *oldpath, int dfd, const char *newpath);
 extern int copy_file(int sfd, const char *src, const char *dst, mode_t mode);
 extern int copy_file_fd(int sfd, int dfd);
index 9bad9c94ea277ec4d1a7be192ab539aa6c71977d..88cc77d23ce0546e04581de225a88e5dca6275bf 100644 (file)
@@ -284,7 +284,8 @@ int posix_chmod(const char *name, mode_t mode) {
     acl_t acl;
     u_char not_found = (SEARCH_GROUP_OBJ|SEARCH_MASK); /* used as flags */
 
-    LOG(log_maxdebug, logtype_afpd, "posix_chmod: %s mode: 0x%08x", name, mode);
+    LOG(log_maxdebug, logtype_afpd, "posix_chmod(\"%s\", mode: %04o) BEGIN",
+        fullpathname(name), mode);
 
     /* Call chmod() first because there might be some special bits to be set which
      * aren't related to access control.
@@ -374,7 +375,8 @@ cleanup:
         acl_free(acl);
     }
 done:
-    LOG(log_maxdebug, logtype_afpd, "posix_chmod: %d", ret);
+    LOG(log_maxdebug, logtype_afpd, "posix_chmod(\"%s\", mode: %04o): END: %d",
+        fullpathname(name), mode, ret);
     return ret;
 }
 
index c57249b3f28531f6d57fd5c1d5c95f97d3169aaf..1c0556d95e2eebc2e9baeccc34227a112ceeed8a 100644 (file)
 #include <atalk/errchk.h>
 #include <atalk/ea.h>
 
-/* -----------------------------
-   a dropbox is a folder where w is set but not r eg:
-   rwx-wx-wx or rwx-wx--
-   rwx----wx (is not asked by a Mac with OS >= 8.0 ?)
-*/
-int stickydirmode(const char *name, const mode_t mode, const int dropbox, const mode_t v_umask)
-{
-    int retval = 0;
-
-    /*
-     *  Ignore EPERM errors:  We may be dealing with a directory that is
-     *  group writable, in which case chmod will fail.
-     */
-    if ((chmod_acl( name, (DIRBITS | mode) & ~v_umask ) < 0) && errno != EPERM) {
-        LOG(log_error, logtype_afpd, "stickydirmode: chmod \"%s\": %s", fullpathname(name), strerror(errno) );
-        retval = -1;
-    }
-
-    return retval;
-}
-
 /* ------------------------- */
 int dir_rx_set(mode_t mode)
 {
index a704b5d185adf1a38a21c843981fe1cb2ba508a2..57d64ba1ae5294e601c2b118bdaf7b6a93c0e46f 100644 (file)
@@ -178,7 +178,7 @@ static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE)
     int  dropbox = vol->v_flags;
 
     if (dir_rx_set(mode)) {
-        if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 ) 
+        if (chmod_acl(ad_dir(adouble), (DIRBITS | mode) & ~vol->v_umask) < 0 ) 
             return -1;
     }
 
@@ -186,7 +186,7 @@ static int RF_setdirunixmode_adouble(VFS_FUNC_ARGS_SETDIRUNIXMODE)
         return -1;
 
     if (!dir_rx_set(mode)) {
-        if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0 ) 
+        if (chmod_acl(ad_dir(adouble), (DIRBITS | mode) & ~vol->v_umask) < 0 ) 
             return  -1 ;
     }
     return 0;
@@ -219,7 +219,7 @@ static int RF_setdirmode_adouble(VFS_FUNC_ARGS_SETDIRMODE)
     const char  *adouble_p = ad_dir(adouble);
 
     if (dir_rx_set(mode)) {
-        if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0) 
+        if (chmod_acl(ad_dir(adouble), (DIRBITS | mode) & ~vol->v_umask) < 0) 
             return -1;
     }
 
@@ -227,7 +227,7 @@ static int RF_setdirmode_adouble(VFS_FUNC_ARGS_SETDIRMODE)
         return -1;
 
     if (!dir_rx_set(mode)) {
-        if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox, vol->v_umask) < 0) 
+        if (chmod_acl(ad_dir(adouble), (DIRBITS | mode) & ~vol->v_umask) < 0) 
             return  -1 ;
     }
     return 0;