From 7f42b317379538dbf944730ed636034c83db7925 Mon Sep 17 00:00:00 2001 From: srittau Date: Tue, 12 Mar 2002 15:25:07 +0000 Subject: [PATCH] From trunk: preserve special file permissions. --- etc/afpd/unix.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index 2f2002e4..63b58c69 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -1,5 +1,5 @@ /* - * $Id: unix.c,v 1.24.2.5 2002-03-12 15:20:08 srittau Exp $ + * $Id: unix.c,v 1.24.2.6 2002-03-12 15:25:07 srittau Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -234,7 +234,7 @@ const int dropbox; if ( seteuid(0) < 0) { syslog( LOG_ERR, "stickydirmode: unable to seteuid root: %s", strerror(errno)); } - if ( retval=chmod( name, ( (DIRBITS | mode | S_ISVTX) & 0777 & ~default_options.umask) ) < 0) { + if ( retval=chmod( name, ( (DIRBITS | mode | S_ISVTX) & ~default_options.umask) ) < 0) { syslog( LOG_ERR, "stickydirmode: chmod \"%s\": %s", name, strerror(errno) ); return(AFPERR_ACCESS); } else { @@ -251,7 +251,7 @@ const int dropbox; * 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) & 0777 & ~default_options.umask ) < 0) && errno != EPERM) { + if ( (chmod( name, (DIRBITS | mode) & ~default_options.umask ) < 0) && errno != EPERM) { syslog( LOG_ERR, "stickydirmode: chmod \"%s\": %s", name, strerror(errno) ); retval = -1; @@ -310,19 +310,18 @@ const mode_t mode; } if (S_ISDIR(st.st_mode)) { - if ( chmod( modbuf, (DIRBITS | mode) & 0777 & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod( modbuf, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { syslog( LOG_ERR, "setdeskmode: chmod %s: %s", modbuf, strerror(errno) ); } - } else if ( chmod( modbuf, mode & 0777 & ~default_options.umask ) < 0 && errno != EPERM ) { + } else if ( chmod( modbuf, mode & ~default_options.umask ) < 0 && errno != EPERM ) { syslog( LOG_ERR, "setdeskmode: chmod %s: %s", modbuf, strerror(errno) ); } } closedir( sub ); - /* XXX: need to preserve special modes */ - if ( chmod( deskp->d_name, (DIRBITS | mode) & 0777 & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod( deskp->d_name, (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { syslog( LOG_ERR, "setdeskmode: chmod %s: %s", deskp->d_name, strerror(errno) ); } @@ -332,8 +331,7 @@ const mode_t mode; syslog( LOG_ERR, "setdeskmode: chdir %s: %s", wd, strerror(errno) ); return -1; } - /* XXX: need to preserve special modes */ - if ( chmod( ".AppleDesktop", (DIRBITS | mode) & 0777 & ~default_options.umask ) < 0 && errno != EPERM ) { + if ( chmod( ".AppleDesktop", (DIRBITS | mode) & ~default_options.umask ) < 0 && errno != EPERM ) { syslog( LOG_ERR, "setdeskmode: chmod .AppleDesktop: %s", strerror(errno) ); } return( 0 ); -- 2.39.2