Commit Graph

42 Commits

Author SHA1 Message Date
Xin LI
b651906972 edquota(8): Cleanup to make it WARNS=6 clean.
Tested with:	make tinderbox
MFC after:	2 weeks
2020-08-17 05:57:22 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Don Lewis
3b7e0c53d5 Use strlcpy() instead of strncpy() to ensure that qup->fsname is NUL
terminated.  Don't bother checking for truncation since the subsequent
quota_read() should detect that and fail.

Reported by:	Coverity
CID:		1009980
MFC after:	1 week
2016-05-13 00:02:03 +00:00
Jilles Tjoelker
1ebe85202b edquota: Don't pass fd for temporary file to editor.
The editor opens the temporary file by name.
2013-10-27 21:06:17 +00:00
Eitan Adler
0a05b87187 Remove unneeded includes.
Tested with "make universe"; there are no conditional features.

Approved by:	cperciva
MFC after:	3 daus
2012-11-20 02:12:01 +00:00
Eitan Adler
50e04779c4 Check the return error of set[e][ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API.
Custom security modules, or future implementations of the setuid and
setgid may fail.

Submitted by:	Erik Cederstrand
Approved by:	cperciva
MFC after:	3 days
2012-10-22 03:07:05 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Dag-Erling Smørgrav
6cfc1c1e18 type / format fixup 2009-09-27 17:33:26 +00:00
Kirk McKusick
8bd6a3ab4b Update the quotafile library to manage both active quotas via the
quotactl(2) interface and inactive quotas by accessing the quota
files directly.

Update the edquota program to use this new interface as proof of
concept.
2009-02-14 08:08:08 +00:00
Kirk McKusick
916e406eb5 Move hasquota() function to libutil. 2009-02-13 06:12:15 +00:00
Kirk McKusick
cdab8b664d More updates to edquota based on feedback from Dag-Erling Smorgrav. 2009-02-10 08:09:03 +00:00
Kirk McKusick
b83b5d3b79 Updates to edquota based on feedback from Dag-Erling Smorgrav. 2009-02-05 14:06:43 +00:00
Kirk McKusick
08dc3a5e5c Finish conversion of edquota to work with 64-bit quotas.
Add -h option to request "humanized" values such as 1M, 1G, 1T, etc.

Discussed with: Dag-Erling Smorgrav
Sponsored by: Rsync.net
2009-02-04 00:21:36 +00:00
Dag-Erling Smørgrav
1b3515f39b WIP 2009-01-30 13:54:03 +00:00
Dag-Erling Smørgrav
8f518424d9 Drag this code kicking and screaming into the twenty-first century. 2008-07-02 15:51:59 +00:00
Mike Pritchard
fbb42904c4 If two files systems, /a and /b are marked as having quotas enabled
in fstab and they are normally mounted as /a/b, if /b is not mounted,
the various quota utilities will incorrectly operate with the quotas on
/a (silently) when operations are attemted on /b.

Sync up all the hasquota() routines between all the different
quota utilities and change it to detect if the file system we are
attempting to perform quota operations on is not currently mounted
and warn the user accordingly.

PR:	bin/38918
2007-02-04 06:33:15 +00:00
Mike Pritchard
dbbc0c8312 If quotas are not currently enabled for a file system, edquota -p
will operate directly on the quota file.  It will incorrectly write
the prototype user's usage information for each new quota it sets.

Fixed to read in the current quota information and update the
file correctly.

If quotas are enabled the kernel handles this case fine.

PR:	bin/15410
2007-02-04 01:41:32 +00:00
Philippe Charnier
606a36b9eb initialize unitialized variables (WARNS=6) 2006-09-14 04:45:44 +00:00
Warner Losh
486c8cc4c6 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
Ceri Davies
fc31408d87 Have edquota honour MAXLOGNAME rather than hardcoding the maximum
username length to 29 characters.

PR:		misc/62944
Submitted by:	David Hill <david@wmol.com>
Approved by:	ru
MFC after:	1 week
2004-02-24 20:58:16 +00:00
Peter Grehan
5cfe0423e6 Userland signed char fixes for PPC build. Problems were using a char
return for getopt() and comparing to -1, ditto with fgetc() and EOF,
and using the kg_nice value from <sys/user.h>

Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
Reviewed by: obrien, bde (a while back)
Tested lightly on: ppc, i386, make universe
2004-01-22 07:23:36 +00:00
David E. O'Brien
b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
Maxim Sobolev
b8b743d723 Allow edquota(8) to be used for setting up quotas non-interactively (add a
new -e option for that).

Feature requested by:	Alex V. Belinsky <fozzy@kievweb.net.ua>
MFC after:	1 month
2002-09-07 12:26:07 +00:00
Jens Schweikhardt
a35d611fbc Use "kbytes" instead of "blocks" in messages as this is really
what is calculated.

PR:		41936
Submitted by:	Lukas Ertl <le@univie.ac.at>
MFC after:	1 week
2002-08-24 11:03:48 +00:00
Ian Dowse
c99f3c68a3 Improve the code for detecting UID ranges so that usernames such
as "2-xhibit" are not considered as a range. Fix a problem where
the code would forget to increment argv.

PR:		misc/15658
2002-08-09 01:21:03 +00:00
Alfred Perlstein
f251a0df8b WARNS=4 2002-07-11 21:18:55 +00:00
Alfred Perlstein
d89167b4ea de-__P() 2002-07-11 18:31:16 +00:00
Mike Heffner
d73796c5cf WARNS=2 cleanup.
Submitted by:	Maxime Henrion <mux@qualys.com>
MFC after:	2 weeks
2001-12-10 06:05:28 +00:00
Yaroslav Tykhiy
bc9c1e902f Add a new option to edquota(8) - "-f", which will
allow to limit the prototype quota distribution (-p)
to a single filesystem. Useful when initializing
quotas on a newly added disk.

PR:		bin/30816
Submitted by:	Dmitry Morozovsky <marck@rinet.ru>
2001-09-28 10:22:36 +00:00
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Andrew Gallatin
aa29dffdf8 cleanups of my previous, quick & dirty fix of unaligned access errors on alpha.
submitted by: bde
2000-10-28 14:26:23 +00:00
Andrew Gallatin
6a66ff3cd5 fix unaligned access errors caused by bad scanf/printf format strings
PR: alpha/21247
tested by: Marcin Gryszkalis <dagoon@rs.math.uni.lodz.pl>
2000-10-26 17:40:14 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Bruce Evans
4e7767c7b9 Fixed overflow in 1K-blocks to disk-blocks conversions. Use quad
arithmetic instead of the special macros in PR 8163 or the magic
2's in PR 381.  (Rev.1.3 unfortunately fixed only half of the
problems reported in PR 381.)

PR:		381, 8163
1999-01-01 13:15:02 +00:00
Philippe Charnier
ea28e1c532 Use err(3). Add prototypes. 1997-09-17 06:29:23 +00:00
Jonathan Lemon
026df10061 Remove temporary file on exit.
PR:		4010
Submitted by:	"Anatoly A. Orehovsky" <tolik@www.tomsk.su>
1997-08-19 20:45:45 +00:00
Warner Losh
6c3f552a31 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-31 05:11:47 +00:00
Mike Pritchard
d172713dd7 Allow the use of uid ranges when using the "-p" option to allow
easy setup of default quotas for a range of uids.  Usage:

edquota -p protouser startuid-enduid

E.g.
edquota -p mpp 10000-19999

Will duplicate the quota limints for user mpp for uids 10000 - 19999.
The uids in question do not have to currently exist in /etc/passwd.
1996-03-31 20:57:44 +00:00
Bruce Evans
ff55774394 Cast some expressions involving dbtob() to (unsigned long) and print them
using %lu.  This became more broken when I fixed dbtob() to support byte
offsets >= 4GB.  The type had to change to [u]quad_t.  Previously the
expressions had type unsigned long and were printed using %d.  After
division by 1024, the expressions are guaranteed to fit in an unsigned
long, at least for the standard DEV_BSIZE, so edquota doesn't need to
know about quad_t's explicitly.

Fix all the other format mismatches exposed by compiling with -Wformat
(6 more quota limits of type unsigned long printed using %d and 6 time_t's
(i.e., longs) printed using %d).
1995-05-07 07:48:35 +00:00
Andrey A. Chernov
d117a622c6 Make edquota works with other then vi editors,
i.e.check file by name, not by fd
1994-11-22 18:52:58 +00:00
Rodney W. Grimes
dea673e932 BSD 4.4 Lite usr.sbin Sources 1994-05-26 05:23:31 +00:00