/*
- * $Id: unix.c,v 1.43.2.1.2.10 2004-06-15 22:53:55 didg Exp $
+ * $Id: unix.c,v 1.43.2.1.2.10.2.4 2008-11-25 15:16:33 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
return( AFP_OK );
}
-static __inline__ int utombits( bits )
+static int utombits( bits )
mode_t bits;
{
int mbits;
* Note: the previous method, using access(), does not work correctly
* over NFS.
* FIXME what about ACL?
+ *
+ * dir parameter is used by AFS
*/
void accessmode( path, ma, dir, st )
char *path;
struct maccess *ma;
-struct dir *dir;
+struct dir *dir _U_;
struct stat *st;
{
return( 0 );
}
-static __inline__ mode_t mtoubits( bits )
+static mode_t mtoubits( bits )
u_char bits;
{
mode_t mode;
return -1;
}
+ mode |= vol->v_perm;
+
if (setfilmode( path->u_name, mode, &path->st) < 0)
return -1;
/* we need to set write perm if read set for resource fork */
struct stat *st;
{
struct stat sb;
-mode_t mask = S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH;
+mode_t mask = S_IRWXU | S_IRWXG | S_IRWXO; /* rwx for owner group and other, by default */
if (!st) {
if (stat(name, &sb) != 0)
return -1;
st = &sb;
}
- mode &= mask; /* keep only rw-rw-rw in mode */
+
mode |= st->st_mode & ~mask; /* keep other bits from previous mode */
if ( chmod( name, mode & ~default_options.umask ) < 0 && errno != EPERM ) {
return -1;
int setdirunixmode( vol, name, mode )
const struct vol *vol;
const char *name;
-const mode_t mode;
+mode_t mode;
{
char *adouble = vol->ad_path( name, ADFLAGS_DIR );
int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ mode |= vol->v_perm;
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble */
int setdirmode( vol, name, mode )
const struct vol *vol;
const char *name;
-const mode_t mode;
+mode_t mode;
{
char buf[ MAXPATHLEN + 1];
struct stat st;
char *m;
struct dirent *dirp;
DIR *dir;
+ mode_t hf_mode;
int osx = vol->v_adouble == AD_VERSION2_OSX;
- int hf_mode = ad_hf_mode(mode);
int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
char *adouble = vol->ad_path( name, ADFLAGS_DIR );
char *adouble_p = ad_dir(adouble);
+ mode |= vol->v_perm;
+ hf_mode = ad_hf_mode(mode);
+
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble */
if ( stickydirmode(name, DIRBITS | mode, dropbox) < 0 )