/*
- * $Id: unix.c,v 1.48 2005-06-02 12:32:18 didg Exp $
+ * $Id: unix.c,v 1.49 2007-05-16 18:35:58 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#ifdef DROPKLUDGE
/* Turn on the sticky bit if this is a drop box, also turn off the setgid bit */
- if (dropbox) {
+ if ((dropbox & AFPVOL_DROPBOX)) {
int uid;
if ( ( (mode & S_IWOTH) && !(mode & S_IROTH)) ||
* Ignore EPERM errors: We may be dealing with a directory that is
* group writable, in which case chmod will fail.
*/
- if ( (chmod( name, (DIRBITS | mode) & ~default_options.umask ) < 0) && errno != EPERM) {
+ if ( (chmod( name, (DIRBITS | mode) & ~default_options.umask ) < 0) && errno != EPERM &&
+ !(errno == ENOENT && (dropbox & AFPVOL_NOADOUBLE)) )
+ {
LOG(log_error, logtype_afpd, "stickydirmode: chmod \"%s\": %s", fullpathname(name), strerror(errno) );
retval = -1;
}
{
char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
char ad_p[ MAXPATHLEN + 1];
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ int dropbox = vol->v_flags;
strlcpy(ad_p,ad_dir(adouble), MAXPATHLEN + 1);
if (dir_rx_set(mode)) {
/* .AppleDouble */
- if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox) < 0)
return -1;
/* .AppleDouble/.Parent */
- if (stickydirmode(ad_p, DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_p, DIRBITS | mode, dropbox) < 0)
return -1;
}
return -1;
if (!dir_rx_set(mode)) {
- if (stickydirmode(ad_p, DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_p, DIRBITS | mode, dropbox) < 0)
return -1 ;
- if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, dropbox) < 0)
return -1;
}
return 0;
struct dir_mode param;
param.mode = mode;
- param.dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ param.dropbox = vol->v_flags;
strlcpy(ad_p,ad_dir(adouble), sizeof(ad_p));
if (dir_rx_set(mode)) {
/* .AppleDouble */
- if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox) < 0)
return -1;
}
return -1;
if (!dir_rx_set(mode)) {
- if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(ad_p), DIRBITS | mode, param.dropbox) < 0 )
return -1;
}
return 0;
static int RF_setdirunixmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st)
{
char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ int dropbox = vol->v_flags;
if (dir_rx_set(mode)) {
- if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 )
return -1;
}
return -1;
if (!dir_rx_set(mode)) {
- if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 )
return -1 ;
}
return 0;
static int RF_setdirmode_adouble(const struct vol *vol, const char * name, mode_t mode, struct stat *st _U_)
{
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ int dropbox = vol->v_flags;
mode_t hf_mode = ad_hf_mode(mode);
char *adouble = vol->vfs->ad_path( name, ADFLAGS_DIR );
char *adouble_p = ad_dir(adouble);
if (dir_rx_set(mode)) {
- if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0)
return -1;
}
return -1;
if (!dir_rx_set(mode)) {
- if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0 && !vol_noadouble(vol))
+ if (stickydirmode(ad_dir(adouble), DIRBITS | mode, dropbox) < 0)
return -1 ;
}
return 0;