ma->ma_user = ma->ma_owner = ma->ma_world = ma->ma_group = 0;
if (!st) {
- if (lstat(path, &sb) != 0)
+ if (ostat(path, &sb, vol_syml_opt(vol)) != 0)
return;
st = &sb;
}
int setfilunixmode (const struct vol *vol, struct path* path, mode_t mode)
{
if (!path->st_valid) {
- of_stat(path);
+ of_stat(vol, path);
}
if (path->st_errno) {
mode |= vol->v_fperm;
- if (setfilmode( path->u_name, mode, &path->st, vol->v_umask) < 0)
+ if (setfilmode(vol, path->u_name, mode, &path->st) < 0)
return -1;
/* we need to set write perm if read set for resource fork */
return vol->vfs->vfs_setfilmode(vol, path->u_name, mode, &path->st);
/* --------------------- */
-int setdirunixmode(const struct vol *vol, const char *name, mode_t mode)
+int setdirunixmode(const struct vol *vol, char *name, mode_t mode)
{
LOG(log_debug, logtype_afpd, "setdirunixmode('%s', mode:%04o) {v_dperm:%04o}",
fullpathname(name), mode, vol->v_dperm);
- mode |= vol->v_dperm;
+ mode |= (vol->v_dperm | DIRBITS) & ~vol->v_umask;
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble in rf_setdirmode */
- if (chmod_acl(name, (DIRBITS | mode) & ~vol->v_umask) < 0 )
+ if (ochmod(name, mode, NULL,
+ vol_syml_opt(vol) | vol_chmod_opt(vol)
+ ) < 0)
return -1;
}
if (vol->vfs->vfs_setdirunixmode(vol, name, mode, NULL) < 0) {
return -1 ;
}
if (!dir_rx_set(mode)) {
- if (chmod_acl(name, (DIRBITS | mode) & ~vol->v_umask) < 0 )
+ if (ochmod(name, mode, NULL,
+ vol_syml_opt(vol) | vol_chmod_opt(vol)
+ ) < 0)
return -1;
}
return 0;
/* ----------------------------- */
int setfilowner(const struct vol *vol, const uid_t uid, const gid_t gid, struct path* path)
{
- if (lchown(path->u_name, uid, gid) < 0 && errno != EPERM) {
+ if (ochown( path->u_name, uid, gid, vol_syml_opt(vol)) < 0 && errno != EPERM ) {
LOG(log_debug, logtype_afpd, "setfilowner: chown %d/%d %s: %s",
uid, gid, path->u_name, strerror(errno));
return -1;
* co-opting some bits. */
int setdirowner(const struct vol *vol, const char *name, const uid_t uid, const gid_t gid)
{
- if (lchown(name, uid, gid ) < 0 && errno != EPERM ) {
+ if (ochown(name, uid, gid, vol_syml_opt(vol)) < 0 && errno != EPERM ) {
LOG(log_debug, logtype_afpd, "setdirowner: chown %d/%d %s: %s",
uid, gid, fullpathname(name), strerror(errno) );
}
return( 0 );
}
-