From: jmarcus Date: Sun, 13 Jan 2002 07:22:02 +0000 (+0000) Subject: Patch from Egon Niederacher to fix quota X-Git-Tag: point-backport-1-5-1 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=8e823ee9678b43338b5734c895772fa75bbb8fb9 Patch from Egon Niederacher to fix quota support on FreeBSD. I also fixed a potention multiplatform bug with group quotas. --- diff --git a/etc/afpd/quota.c b/etc/afpd/quota.c index f974c37d..3e8b0ad7 100644 --- a/etc/afpd/quota.c +++ b/etc/afpd/quota.c @@ -1,5 +1,5 @@ /* - * $Id: quota.c,v 1.14 2002-01-04 04:45:47 sibaz Exp $ + * $Id: quota.c,v 1.15 2002-01-13 07:22:02 jmarcus Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -231,15 +231,21 @@ struct dqblk *dq; #endif /* TRU64 */ #ifdef BSD4_4 - if ( quotactl( vol->v_gvs, QCMD(Q_GETQUOTA,USRQUOTA), - uid, (char *)dq ) != 0 ) { - return( AFPERR_PARAM ); + if ( seteuid( getuid() ) == 0 ) { + if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA,USRQUOTA), + uid, (char *)dq ) != 0 ) { + /* try group quotas */ + if (ngroups >= 1) { + if ( quotactl(vol->v_path, QCMD(Q_GETQUOTA, GRPQUOTA), + groups[0], (char *) &dqg) != 0 ) { + seteuid( uid ); + return( AFPERR_PARAM ); + } + } + } + seteuid( uid ); } - if (ngroups == 1) - quotactl(vol->v_gvs, QCMD(Q_GETQUOTA, GRPQUOTA), - groups[0], (char *) &dqg); - #elif defined(TRU64) if ( seteuid( getuid() ) == 0 ) { if ( quotactl( vol->v_path, QCMD(Q_GETQUOTA, USRQUOTA), @@ -256,7 +262,7 @@ struct dqblk *dq; return( AFPERR_PARAM ); } - if (ngroups == 1) + if (ngroups >= 1) quotactl(QCMD(Q_GETQUOTA, GRPQUOTA), vol->v_gvs, groups[0], (char *) &dqg); #endif /* BSD4_4 */