From: didg Date: Thu, 6 Jun 2002 10:14:26 +0000 (+0000) Subject: unix.c: X-Git-Tag: point-did-cleanup~82 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=9439f2b251f67b25cfedb88f76000946138a41d9 unix.c: dir access right ma_user is a union of all permissions. volume.c: Update curdir only when chdir succeeds. Even if chdir to a new volume fails, but if closing the volume succeeds, still return 0. submit by Ngo Hoc, hoc.ngo@quantum.com --- diff --git a/etc/afpd/unix.c b/etc/afpd/unix.c index 74e450b5..c5459c16 100644 --- a/etc/afpd/unix.c +++ b/etc/afpd/unix.c @@ -1,5 +1,5 @@ /* - * $Id: unix.c,v 1.34 2002-05-10 21:35:41 jmarcus Exp $ + * $Id: unix.c,v 1.35 2002-06-06 10:14:26 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -133,13 +133,15 @@ struct maccess *ma; ma->ma_owner = utombits( mode ); + /* ma_user is a union of all permissions */ + if ( (uuid == stat->st_uid) || (uuid == 0)) { ma->ma_user = ma->ma_owner | AR_UOWN; - } else if ( gmem( stat->st_gid )) { - ma->ma_user = ma->ma_group; - } else { - ma->ma_user = ma->ma_world; } + if ( gmem( stat->st_gid )) { + ma->ma_user |= ma->ma_group; + } + ma->ma_user |= ma->ma_world; /* * There are certain things the mac won't try if you don't have diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 86bf286a..c7ce2bf1 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.26 2002-03-24 17:45:29 jmarcus Exp $ + * $Id: volume.c,v 1.27 2002-06-06 10:14:26 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -1181,11 +1181,11 @@ int ibuflen, *rbuflen; bitmap = htons( bitmap ); memcpy(rbuf, &bitmap, sizeof( bitmap )); - curdir = volume->v_dir; if ( chdir( volume->v_path ) < 0 ) { ret = AFPERR_PARAM; goto openvol_err; } + curdir = volume->v_dir; #ifdef CNID_DB if (volume->v_dbpath) @@ -1235,9 +1235,9 @@ int ibuflen, *rbuflen; } } if ( ovol != NULL ) { - curdir = ovol->v_dir; - if ( chdir( ovol->v_path ) < 0 ) { - return( AFPERR_PARAM ); + /* Even if chdir fails, we can't say afp_closevol fails. */ + if ( chdir( ovol->v_path ) == 0 ) { + curdir = ovol->v_dir; } }