X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Funix.c;h=01688c94e66c2fef5c94e6bd5dc6f6e3f14e1f3b;hb=056d3ef4c88ba09eabb1fcbf06bdd9fe6e7af4cf;hp=e1358cc6100faa3f8ee8a2502b5bad2631194bd8;hpb=2fdd522410f80afcd055d7333f491ee6c0b4b9fa;p=netatalk.git diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index e1358cc6..01688c94 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,7 @@ */ int ustatfs_getvolspace(const struct vol *vol, VolSpace *bfree, VolSpace *btotal, uint32_t *bsize) { - VolSpace maxVolSpace = (~(VolSpace)0); + VolSpace maxVolSpace = UINT64_MAX; #ifdef ultrix struct fs_data sfs; @@ -43,7 +44,6 @@ int ustatfs_getvolspace(const struct vol *vol, VolSpace *bfree, VolSpace *btotal struct statfs sfs; #endif /*ultrix*/ - if ( statfs( vol->v_path, &sfs ) < 0 ) { LOG(log_error, logtype_afpd, "ustatfs_getvolspace unable to stat %s", vol->v_path); return( AFPERR_PARAM ); @@ -152,7 +152,7 @@ mode_t mode; * * dir parameter is used by AFS */ -void accessmode(char *path, struct maccess *ma, struct dir *dir _U_, struct stat *st) +void accessmode(const struct vol *vol, char *path, struct maccess *ma, struct dir *dir _U_, struct stat *st) { struct stat sb; @@ -164,7 +164,7 @@ void accessmode(char *path, struct maccess *ma, struct dir *dir _U_, struct stat } utommode( st, ma ); #ifdef HAVE_ACLS - acltoownermode(path, st, ma); + acltoownermode(vol, path, st, ma); #endif } @@ -266,17 +266,17 @@ int setdeskmode(const mode_t mode) } if (S_ISDIR(st.st_mode)) { - if ( chmod( modbuf, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod_acl( modbuf, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { LOG(log_error, logtype_afpd, "setdeskmode: chmod %s: %s",fullpathname(modbuf), strerror(errno) ); } - } else if ( chmod( modbuf, mode & ~(default_options.umask | EXEC_MODE) ) < 0 && errno != EPERM ) { + } else if ( chmod_acl( modbuf, mode & ~(default_options.umask | EXEC_MODE) ) < 0 && errno != EPERM ) { LOG(log_error, logtype_afpd, "setdeskmode: chmod %s: %s",fullpathname(modbuf), strerror(errno) ); } } closedir( sub ); /* XXX: need to preserve special modes */ - if ( chmod( deskp->d_name, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod_acl( deskp->d_name, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { LOG(log_error, logtype_afpd, "setdeskmode: chmod %s: %s",fullpathname(deskp->d_name), strerror(errno) ); } } @@ -286,7 +286,7 @@ int setdeskmode(const mode_t mode) return -1; } /* XXX: need to preserve special modes */ - if ( chmod( ".AppleDesktop", (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod_acl( ".AppleDesktop", (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { LOG(log_error, logtype_afpd, "setdeskmode: chmod %s: %s", fullpathname(".AppleDesktop"),strerror(errno) ); } return( 0 ); @@ -368,7 +368,10 @@ int setdirmode(const struct vol *vol, const char *name, mode_t mode) } if (!S_ISDIR(st.st_mode)) { - if (setfilmode(dirp->d_name, mode, &st, vol->v_umask) < 0) { + int setmode = (osx && *dirp->d_name == '.')?hf_mode:mode; + + if (setfilmode(dirp->d_name, setmode, &st, vol->v_umask) < 0) { + closedir( dir ); LOG(log_error, logtype_afpd, "setdirmode: chmod %s: %s",dirp->d_name, strerror(errno) ); return -1; }