| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
| |
Quota is not multithreaded so it does not have to use thread-safe
function variants. Furthermore some clone of libtirpc reportedly does
not implement the reentrant function getrpcbynumber_r(). So just avoid
using it.
Reported-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|\ |
|
| |
| |
| |
| |
| |
| | |
CFLAGS and LIBS found by pkg_check_modules must be used
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes the following build issue with musl:
dqblk_v2.h:32:2: error: unknown type name ‘loff_t’
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/quota/0005-include-fcntl.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
quota.h uses the __P definition, so it must include <sys/cdefs.h>.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved (and slighly updated) from:
https://git.buildroot.net/buildroot/tree/package/quota/0004-import-sys-cdefs.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
[Thomas: borrowed from OpenEmbedded.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved (and slightly updated) from:
https://git.buildroot.net/buildroot/tree/package/quota/0003-remove-non-posix-types.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
quot tool functionality is currently superseeded by repquota. Because
the tool is licenses under 4-clause BSD license that is incompatible
with GPLv2 (which the rest of the tools uses) and the original author is
not reachable, just drop the tool from being distributed for now.
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Quota tools is licensed as GPLv2. Historically, it contains some old
copyright disclaimers with BSD license which is incompatible with GPLv2.
However these files were over time rewritten, mostly by me, so let's
relicense them under GPLv2 as well.
Acked-by: Marco van Wieringen <mvw@planets.elm.net>
Acked-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| |
| | |
Handle failure to in daemon(3) call and bail out with proper error code.
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| |
| |
| |
| | |
daemon() function can fail. Then we should also report an failure
instead of continuing on foreground.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| | |
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| | |
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| | |
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If a user does not occupy any space or inodes on a file system but
quota limits are set, quota(1) tool still reports "none":
# quota -u test
Disk quotas for user test (uid 500): none
That's because the tool skips printing details for file systems
without any used resources. The message is also used for a file
system without any quota limits which is confusing at times.
This patch makes the distinction and changes "none" message into "no
quota limits set" and "no limited resources used" respectively.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|\ \ |
|
| |/ |
|
| |
| |
| |
| | |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|/
|
|
| |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Limit of maximum allowable space usage for RPC transfer was wrongly set
to ~4GB instead of ~4TB due to overflow in constant initialization. Fix
it.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rpc.rquotad spins in libtirpc's rendezvous_request() on accepting TCP
connections because the polled TCP socket is not listening:
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=5,
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=6,
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=7,
events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 4, -1) = 2 ([{fd=5,
revents=POLLHUP}, {fd=7, revents=POLLHUP}])
accept(5, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
accept(7, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
The polled descriptors are:
rpc.rquot 21981 root 4u IPv4 80449159 0t0 UDP *:rquotad
rpc.rquot 21981 root 5u sock 0,9 0t0 80449162 protocol: TCP
rpc.rquot 21981 root 6u IPv6 80449165 0t0 UDP *:rquotad
rpc.rquot 21981 root 7u sock 0,9 0t0 80449168 protocol: TCPv6
That results into a high CPU usage just after staring rpc.rquotad
process.
This patch adds a listen() call to svc_create_sock()
routine which is needed with libtirpc version of svc_tli_create()
as well as a needed IPv6 setsockopt().
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
| |
HPE XFS has a different superblock magic and type name
to allow the community XFS and HPE XFS to coexist in
the same linux kernel.
This patch add HPE XFS support to the quota-tools so
our customers can use it.
Signed-off-by: Mark Tinguely <mark.tinguely@hpe.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GCC 8 with GNU libc 2.27 warns:
gcc -DHAVE_CONFIG_H -I. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/libnl3 -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o quota_nld-quota_nld.o `test -f 'quota_nld.c' || echo './'`quota_nld.c
quota_nld.c: In function ‘write_console_warning’:
quota_nld.c:273:7: warning: ‘strcmp’ argument 2 declared attribute ‘nonstring’ [-Wstringop-overflow=]
if (strcmp(user, uent->ut_user))
^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/utmp.h:29,
from quota_nld.c:23:
/usr/include/bits/utmp.h:65:8: note: argument ‘ut_user’ declared here
char ut_user[UT_NAMESIZE]
^~~~~~~
This is because ut_user value misses the terminating null byte if it
fits exactly into ut_user array, as document in utmp(5):
String fields are terminated by a null byte ('\0') if they are
shorter than the size of the field.
Recent GCC and glibc recevied compile-time checks and annotations
(__attribute_nonstring_) that catches these mistakes.
This patch fixes it by using strncmp(3) and by ignoring user names
that does not fit into utmp log format. It's better not to warn than
spamming unrelated user.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GCC 8 with GNU libc 2.27 prerelease warns:
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o warnquota.o warnquota.c
warnquota.c: In function ‘lookup_user’:
warnquota.c:415:29: warning: ‘%s’ directive output may be truncated writing up to 2047 bytes into a region of size 255 [-Wformat-truncation=]
snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr, user);
^~
warnquota.c:415:2: note: ‘snprintf’ output 4 or more bytes (assuming 2051) into a destination of size 256
snprintf(searchbuf, 256, "(%s=%s)", config->ldap_search_attr, user);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warnquota.c: In function ‘warn_quota’:
warnquota.c:896:51: warning: ‘%s’ directive output may be truncated writing up to 2047 bytes into a region of size 2041 [-Wformat-truncation=]
snprintf(config->ldap_uri, CNF_BUFFER, "ldap://%s:%d", config->ldap_host, config->ldap_port);
^~ ~~~~~~~~~~~~~~~~~
warnquota.c:896:4: note: ‘snprintf’ output between 10 and 2067 bytes into a destination of size 2048
snprintf(config->ldap_uri, CNF_BUFFER, "ldap://%s:%d", config->ldap_host, config->ldap_port);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is patch fixes it by catching the cases when snprintf() truncates and
reporting an error.
Perfect fix would fall back into dynamically allocated buffers but
I think that would make these corner case too complicated provided
nobody had yet complained about them.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
rquote(3) documents rpcsvc header files. Thus it should be installed
only if the the header files are installed and that is only if RPC
configure feature is enabled.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Currently quotacheck will just continue if quotafile magic is invalid.
Instead ask whether we should continue assuming quota format passed from
the command line.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
Currently quotacheck returns with zero exit code even though caching of
quota file fails. Fix it to return with non-zero exit code in that case
as expected.
Reported-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
A question when quota file version is incorrect is asked even if
quotacheck is run in non-interactive mode. Avoid asking the question in
that case and fail the check instead.
Reproted-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Vladimit Meshkov reported that when user -2 exists and user namespaces
are enabled in the kernel, repquota(8) fails to output anything. He also
analyzed this is because in such case repquota(8) tries to query info
for user -1 which is invalid ID, gets error from the kernel, and bails
out.
Fix the problem by stopping iteration over IDs when we reach ID -1.
Reported-by: Vladimir Meshkov <ubob74@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
| |
Add an optional argument to option -s allowing user to manually specify
units used for outputting results.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
| |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Currently standard RPC library in glibc is used for client RPC
communication to rpc.rquotad. Make tools use libtirpc so that IPv6 is
properly supported.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Add support for listening on IPv6 addresses as well.
[Heavily modified from original code by Anders Blomdell]
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
| |
Factor out getting of service port number so simplify transition to
IPv6.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
| |
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
quotacheck had memory leaks because it did not clean up after direct
ext scanning:
==6885== 1,392 (88 direct, 1,304 indirect) bytes in 1 blocks are definitely lost in loss record 19 of 23
==6885== at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
==6885== by 0x4E5288B: ext2fs_make_generic_bitmap (in /usr/lib64/libext2fs.so.2.4)
==6885== by 0x4E47ED5: ext2fs_allocate_inode_bitmap (in /usr/lib64/libext2fs.so.2.4)
==6885== by 0x10BBA5: ext2_direct_scan (quotacheck.c:435)
==6885== by 0x10DA8A: check_dir (quotacheck.c:971)
==6885== by 0x10E634: check_all (quotacheck.c:1192)
==6885== by 0x10E6EC: main (quotacheck.c:1212)
==6885==
==6885== 8,464 (144 direct, 8,320 indirect) bytes in 1 blocks are definitely lost in loss record 22 of 23
==6885== at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
==6885== by 0x4E5749D: ext2fs_open_inode_scan (in /usr/lib64/libext2fs.so.2.4)
==6885== by 0x10BBF0: ext2_direct_scan (quotacheck.c:440)
==6885== by 0x10DA8A: check_dir (quotacheck.c:971)
==6885== by 0x10E634: check_all (quotacheck.c:1192)
==6885== by 0x10E6EC: main (quotacheck.c:1212)
==6885==
==6885== 15,243 (88 direct, 15,155 indirect) bytes in 1 blocks are definitely lost in loss record 23 of 23
==6885== at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
==6885== by 0x4E5288B: ext2fs_make_generic_bitmap (in /usr/lib64/libext2fs.so.2.4)
==6885== by 0x4E47ED5: ext2fs_allocate_inode_bitmap (in /usr/lib64/libext2fs.so.2.4)
==6885== by 0x10BB55: ext2_direct_scan (quotacheck.c:430)
==6885== by 0x10DA8A: check_dir (quotacheck.c:971)
==6885== by 0x10E634: check_all (quotacheck.c:1192)
==6885== by 0x10E6EC: main (quotacheck.c:1212)
[JK: Improve coding style]
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Make sure we return with non-zero exit code when getting quotas for some
user fails.
Signed-off-by: Ian Chard <flup@users.sf.net>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
ftruncate and lseek syscalls may fail for different reasons,
do not ignore these errors. Create a helper function and use it
instead of duplicating error checks and diagnostic messages.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
| |
fgets can return NULL anytime, do not ignore it.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
setgid/setuid syscalls may fail for different reasons,
do not ignore these errors.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
| |
Do not use a random value from the stack as an answer when fgets
returns NULL, return the default value in the latter case.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids the race between opening the directory being scanned
and changing into that directory for processing its contants.
This is not the only race of that kind, but chdir return code
has to be checked anyway and the fix costs nothing, so let it be fixed.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
|
| |
When netlink support is not enabled, quota_nld is not built
and not installed but quota_nld.8 is still installed.
Fix this inconsistency and install quota_nld.8 iff quota_nld
is installed.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
| |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
| |
We mistakenly didn't use direct scanning through libext2fs for ext4
filesystem. Add ext4 to the list of filesystem libext2fs can handle.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
Except for really ancient kernels XFS quota interface is always
available when quota is compiled in. In recent kernels it is also usable
for other filesystems than XFS. So always add XFS quota format as usable
if we have non-ancient kernel.
Signed-off-by: Jan Kara <jack@suse.cz>
|
|
|
|
|
|
|
|
|
| |
quotactl Q_XFS_GETQSTAT is able to report whether only accounting or
also quota enforcement is turned on. This works for XFS and GFS2 for
ages and since kernel 4.1 also for other filesystems. Use this quotactl
when it is supported and report more details in verbose mode.
Signed-off-by: Jan Kara <jack@suse.cz>
|