/*
- * $Id: unix.c,v 1.47 2005-05-25 18:19:33 didg Exp $
+ * $Id: unix.c,v 1.52 2009-02-02 11:55:01 franklahm Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
#include "unix.h"
#include "fork.h"
+#ifdef HAVE_NFSv4_ACLS
+extern void acltoownermode(char *path, struct stat *st,uid_t uid, struct maccess *ma);
+#endif
+
+
/*
* Get the free space on a partition.
*/
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
*/
st = &sb;
}
utommode( st, ma );
+#ifdef HAVE_NFSv4_ACLS
+ /* 10.5 Finder looks at OS 9 mode, so we must do some mapping */
+ acltoownermode( path, st, uuid, ma);
+#endif
}
int gmem( gid )
return( 0 );
}
-static __inline__ mode_t mtoubits( bits )
+static mode_t mtoubits( bits )
u_char bits;
{
mode_t mode;
#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;
}
return -1;
}
+ mode |= vol->v_fperm;
+
if (setfilmode( path->u_name, mode, &path->st) < 0)
return -1;
/* we need to set write perm if read set for resource fork */
int setdirunixmode( vol, name, mode )
const struct vol *vol;
const char *name;
-const mode_t mode;
+mode_t mode;
{
int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ mode |= vol->v_dperm;
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble in rf_setdirmode */
int setdirmode( vol, name, mode )
const struct vol *vol;
const char *name;
-const mode_t mode;
+mode_t mode;
{
struct stat st;
struct dirent *dirp;
DIR *dir;
+ mode_t hf_mode;
int osx = vol->v_adouble == AD_VERSION2_OSX;
- mode_t hf_mode = ad_hf_mode(mode);
int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
+ mode |= vol->v_dperm;
+ hf_mode = ad_hf_mode(mode);
+
if (dir_rx_set(mode)) {
/* extending right? dir first */
if ( stickydirmode(name, DIRBITS | mode, dropbox) < 0 )