From 9e1969f2e204020aa0b034f78c46fa19ccbe31a3 Mon Sep 17 00:00:00 2001 From: didg Date: Wed, 25 May 2005 18:19:33 +0000 Subject: [PATCH] don't remove x perms, from exanet works, slightly modified. --- etc/afpd/unix.c | 6 +++--- include/atalk/adouble.h | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index c6bc7888..8f2b4cd4 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -1,5 +1,5 @@ /* - * $Id: unix.c,v 1.46 2005-04-28 20:49:45 bfernhomberg Exp $ + * $Id: unix.c,v 1.47 2005-05-25 18:19:33 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -416,14 +416,14 @@ mode_t mode; 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; diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index 56d392a1..c12924f2 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -1,5 +1,5 @@ /* - * $Id: adouble.h,v 1.26 2005-05-14 12:54:55 didg Exp $ + * $Id: adouble.h,v 1.27 2005-05-25 18:19:33 didg Exp $ * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * @@ -417,7 +417,8 @@ extern int ad_metadata __P((const char *, int, struct adouble *)); #define ad_flush_metadata(adp) ad_flush( (adp), ADFLAGS_HF) #define ad_close_metadata(adp) ad_close( (adp), ADFLAGS_HF) -/* extend header to RW if R or W (W if R for locking), +/* build a resource fork mode from the data fork mode: + * remove X mode and extend header to RW if R or W (W if R for locking), */ #ifndef ATACC #ifndef __inline__ @@ -425,9 +426,7 @@ extern int ad_metadata __P((const char *, int, struct adouble *)); #endif static __inline__ mode_t ad_hf_mode (mode_t mode) { -#if 0 - mode |= S_IRUSR; -#endif + mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); /* fnctl lock need write access */ if ((mode & S_IRUSR)) mode |= S_IWUSR; -- 2.39.2