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) {
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;
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);
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.
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;
}
#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)
{
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;
}
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;
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;
}
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;