summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Release quota-tools 4.05v4.05Jan Kara2019-03-296-1461/+1754
| | | | Signed-off-by: Jan Kara <jack@suse.cz>
* Use getrpcbynumber() instead of getrpcbynumber_r()Jan Kara2019-03-291-4/+4
| | | | | | | | | | 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>
* Merge type and build cleanups from Fabrice FontaineJan Kara2019-03-297-43/+47
|\
| * configure.ac: fix pkg_check_modules callsFabrice Fontaine2019-03-291-5/+5
| | | | | | | | | | | | CFLAGS and LIBS found by pkg_check_modules must be used Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
| * Include <fcntl.h> to get loff_t definitionFabrice Fontaine2019-03-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
| * Add missing <sys/cdefs.h> includeFabrice Fontaine2019-03-291-0/+1
| | | | | | | | | | | | | | | | | | 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>
| * Use proper C99 integer typesFabrice Fontaine2019-03-294-38/+40
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Disable quot toolJan Kara2019-03-262-13/+1
| | | | | | | | | | | | | | | | | | 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>
* | Remove old disclaimersJan Kara2019-03-265-127/+6
| | | | | | | | | | | | | | | | | | | | | | 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>
* | rpc.rquotad: Handle daemon(3) failureJan Kara2019-03-211-1/+4
| | | | | | | | | | | | Handle failure to in daemon(3) call and bail out with proper error code. Signed-off-by: Jan Kara <jack@suse.cz>
* | quota_nld: Check daemon() for failuresPetr Písař2019-03-211-1/+4
| | | | | | | | | | | | | | | | 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>
* | xqmstats: Fix a file descriptor leak in main()Petr Písař2019-03-211-0/+1
| | | | | | | | | | Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* | quotackeck: Fix a directory descriptor leak in scan_dir()Petr Písař2019-03-211-0/+1
| | | | | | | | | | Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* | convertquota: Fix a file descriptor leak in convert_endian()Petr Písař2019-03-211-0/+1
| | | | | | | | | | Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* | quota(1): Distinguish between none quota limits and no allocated resourcesPetr Písař2019-03-211-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge warnquota CC handling fix.Jan Kara2019-03-211-1/+1
|\ \
| * | Fix warnquota Cc field being set incorrectly when using LDAPSantiago Castro2019-03-141-1/+1
| |/
* | Track COPYING file in git.Jan Kara2018-08-291-0/+287
| | | | | | | | Signed-off-by: Jan Kara <jack@suse.cz>
* | Add quota_nld to .gitignoreJan Kara2018-07-161-0/+1
|/ | | | Signed-off-by: Jan Kara <jack@suse.cz>
* rpc: Fix wrong limit for space usageJan Kara2018-05-281-1/+2
| | | | | | | | 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>
* Listen on a TCP socketSteve Dickson2018-05-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Aadd HPE XFS supportTinguely, Mark2018-05-097-10/+22
| | | | | | | | | | | | 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>
* warnquota: Fix comparing user name to non-null-terminated utmp.ut_userPetr Písař2018-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* warnquota: Check snprintf() for overflowsPetr Písař2018-02-051-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add $(TIRPC_CFLAGS) globally to CFLAGS for RPC support, needed for libc 2.26Andreas K. Hüttel2018-02-051-3/+2
| | | | | Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> Signed-off-by: Jan Kara <jack@suse.cz>
* Install rquota(3) only if RPC is enabledPetr Písař2018-02-051-2/+4
| | | | | | | | | 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>
* quotacheck: Fail check if quota file magic is invalidJan Kara2018-02-051-0/+3
| | | | | | | | 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>
* quotacheck: Report error when caching of quota file failsJan Kara2018-02-051-7/+22
| | | | | | | | | 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>
* quotacheck: Avoid question in non-interactive modeJan Kara2018-02-051-1/+2
| | | | | | | | | 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>
* repquota: Fix output when user -2 existsJan Kara2018-01-102-0/+10
| | | | | | | | | | | | | 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>
* Implement manual choice of output unitJan Kara2018-01-1014-1845/+2398
| | | | | | | 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>
* f2fs: support f2fs's quota sysfileJaegeuk Kim2017-10-163-1/+20
| | | | | Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz>
* Release quota-tools 4.04v4.04Jan Kara2017-09-052-1/+48
| | | | Signed-off-by: Jan Kara <jack@suse.cz>
* Use TI-RPC for RPC client communicationJan Kara2017-09-051-10/+23
| | | | | | | | 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>
* rpc.rquotad: IPv6 supportJan Kara2017-09-054-79/+167
| | | | | | | | 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>
* rpc: Factor out getting of port numberJan Kara2017-09-051-29/+35
| | | | | | | Factor out getting of service port number so simplify transition to IPv6. Signed-off-by: Jan Kara <jack@suse.cz>
* Add support for ipv6 to good_clientJan Kara2017-09-051-7/+30
| | | | Signed-off-by: Jan Kara <jack@suse.cz>
* quotacheck: Deallocate memory after direct scanningPetr Písař2017-08-311-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* quota: Return non-zero exit code when getting quota failsIan Chard2017-08-311-0/+5
| | | | | | | | 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>
* quotaops: check return code of ftruncate and lseek callsDmitry V. Levin2017-05-181-24/+29
| | | | | | | | | 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>
* Use configure macros instead of hardcoded defaultsDmitry V. Levin2017-05-182-2/+6
| | | | | Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
* quotaops: check return code of fgets callsDmitry V. Levin2017-05-181-8/+20
| | | | | | | 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>
* quotaops: check setgid/setuid return codeDmitry V. Levin2017-05-181-2/+4
| | | | | | | | 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>
* quotacheck: fix ask_yn UB when fgets returns NULLDmitry V. Levin2017-05-181-2/+2
| | | | | | | | 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>
* quotacheck: change to the directory before opening it, not afterDmitry V. Levin2017-05-181-3/+8
| | | | | | | | | | | 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>
* Do not install quota_nld.8 when quota_nld is not installedDmitry V. Levin2017-05-181-1/+4
| | | | | | | | | | 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>
* quota-tools: add missing newline to die() messagesTheodore Ts'o2017-02-092-3/+3
| | | | | Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
* quotacheck: Use direct scanning also for ext4Jan Kara2016-08-091-1/+4
| | | | | | | 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>
* Improve detection of XFS quota interfaceJan Kara2016-07-121-8/+10
| | | | | | | | | 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>
* quotaon: Improve reporting of quota stateJan Kara2016-07-123-19/+55
| | | | | | | | | 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>