/*
- * $Id: unix.c,v 1.61 2010-02-10 14:05:37 franklahm Exp $
- *
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
*/
#include <stdio.h>
#include <stdlib.h>
-
-/* STDC check */
-#ifdef STDC_HEADERS
#include <string.h>
-#else /* STDC_HEADERS */
-
-#ifndef HAVE_STRCHR
-#define strchr index
-#define strrchr index
-#endif /* HAVE_STRCHR */
-char *strchr (), *strrchr ();
-
-#ifndef HAVE_MEMCPY
-#define memcpy(d,s,n) bcopy ((s), (d), (n))
-#define memmove(d,s,n) bcopy ((s), (d), (n))
-#endif /* ! HAVE_MEMCPY */
-#endif /* STDC_HEADERS */
-
#include <errno.h>
#include <limits.h>
#include <sys/param.h>
#include <atalk/afp.h>
#include <atalk/util.h>
#include <atalk/unix.h>
+#include <atalk/acl.h>
#include "auth.h"
#include "directory.h"
#include "volume.h"
#include "unix.h"
#include "fork.h"
-
-#ifdef HAVE_NFSv4_ACLS
-extern void acltoownermode(char *path, struct stat *st,uid_t uid, struct maccess *ma);
+#ifdef HAVE_ACLS
+#include "acls.h"
#endif
-
/*
* Get the free space on a partition.
*/
}
#ifdef accessmode
+
#undef accessmode
#endif
/*
* dir parameter is used by AFS
*/
void accessmode(char *path, struct maccess *ma, struct dir *dir _U_, struct stat *st)
-
{
-struct stat sb;
+ struct stat sb;
ma->ma_user = ma->ma_owner = ma->ma_world = ma->ma_group = 0;
if (!st) {
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);
+#ifdef HAVE_ACLS
+ acltoownermode(path, st, ma);
#endif
}
/* --------------------- */
int setdirunixmode(const struct vol *vol, const char *name, mode_t mode)
{
-
- int dropbox = (vol->v_flags & AFPVOL_DROPBOX);
-
LOG(log_debug, logtype_afpd, "setdirunixmode('%s', mode:%04o) {v_dperm:%04o}",
fullpathname(name), mode, vol->v_dperm);
if (dir_rx_set(mode)) {
/* extending right? dir first then .AppleDouble in rf_setdirmode */
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
if (vol->vfs->vfs_setdirunixmode(vol, name, mode, NULL) < 0 && !vol_noadouble(vol)) {
return -1 ;
}
if (!dir_rx_set(mode)) {
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
return 0;
struct dirent *dirp;
DIR *dir;
mode_t hf_mode;
- int osx = vol->v_adouble == AD_VERSION2_OSX;
- 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, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
/* FIXME */
- if ( *dirp->d_name == '.' && (!osx || dirp->d_name[1] != '_')) {
+ if (*dirp->d_name == '.') {
continue;
}
if ( lstat( dirp->d_name, &st ) < 0 ) {
}
if (!S_ISDIR(st.st_mode)) {
- int setmode = (osx && *dirp->d_name == '.')?hf_mode:mode;
-
- if (setfilmode(dirp->d_name, setmode, &st, vol->v_umask) < 0) {
+ if (setfilmode(dirp->d_name, mode, &st, vol->v_umask) < 0) {
LOG(log_error, logtype_afpd, "setdirmode: chmod %s: %s",dirp->d_name, strerror(errno) );
return -1;
}
}
if (!dir_rx_set(mode)) {
- if ( stickydirmode(name, DIRBITS | mode, dropbox, vol->v_umask) < 0 )
+ if ( stickydirmode(name, DIRBITS | mode, 0, vol->v_umask) < 0 )
return -1;
}
return( 0 );
struct stat st;
struct dirent *dirp;
DIR *dir;
- int osx = vol->v_adouble == AD_VERSION2_OSX;
if (( dir = opendir( name )) == NULL ) {
return( -1 );
}
for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
- if ( *dirp->d_name == '.' && (!osx || dirp->d_name[1] != '_')) {
+ if ( *dirp->d_name == '.') {
continue;
}
if ( lstat( dirp->d_name, &st ) < 0 ) {