Bug 25724

Summary: quota(1) outputs wrong limits about NFS quota
Product: Base System Reporter: mori <mori>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   

Description mori 2001-03-12 08:10:01 UTC
	quota(1) has int overflow problem in getnfsquota().

	I set soft/hard limits to 5GB on remote system (NetBSD),
	and view quota on FreeBSD.
	I got follow output.  Soft/hard limits is too small.

     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
           /.u0 1980574* 805696  805696    none    9983       0       0        

	I expected follow output.

     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
           /.u0 1980574 5000000 5000000            9983       0       0

Fix: 

This patch is for src/usr.bin/quota/quota.c rev.1.11.2.1.

--- quota.c	2000/07/02 09:57:51	1.11.2.1
+++ quota.c	2001/03/12 02:59:15
@@ -641,13 +641,13 @@
 	case Q_OK:
 		gettimeofday(&tv, NULL);
 			/* blocks*/
-		dqp->dqb_bhardlimit =
+		dqp->dqb_bhardlimit = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
-		dqp->dqb_bsoftlimit =
+		dqp->dqb_bsoftlimit = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
-		dqp->dqb_curblocks =
+		dqp->dqb_curblocks = (u_quad_t)
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks *
 		    gq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize / DEV_BSIZE;
 			/* inodes */
How-To-Repeat: 
	Show big quota (ex. 5GB) on NFS mounted file system with quota.
Comment 1 David Schultz freebsd_committer freebsd_triage 2003-08-10 17:55:23 UTC
State Changed
From-To: open->closed

Fixed in quota.c,v1.21 and 1.11.2.6 (STABLE).