summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
10 daysquotaio_xfs: Convert remaining quotactl(2) calls to quotactl_handle()HEADmasterJan Kara1-10/+3
quotaio_xfs has a mix of quotactl calls using do_quotactl() and using quotactl_handle(). This is confusing because the command argument behaves differently. Convert all places to use quotactl_handle(). Signed-off-by: Jan Kara <jack@suse.cz>
10 daysquotaio_xfs: Fix quota-tools on XFSJan Kara1-7/+4
Patches implementing tmpfs quota support, commit 00534e79856c ("Enable support for tmpfs quotas") in particular, broke quota-tools on XFS because quotactl(2) syscall got called with wrong arguments. Fix it. Signed-off-by: Jan Kara <jack@suse.cz>
10 daysquotaio_xfs: Fix error handling in xfs_read_dquot()Jan Kara1-1/+6
When quotactl(2) fails, xfs_read_dquot() will happily return zero-filled structure. This is fine when the user structure does not exist but it is wrong when there's other error (like EACCESS). Fix the error handling. Signed-off-by: Jan Kara <jack@suse.cz>
10 daysDisable BSD_BEHAVIOUR by defaultJan Kara1-1/+1
These days BSD_BEHAVIOUR is really old legacy and there's no point in doing permission checks in userspace when kernel does it for us. So disable BSD_BEHAVIOUR by default. Signed-off-by: Jan Kara <jack@suse.cz>
10 daysquotaops: Checking egid with BSD_BEHAVIORJan Kara1-0/+3
It is undefined whether getgroups() call will return current egid in the list of groups it returns. Add an explicit check for egid to the permission checks performed when BSD_BEHAVIOUR is enabled. Signed-off-by: Jan Kara <jack@suse.cz>
2024-01-29Enable support for tmpfs quotasCarlos Maiolino9-30/+59
To achieve so, add a new function quotactl_handle() to the quotaio subsystem, this will call do_quotactl() with or without a valid quotadev, according to the filesystem type. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2024-01-29Add quotactl_fd() supportCarlos Maiolino13-57/+96
To be able to set quotas on filesystems without a backing device, quota tools should be able to use quotactl_fd(). To achieve that, add a new helper, do_quotactl(), to select between quotactl() and quotactl_fd(). This shouldn't change the semantics of current code. quotactl_fd() will be called if and only if the handlers contain an empty device, and a valid mountpoint. All current calls containing a value device should be still handled by quotactl(). The same is true for calls passing a NULL device on purpose, aiming to sync active quotas. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2024-01-29Rename searched_dir->sd_dir to sd_isdirCarlos Maiolino1-3/+3
The field holds information if we are searching a directory mountpoint or a device, rename the field to something more meaningful. We could switch it to bool, but it seems pointless to include a whole header just for it, so keep the int type. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2022-12-06quota-nld: fix open PID file failed when systemd read itlihaoxiang (F)1-11/+35
Running quota_nld by systemd might cause the problem that systemd couldn't open the PID file generated by quota_nld. In fact, the PID file hasn't existed yet because it originates from the child process of quota_nld which is a daemon process. As the main process exit, systemd try to access the PID file but the daemon hadn't create it that time. In this situation, we move the procedure of creating PID file into the parent process to ensure the PID file must existed when quota_nld exit. After that, the above problem would never occur again. [JK: Fixed up SIGTERM handling and format strings] Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com> Signed-off-by: Jan Kara <jack@suse.cz>
2022-11-01edquota: Fix editing of individual user grace timesJan Kara2-3/+12
When user is not over softlimit, there's no point to set the grace time. The kernel will just ignore it. Output error message instead so that user is not confused. Also editing of grace times when quotas are enabled did not really work because we didn't tell the kernel grace times have changed. Fix it. Signed-off-by: Jan Kara <jack@suse.cz>
2022-11-01setquota: Avoid false error messages when setting grace timesJan Kara1-2/+4
When setting grace times for a user with only inodes or blocks over softlimit, setquota(8) was wrongly complaining about not being able to set the grace time of the non-exceeded entity although it was left unset. Silence this bogus error message. Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-26Make configure.ac POSIX compliantSam James1-1/+1
Configure scripts need to be runnable with a POSIX-compliant /bin/sh. Replace == comparison operator (bashism) with = (POSIX) to fix errors: configure: WARNING: tcpd.h not found ./configure: 8453: test: X: unexpected operator checking that generated files are newer than configure... done Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-23Update required gettext versionJan Kara1-1/+1
Update required gettext version to 0.19 so that newer autoconf macros get copied. The old ones from 2014 start to have compatibility issues. Reported-by: Sam James <thesamesam@users.sourceforge.net> Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-21Release quota-tools 4.09Jan Kara2-1/+4
Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-21Avoid including manpages multiple times in man_MANSJan Kara1-7/+9
Due to variable assignments getting reordered by automake the variable man_MANS contained some manpages two times. This then resulted in complaints when installing the manpages. Avoid the problem by reworking how the list of manpages is constructed. Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-19Release quota-tools 4.08Jan Kara2-1/+4
Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-19Include unconfigured manpages into distributionJan Kara5-454/+482
Include manpages for features not configured by configure script into the distribution tarball. This makes the distribution tarball complete. Signed-off-by: Jan Kara <jack@suse.cz>
2022-09-16Release quota-tools 4.07Jan Kara2-1/+12
Signed-off-by: Jan Kara <jack@suse.cz>
2021-09-17quotasys.c: fix strncpy usageDmitry V. Levin1-1/+1
When quota is configured using --enable-werror, gcc -flto fails with the following diagnostics: In function 'strncpy', inlined from 'sstrncpy' at common.c:107:2, inlined from 'copy_mntoptarg' at quotasys.c:774:3, inlined from 'copy_mntoptarg' at quotasys.c:769:13: /usr/include/bits/string_fortified.h:91:10: error: '__builtin_strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=] 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^ quotasys.c: In function 'copy_mntoptarg': quotasys.c:774:25: note: length computed here 774 | sstrncpy(buf, optarg, min(buflen, strlen(optarg) + 1)); | ^ This diagnostics is correct: strcpy() copies at most "len" bytes of the string pointed to by "src", including the terminating null byte, to the buffer pointed to by "dest". Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2021-09-17common.c: fix strncat usageDmitry V. Levin1-2/+1
When quota is configured using --enable-werror, gcc -flto fails with the following diagnostics: In function 'strncat', inlined from 'sstrncat' at common.c:113:2, inlined from 'get_proc_num' at quotastats.c:46:2: /usr/include/bits/string_fortified.h:122:10: error: '__builtin___strncat_chk' specified bound 4096 equals destination size [-Werror=str ingop-overflow=] 122 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); | ^ This diagnostics is correct: when "src" contains "len" or more bytes, strncat() writes "len"+1 bytes to "dest" ("len" from "src" plus the terminating null byte). Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2021-08-20quotacheck, quotaon: Always display message about deprecated usageJan Kara2-5/+9
Visible quota files on ext4 filesystem are deprecated. Make sure we always display the warning message and also expand the message to explain how the filesystem can be converted. Signed-off-by: Jan Kara <jack@suse.cz>
2021-03-16quota_nld: Initialize sa_mask when registering PID file removalPetr Písař1-1/+1
term_action.sa_mask is an automatic variable and and thus unitialized. This patch empties the signal mask. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-30Drop sys/cdefs.h usageJan Kara1-2/+1
quota.h header includes sys/cdefs.h because it uses __P() macro in quotactl syscall declaration. However glibc currently defines __P() is nop and it only causes issues with other libc implementations (e.g. musl libc). So just drop __P() usage and sys/cdefs.h include. Reported-by: 2xsaiko <git@dblsaiko.net> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-24quotaio_xfs: Warn when large kernel timestamps cannot be handledJan Kara2-0/+11
When time_t is 32-bit, warn if the kernel returns anything that cannot fit in these time stamps. This also fixes a compilation warning that shift exceeds data type size. Similarly when converting data to pass to kernel, just avoid the pointless shift (generating compiler warning) when time_t is 32-bit. Reported-by: "Dmitry V. Levin" <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-23quotaops: fix compilation warningDmitry V. Levin1-0/+2
When quota is configured using --enable-werror --disable-bsd_behaviour, the compilation fails with the following diagnostics: quotaops.c: In function 'getprivs': quotaops.c:143:1: error: label 'out_err' defined but not used [-Werror=unused-label] Fixes: 7942290a ("quotaops: Do not leak dquot structures on failure") Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-23quotacheck: Remove a dead code from process_file()Petr Písař1-1/+0
The ret variable inicialization is useless because it is assigned in all (two) subsequent code branches. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-11quota: Use realloc(3) instead of reallocarray(3)Fabrice Fontaine1-1/+1
reallocarray(3) has been added to glibc relatively recently (version 2.26, from 2017) and apparently not all users run new enough glibc. Just use realloc(3) for now since in this case there's no real risk of overflow. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-11-09Release quota-tools 4.06v4.06Jan Kara2-1/+36
2020-11-09Remove quot toolJan Kara8-1783/+1264
The tool hasn't been compiled already in the previous version and nobody complained. Just delete it completely. Signed-off-by: Jan Kara <jack@suse.cz>
2020-10-19quotacheck,quotaon: Suggest using quota feature for ext4Jan Kara4-24/+76
Ext4 supports quota using internal quota files for quite some time. Suggest using this quota feature instead of external quota files if the kernel is new enough since external quota files on ext4 will be deprecated. Signed-off-by: Jan Kara <jack@suse.cz>
2020-09-21quota: Add --filesystem optionJan Kara2-4/+28
Add option --filesystem to specify filesystem to report quotas for while still maintaining the capability of specifying also names to report quotas for. Signed-off-by: Jan Kara <jack@suse.cz>
2020-09-21quota: Add synopsis for project quotaJan Kara1-1/+2
Signed-off-by: Jan Kara <jack@suse.cz>
2020-09-21Handle grace time overflows for XFS quotasJan Kara2-9/+20
Add checks and error handling to report when grace times set for XFS quotas would overflow. Signed-off-by: Jan Kara <jack@suse.cz>
2020-09-07Support grace period expirations past y2038 for XFSDarrick J. Wong2-5/+39
Add the ability to interpret the larger quota grace period expiration timestamps that the kernel can export via struct xfs_kern_dqblk. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-05-21Fix limits setting on XFS filesystemJan Kara1-1/+3
xfs_commit_dquot() always set FS_DQ_LIMIT_MASK when calling Q_XFS_SETQLIM. So far this wasn't a problem since quota tools didn't support setting of anything else for XFS but now that kernel will start supporting setting of grace times for XFS, we need to be more careful and set limits bits only if we really want to update them. Also FS_DQ_LIMIT_MASK contains real-time limits as well. Quota tools currently don't support them in any way so avoid telling kernel to set them. Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-05-14quota-tools: Set FS_DQ_TIMER_MASK for individual xfs grace timesEric Sandeen1-0/+2
xfs quota code doesn't currently allow increasing an individual user's grace time, but kernel patches are in development for this. In order for setquota to be able to send this update via setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying to update the grace times on an individual user's dquot. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-05-13quota-tools: pass quota type to QCMD for Q_XFS_GETQSTATEric Sandeen2-2/+2
Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned timer information for the first quota type which was found to be enabled. As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls") the kernel now honors the quota type requested, so send that from the Q_XFS_GETQSTAT calls in quota tools. Older kernels ignore the type altogether, so this change should be backwards compatible with no change in behavior. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2020-03-26Fix ignoring disabled quotasPetr Písař1-1/+3
quota(1) command ignores file systems without enabled quotas. (In contrast to "quota -f".) This works for local file systems and it used to work for NFS file system until commit 4cd287f3fa38 ("rpc: Clarify error message when cannot connect to rpc.rquotad"). quota(1) command now reports an error whenever at least one NFS-mounted file system has disabled the quotas. This renders the tool unusable. This patch readds an exception for the ENOENT errno that was removed with the commit probably by a mistake. [JK: Improve commit message, make getprivs() print more descriptive message in case quota is not enabled] Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-11-05warnquota: Initialize all members of a configparams structurePetr Písař1-7/+1
Running warnquota under valgrind reported many "Conditional jump or move depends on uninitialised value" mistakes because readconfigfile() did not initizalize ldap_bindpw member if some of the configuration options were missing from the configuration file. This patch simply initializes all bytes of the configparams structure to 0 instead of settting each of the members explicitly. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-11-05warnquota: Free LDAP error messagePetr Písař1-1/+4
ldap_get_option(3) documents that a pointer set by LDAP_OPT_DIAGNOSTIC_MESSAGE must be freed with ldap_memfree(3). Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-10-04Make a directory for quota_nld PID file configurablePetr Písař2-2/+12
While Filesystem Hierarchy Standard prescribes /var/run path for storing PID files, some (systemd-based) distributions uses /run. This patch adds a --with-pid-dir=DIRECTORY option to the ./configure script. The option enables to change the path. Default one is /var/run as used to be until now. (I did not use $localstatedir environment variable because Autoconf manual allows using "precious" variables only in a makefile.) Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-09-12warnquota: Clarify that CC_TO gets resolved through LDAPJan Kara1-0/+2
Clarify that CC_TO field from warnquota.conf gets resolved through LDAP lookup similarly to normal message recifient. Signed-off-by: Jan Kara <jack@suse.cz>
2019-09-12warnquota: Print also additional error info for LDAP errorsJan Kara1-5/+21
LDAP library provides additional error information in some cases. Print it make debugging LDAP setup easier. Signed-off-by: Jan Kara <jack@suse.cz>
2019-09-08warnquota: Properly detect LDAP errorsJan Kara1-2/+2
ldap_search_ext_s() and ldap_sasl_bind_s() can return also positive error result codes. Catch them properly. Signed-off-by: Jan Kara <jack@suse.cz>
2019-08-15warnquota: Do not ignore errors in config fileJan Kara3-14/+85
Currently warnquota ignores unknown variables, or lines we cannot parse in the config file. This is potentially dangerous as that may result in errors being missed and warnquota operating differently than administrator intended. Change warnquota to abort on errors in config file and provide -I option for ignoring errors for backward compatibility. Signed-off-by: Jan Kara <jack@suse.cz>
2019-08-12warnquota: Fix help textJan Kara1-1/+1
The help text was wrongly saying that -v is equivalent to --version. It should be -V. Signed-off-by: Jan Kara <jack@suse.cz>
2019-07-30quotacheck: Skip checking of filesystems with hidded quota files earlyJan Kara1-2/+2
Currently when filesystem tracks quotas in hidden quota files (but is also capable of tracking it in regular files), we scan the whole filesystem and only after that find out we cannot actually make use of newly created quota files. Just detect this case before scanning the fs and skip it. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-28quotaops: Make error string translatableJan Kara1-1/+1
Add forgotten translation quotes to the error string. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-28rpc: Clarify error message when cannot connect to rpc.rquotadJan Kara2-19/+9
Currently when RPC rquota service is not registered, we report somewhat confusing "No such file of directory" error. For other errors when creating rquota request we report "Connection refused". There's no big difference for user between these errors and neither of them tells what really happened. So just unify handling of these errors and report more general error telling the user where the problem is. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-24setquota: Report failure to obtain quota informationJan Kara1-0/+18
setquota currently silently ignored when it could not obtain quota information to update and just skipped updating for the filesystem. Make it report error and exit properly. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-24quotaops: Do not leak dquot structures on failureJan Kara1-4/+5
Some error paths in getprivs() were not properly freeing already fetched structures. Free them properly in case of error. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-24quotaops: Do not return partial list from getprivs()Jan Kara1-8/+11
When we failed to get some dquots from NFS server, we just reported error, didn't include the dquot in the list built in getprivs() but otherwise continued operation. Fail getprivs() in case of error instead so that the failure propagates properly to the caller. Signed-off-by: Jan Kara <jack@suse.cz>
2019-05-24Make messages about failures for NFS consistent with local filesystemsJan Kara4-7/+7
Currently, some types for failures when fetching quota information for NFS filesystem were silent (e.g. when rpc.rquotad was not running) while others were reporting error message (e.g. when rpc connection failed). There's no big difference in these for the user / administrator and also is inconsistent with how we deal with local filesystems - there we report error if the filesystem was explicitely specified on command line and silently ignore it for "scan all" operations. So change error reporting for NFS to report errors about quota not being supported if and only if filesystem was explicitely specified on command line. Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-02Delete old documentationJan Kara4-4368/+1
Delete old documentation files that were superseeded by doc/quotadoc.sgml. Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-02COPYING: Update mailing addressJan Kara1-14/+14
Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-02edquota: Remove forgotten license headerJan Kara1-32/+1
Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-02configure.ac: add --disable-pie optionFabrice Fontaine2-1/+13
PIE is not necessarily supported on all architectures, so add an option to allow the user to disable the PIE. This fixes the build on the m68k architecture: - http://autobuild.buildroot.org/results/25985bbc160e3d62b23c4c613b2a81f3711621e3 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-01warnquota: Improve examples in warnquota.confJan Kara1-32/+72
Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-01Avoid tampering with user CFLAGSDmitry V. Levin2-4/+8
CFLAGS is a variable that users are entitled to modify in order to compile the package, so do not tamper with CFLAGS, apply package specific changes to AM_CFLAGS instead. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2019-04-01Revert "configure.ac: fix pkg_check_modules calls"Dmitry V. Levin1-5/+5
CFLAGS and LIBS are variables that users are entitled to modify in order to compile the package, so do not tamper with CFLAGS and LIBS. COM_ERR_CFLAGS, EXT2FS_CFLAGS, DBUS_CFLAGS, LIBNL3_CFLAGS, TIRPC_CFLAGS, COMM_ERR_LIBS, EXT2FS_LIBS, DBUS_LIBS, LIBNL3_LIBS, and TIRPC_LIBS should be used directly where appropriate and apparently they already are. This reverts commit b54d97d677481287faa5d6b98c92f111141c1af3. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-31Makefile.am: link with INTLLIBSFabrice Fontaine1-0/+17
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-03-29Release quota-tools 4.05v4.05Jan Kara6-1461/+1754
Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-29Use getrpcbynumber() instead of getrpcbynumber_r()Jan Kara1-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>
2019-03-29Merge type and build cleanups from Fabrice FontaineJan Kara7-43/+47
2019-03-29configure.ac: fix pkg_check_modules callsFabrice Fontaine1-5/+5
CFLAGS and LIBS found by pkg_check_modules must be used Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-03-29Include <fcntl.h> to get loff_t definitionFabrice Fontaine1-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>
2019-03-29Add missing <sys/cdefs.h> includeFabrice Fontaine1-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>
2019-03-29Use proper C99 integer typesFabrice Fontaine4-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>
2019-03-26Disable quot toolJan Kara2-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>
2019-03-26Remove old disclaimersJan Kara5-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>
2019-03-21rpc.rquotad: Handle daemon(3) failureJan Kara1-1/+4
Handle failure to in daemon(3) call and bail out with proper error code. Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-21quota_nld: Check daemon() for failuresPetr Písař1-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>
2019-03-21xqmstats: Fix a file descriptor leak in main()Petr Písař1-0/+1
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-21quotackeck: Fix a directory descriptor leak in scan_dir()Petr Písař1-0/+1
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-21convertquota: Fix a file descriptor leak in convert_endian()Petr Písař1-0/+1
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2019-03-21quota(1): Distinguish between none quota limits and no allocated resourcesPetr Písař1-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>
2019-03-21Merge warnquota CC handling fix.Jan Kara1-1/+1
2019-03-14Fix warnquota Cc field being set incorrectly when using LDAPSantiago Castro1-1/+1
2018-08-29Track COPYING file in git.Jan Kara1-0/+287
Signed-off-by: Jan Kara <jack@suse.cz>
2018-07-16Add quota_nld to .gitignoreJan Kara1-0/+1
Signed-off-by: Jan Kara <jack@suse.cz>
2018-05-28rpc: Fix wrong limit for space usageJan Kara1-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>
2018-05-28Listen on a TCP socketSteve Dickson1-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>
2018-05-09Aadd HPE XFS supportTinguely, Mark7-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>
2018-02-05warnquota: Fix comparing user name to non-null-terminated utmp.ut_userPetr Písař1-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>
2018-02-05warnquota: Check snprintf() for overflowsPetr Písař1-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>
2018-02-05Add $(TIRPC_CFLAGS) globally to CFLAGS for RPC support, needed for libc 2.26Andreas K. Hüttel1-3/+2
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> Signed-off-by: Jan Kara <jack@suse.cz>
2018-02-05Install rquota(3) only if RPC is enabledPetr Písař1-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>
2018-02-05quotacheck: Fail check if quota file magic is invalidJan Kara1-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>
2018-02-05quotacheck: Report error when caching of quota file failsJan Kara1-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>
2018-02-05quotacheck: Avoid question in non-interactive modeJan Kara1-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>
2018-01-10repquota: Fix output when user -2 existsJan Kara2-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>
2018-01-10Implement manual choice of output unitJan Kara14-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>
2017-10-16f2fs: support f2fs's quota sysfileJaegeuk Kim3-1/+20
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz>
2017-09-05Release quota-tools 4.04v4.04Jan Kara2-1/+48
Signed-off-by: Jan Kara <jack@suse.cz>
2017-09-05Use TI-RPC for RPC client communicationJan Kara1-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>
2017-09-05rpc.rquotad: IPv6 supportJan Kara4-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>
2017-09-05rpc: Factor out getting of port numberJan Kara1-29/+35
Factor out getting of service port number so simplify transition to IPv6. Signed-off-by: Jan Kara <jack@suse.cz>
2017-09-05Add support for ipv6 to good_clientJan Kara1-7/+30
Signed-off-by: Jan Kara <jack@suse.cz>
2017-08-31quotacheck: Deallocate memory after direct scanningPetr Písař1-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>
2017-08-31quota: Return non-zero exit code when getting quota failsIan Chard1-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>
2017-05-18quotaops: check return code of ftruncate and lseek callsDmitry V. Levin1-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>
2017-05-18Use configure macros instead of hardcoded defaultsDmitry V. Levin2-2/+6
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2017-05-18quotaops: check return code of fgets callsDmitry V. Levin1-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>
2017-05-18quotaops: check setgid/setuid return codeDmitry V. Levin1-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>
2017-05-18quotacheck: fix ask_yn UB when fgets returns NULLDmitry V. Levin1-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>
2017-05-18quotacheck: change to the directory before opening it, not afterDmitry V. Levin1-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>
2017-05-18Do not install quota_nld.8 when quota_nld is not installedDmitry V. Levin1-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>
2017-02-09quota-tools: add missing newline to die() messagesTheodore Ts'o2-3/+3
Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-08-09quotacheck: Use direct scanning also for ext4Jan Kara1-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>
2016-07-12Improve detection of XFS quota interfaceJan Kara1-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>
2016-07-12quotaon: Improve reporting of quota stateJan Kara3-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>
2016-07-06quota: fix coredump if projid file does not existWang Shilong1-2/+4
if '/etc/projid' dose not exist,@project_file will be NULL pointer, fclose will cause coredump, add check in endprent(). Signed-off-by: Wang Shilong <wshilong@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-07-06quotacheck: Fix buggy error check of read(2)Jan Kara1-1/+1
'rd' was declared as size_t which is unsigned so it could never be less than 0. Fix it by declaring 'rd' as ssize_t which is the real read(2) return type. Signed-off-by: Jan Kara <jack@suse.cz>
2016-04-04repquota: use the same whitespace for quotaio_meta as quotaio_v2Theodore Ts'o1-2/+3
If a quota implementation does not have a report function, such as quotaio_meta, print the same white spaces so that xfstests generic/235 doesn't fail. The extra white sapce makes it easier to read the output, and consistency is a good thing in any case. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31repquota: Add project quota supportJan Kara2-7/+33
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31edquota: Project quota supportJan Kara2-17/+34
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31setquota: Project quota supportJan Kara2-22/+58
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31quota: Add project quota supportJan Kara2-8/+43
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31quotasync: Add project quota supportJan Kara2-5/+17
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31quotaon: Add project quota supportJan Kara3-21/+61
Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-31Add support for project quota into generic codeJan Kara6-13/+224
The support for project quota in generic code is simple. We just need functions to convert project ID to project name and back (we follow what xfsprogs do in that regard), add detection whether project quota is enabled for the filesystem, and increase number of quota types. We also have to update various checks to count with project quotas. Signed-off-by: Li Xi <lixi@ddn.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Fix warnings due to missing stdlib.hJan Kara2-0/+2
When compiling without RPC, we do not get stdlib.h automatically included via other includes and thus miss some function definitions. Include stdlib.h explicitely. Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Support systems which do not have nl_langinfo()Theodore Ts'o2-0/+7
Add a configure check and skip use of nl_langinfo if it is not present. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Provide fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTOTheodore Ts'o1-0/+8
Not all C library's /usr/include/mntent.h are guaranteed to define MNTTYPE_NFS and MNTTYPE_AUTO. Since we already are defining a large number of MNTTYPE_* macros for our own use in mntopt.h, add fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO there. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Use NGROUPS_MAX instead of NGROUPSTheodore Ts'o2-4/+6
NGRROUPS_MAX is what is defined by SuSv3; NGROUPS is not guaranteed by any standard, but is just an ancient BSD'ism. Since Android's bionic libc has the former but not the latter, let's use NGROUPS_MAX instead. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Allow building on systems that do not have rpc header filesTheodore Ts'o3-14/+20
Android's bionic C library doesn't have Sun RPC support. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-03-30Update the gitignore file to ignore additional generated filesTheodore Ts'o1-0/+3
Ignore the files generated by libtool, gettext, and rpcgen Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2016-02-17Don't build rpc.rquotad when --disable-rpc was requested.Lars Wendler1-1/+4
This fixes a buch of undefined references: x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -D_GNU_SOURCE -Wa ll -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -pie -Wl,-O1 -Wl,--hash-st yle=gnu -Wl,--sort-common -Wl,--as-needed -o rpc.rquotad rquota_server.o rquota_ svc.o svc_socket.o libquota.a rquota_svc.o: In function `rquotaprog_2': rquota_svc.c:(.text+0x1d3): undefined reference to `xdr_setquota_rslt' rquota_svc.c:(.text+0x1da): undefined reference to `xdr_ext_setquota_args' rquota_svc.c:(.text+0x2b2): undefined reference to `xdr_setquota_rslt' rquota_svc.c:(.text+0x2b9): undefined reference to `xdr_ext_setquota_args' rquota_svc.c:(.text+0x2ff): undefined reference to `xdr_getquota_rslt' rquota_svc.c:(.text+0x306): undefined reference to `xdr_ext_getquota_args' rquota_svc.c:(.text+0x31a): undefined reference to `xdr_getquota_rslt' rquota_svc.c:(.text+0x321): undefined reference to `xdr_ext_getquota_args' rquota_svc.o: In function `rquotaprog_1': rquota_svc.c:(.text+0x3f3): undefined reference to `xdr_setquota_rslt' rquota_svc.c:(.text+0x3fa): undefined reference to `xdr_setquota_args' rquota_svc.c:(.text+0x4d2): undefined reference to `xdr_setquota_rslt' rquota_svc.c:(.text+0x4d9): undefined reference to `xdr_setquota_args' rquota_svc.c:(.text+0x51f): undefined reference to `xdr_getquota_rslt' rquota_svc.c:(.text+0x526): undefined reference to `xdr_getquota_args' rquota_svc.c:(.text+0x53a): undefined reference to `xdr_getquota_rslt' rquota_svc.c:(.text+0x541): undefined reference to `xdr_getquota_args' collect2: error: ld returned 1 exit status Makefile:901: recipe for target 'rpc.rquotad' failed Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-27Add support for scanning using Q_XGETNEXTQUOTAJan Kara2-3/+40
Add support for scanning of all available quota structures using Q_XGETNEXTQUOTA quotactl. Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-27Scan dquots using Q_GETNEXTQUOTAJan Kara4-1/+65
Check for new kernel quotactl Q_GETNEXTQUOTA and if available use it for scanning all dquot structures. Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-19Don't link all binaries with ldap libraryJan Kara1-14/+12
The default action-if-found of AC_CHECK_LIB() is to append checked library to LIBS. Thus check for ldap library resulted in unwanted addition of -lldap to LIBS as [] is an empty string in M4 and the default action is used. Fix the problem by providing proper action-if-found which was currently just hidden behind the check. Also do similar cleanup for AC_CHECK_HEADER check although there it didn't have any undesired side-effect. Reported-by: Petr Písař <petrp@users.sf.net> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-19repquota: -F option takes an argEric Sandeen1-1/+1
Commit a5876145 added a new -O option which takes an argument, but in the process lost the argument specifier for "F". As a result, the use of "-F" segfaults when NULL is sent to name2fmt() instead of the provided argument. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-05Set -fPIC and -pie as default params when buildingTomáš Chvátal2-1/+2
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Do not accidentaly override commandline passed CFLAGS.Tomáš Chvátal1-1/+1
Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Respect the docdir declaration and do not override.Tomáš Chvátal1-1/+0
Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Print explicitely disabled options properlyJan Kara1-1/+11
Currently we printed only an empty string when some build option was disabled explicitely via --disable-foo. Print 'no' in that case as well. Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Distribute ldap-scripts directory tooTomáš Chvátal1-1/+2
Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Fix build with disabled ldapJan Kara1-18/+18
Reported-by: Tomas Chvatal <tchvatal@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
2016-01-04Fix whitespace in configure.acTomáš Chvátal1-1/+1
Signed-off-by: Tomáš Chvátal <tchvatal@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-18Release quota-tools 4.03v4.03Jan Kara2-1/+29
Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-18Revive ChangelogJan Kara2-4/+958
I like the old format of Changelog more, also some of the history is covered only in the text file. Finally sometimes hand-editing Changelog may be useful. So revive Changelog in git. Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-18Update release script to work with new build systemJan Kara1-7/+7
Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-18Make new build system use original versioning schemeJan Kara1-3/+2
New build system changed versioning scheme to x.y.z but quota-tools have traditionally used x.y where 'y' has two digits. There is no strong reason to change the original scheme so return to it. Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-16Automatic update of translation filesJan Kara4-256/+294
Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-16warnquota: Added StartTLS supportIan Allison2-0/+41
An option called LDAP_TLS has been added to warnquota.conf which controls whether the LDAP connection uses StartTLS. The option supports the following values never - Don't ask for a certificate allow - Ask for certificate, proceed if valid try - Ask for certificate, proceed if valid or not given demand - Ask for certificate, proceed only if given and valid Signed-off-by: Ian Allison <iana@pims.math.ca> Signed-off-by: Jan Kara <jack@suse.cz>
2015-12-16quota_nld: multicast project quota warnings via dbusMasatake YAMATO2-1/+2
Quota subsystem in kernel introduced project quota. This patch improves the userspace side. This patch prevents quota_nld writing warnings to a console when receiving project quota warnings from kernel because there is no such concept, "console associated with a project id". Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2015-04-14Fix building of rquota.[ch] filesJan Kara1-0/+2
Make from clean sources failed because automake dependency tracking doesn't directly work with generated source files such as rquota.c or rquota.h. Fix the problem by telling automake to generate these files first using BUILT_SOURCES variable. Signed-off-by: Jan Kara <jack@suse.cz>
2015-03-08edquota: fix mtime checkKonstantin Khlebnikov1-2/+2
Otherwise tool never updates quota because old mtime always <= new. Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Jan Kara <jack@suse.cz>
2015-03-08Makefile.am: remove quotaoff symlink before installKonstantin Khlebnikov1-0/+2
Otherwise make install fails if it's already exists: make install-exec-hook make[3]: Entering directory `/root/quota' ln: failed to create symbolic link `/usr/local/sbin/quotaoff': File exists make[3]: *** [install-exec-hook] Error 1 Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Jan Kara <jack@suse.cz>
2015-03-04warnquota: Fix some leaks in LDAP lookup codeJan Kara1-2/+6
Some of LDAP functions return dynamically allocated memory that the caller is responsible to free. So do this to avoid memory leaks. Signed-off-by: Jan Kara <jack@suse.cz>
2015-03-04warnquota: Don't CC empty namesJan Kara1-0/+4
Sometimes admin may not want to be CCed on emails. Allow that by setting CC_TO to empty string (not setting CC_TO at all currently defaults to sending CC to root so we don't want to change that for compatibility reasons). Signed-off-by: Jan Kara <jack@suse.cz>
2015-02-10Fix typos in German translationMichael Meskes1-26/+26
Signed-off-by: Michael Meskes <michael@fam-meskes.de> Signed-off-by: Jan Kara <jack@suse.cz>
2015-01-05quota_nld: Fixup buildJan Kara1-1/+2
Signed-off-by: Jan Kara <jack@suse.cz>
2015-01-05edquota: Do not unnecessarily overwrite limits/timesJan Kara7-6/+54
When user doesn't edit the file with limits / grace times, there is no need to overwrite the values in quota files. Maybe admin really wanted to cancel the operation by not writing the file. Signed-off-by: Jan Kara <jack@suse.cz>
2015-01-05edquota: Fix error handlingJan Kara1-5/+9
Error handling didn't properly free quota structures allocated for a user when editing of limits failed for some reason. We also didn't bail out when editing of grace times failed. Fix the problems by jumping to a proper label. Signed-off-by: Jan Kara <jack@suse.cz>
2015-01-05edquota: Reopen the file with new grace timesJan Kara1-2/+11
Reopen the file with grace times - editor may have written the file into a new inode and thus we cannot read the contents through the old fd. Signed-off-by: Jan Kara <jack@suse.cz>
2015-01-05edquota: Unify code for editing grace times and quota limitsJan Kara1-34/+24
Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Fix the po generating by accidentaly ignoring POTFILES.in fileTomáš Chvátal6-4340/+4437
Refresh the po's again now. Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Install example file to docs.Tomáš Chvátal1-0/+1
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Ignore generated tarballs.Tomáš Chvátal1-0/+1
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02config.h.in is autogenerated.Tomáš Chvátal2-120/+2
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Use just one define to determine if using ext2directTomáš Chvátal2-10/+4
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Stop using deprecated ldap_perrorTomáš Chvátal1-6/+6
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Refresh and fix the po files.Tomáš Chvátal4-2588/+4878
Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-12-02Create new autotools buildsystemTomáš Chvátal24-1699/+675
Reflect what was done before and try to mimic it Remove ChangeLog, now autogenerated for dist target Remove confusing gettext README and try to add new approach for translations [JK: Fixed build without RPC support] Signed-off-by: Tomáš Chvátal <tchvatal@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
2014-11-26Add release scriptJan Kara3-4/+34
Signed-off-by: Jan Kara <jack@suse.cz>
2014-11-26Release quota-tools 4.02v4.02Jan Kara2-2/+43
Signed-off-by: Jan Kara <jack@suse.cz>
2014-11-26Remove KERN_KNOWN_QUOTA_VERSIONJan Kara1-2/+0
This define is unused and using it would be a bad idea (kernel quota version doesn't mean anything useful anymore). Remove it. Signed-off-by: Jan Kara <jack@suse.cz>
2014-11-26Skip NFS mounts without rquotad RPC service silentlyPetr Písař1-4/+34
If NFS server does uses quotas, then it's high chance the RCP rquotad service is not running at all. Then listing quotas for such NFS mount point results into a warning about "connection refused". This warning can be obtrusive if a host has mounted various mixture of NFS exports with and without quotas. This patch recognizes this special error state (after performing a query to a client without running rquotad) and considers such server as having quotas disabled. This silents the warning effectively. JK: Some coding style fixes, treat also rpc_set_quota() this way. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2014-10-01Fix handling of space and inode valuesJan Kara1-7/+9
Commit 0214512479e0 (Properly handle signed space and inode values) broke parsing of pure numbers in str2number() so that it would always complain about "Integer overflow while interpreting decimal unit". Fix condition checking for overflow. Also number2str() was buggy and wouldn't guess proper units for negative numbers. Signed-off-by: Jan Kara <jack@suse.cz>
2014-07-24Update polish translationJakub Bogusz1-1172/+1427
Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org> Signed-off-by: Jan Kara <jack@suse.cz>
2014-05-01warnquota: Use LDAP for looking up CC value as wellJan Kara1-89/+98
When LDAP is configured do not lookup only 'TO' field in LDAP but also a 'CC' field. Signed-off-by: Jan Kara <jack@suse.cz>
2014-05-01Prevent from grace period overflow in RPC transportPetr Písař4-8/+28
The RPC transports grace time as unsigned int, but the value stored there and retrivedd from is treated as singed difference against current time. This leads to overflow after expiring the grace time which is presented as an enourmously large grace time instead of "none" in the quota(1) output. There also possible an overflow when the time difference is still bigger than an int can represent. This first issue is solved by explicit type cast to/from int32_t, the second issue is fixes by limiting the value into int32_t range. <https://sourceforge.net/p/linuxquota/bugs/115/> Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2014-05-01Do not document location of quotaon and quotaoffPetr Písař1-4/+4
quotaon(8) manual page lists location of quotaon and quotaoff tools as /usr/sbin. However configure option --enable-rootsbin allows to relocte the executable into /sbin redendering the manual wrong. This patch removes the path from the manual page, so it's valid in both cases. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2014-05-01Properly handle signed space and inode valuesJan Kara2-17/+32
For cluster filesystems, kernel can sometimes return negative values of used space or inodes (because counters are not completely synchronized across the cluster). Make quota tools properly print these. Signed-off-by: Jan Kara <jack@suse.cz>
2014-04-27respect CFLAGS in linking command wrt #446281Julian Ospald1-4/+14
Signed-off-by: Julian Ospald <hasufell@gentoo.org> Signed-off-by: Jan Kara <jack@suse.cz>
2014-04-24Explain in quota(1) manpage what 'blocks' in the output meanJan Kara1-1/+2
Signed-off-by: Jan Kara <jack@suse.cz>
2013-12-02__cpu_to_le16 --> htole16Cristian Rodríguez1-4/+4
2013-12-02Use libc byteswapping routines not kernel onesCristian Rodríguez5-140/+140
macros/functions from endian.h are the proper, documented userspace interface to use.
2013-11-18quota_nld: Fix compilation warningJan Kara1-0/+1
Fix compilation warning about missing stat(3) prototype. Signed-off-by: Jan Kara <jack@suse.cz>
2013-11-18quota_nld: Fix usage of netlink multicast groupsJan Kara2-38/+45
quota_nld has used VFS_DQUOT netlink family id as an id of a multicast group to listen to. That is wrong - instead proper multicast group id should be looked up. To do that we need a support for this functionality in libnl so convert quota_nld to use libnl-3.0 and properly lookup multicast group id. Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-29Improve rpc.rquota(8) manual pagePetr Písař1-6/+23
This patch renames rquotad(8) to rpc.rquotad(8) to reflect the executable name. It also shows complete synopsis and documents --help option. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-29Add warnquota.conf(5) manual pagePetr Písař2-1/+188
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-29Add quotatab(5) manual pagePetr Písař2-1/+35
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-29Add quotagrpadmins(5) manual pagePetr Písař3-1/+34
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-29Silent a set-but-not-used warning about sbflagsPetr Písař2-7/+11
If XFS_ROOTHACK is not defined, sbflags gets set but never used. This patch declares the variable only if needed. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-10-03Add support for CVS and XML output formats to repquota(8)Jan Kara4-18/+151
JK: Fixup localization and handling of multiple output filesystems / types. Signed-off-by: Jonathan Overholt <jonathan@overholt.org> Signed-off-by: Jan Kara <jack@suse.cz>
2013-08-14Remove installation of manpages into section 2Carsten Grohmann1-2/+0
There are no manpages in this section in quota tools anymore. So just remove the installation commands. Signed-off-by: Carsten Grohmann <cgrohmann@users.sf.net> Signed-off-by: Jan Kara <jack@suse.cz>
2013-06-21Close FILE handles on errorPetr Písař1-0/+11
Functions for reading quota specification in quotaops.c create new temporary FILE stream handle, they close it on successful return, but they forget to close it on unsuccessful return. That leads to memory leaks. This patch ensures that the handle gets closed in all cases. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-03-26Add AC_PREREQ to configure.inTheodore Ts'o1-0/+1
Debian will automatically switch between autoconf version 2.13 and modern autoconf based on the version number in the AC_PREREQ statement. Without the AC_PREREQ, debian's autoconf driver script will try to use autoconf 2.13, and the configure.in file uses autoconf macros which were introduced in the autoconf 2.50. So add an AC_PREREQ statement to make the right thing happen automatically. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Jan Kara <jack@suse.cz>
2013-03-13Fix various usage mistakesPetr Písař3-5/+6
quota: Fix long variant for -A option in usage repquota: Fix long variant for -c option in usage and manual repquota: Fix long variant for -C option in usage and manual repquota: Add -a, --all options to usage Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-03-13Correct quotasync exit codePetr Písař1-10/+13
This fixes `quotasync -h' exit code as well as it uses more portable EXIT_SUCCESS/EXIT_FAILURE values. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-03-13Complete quotasync usagePetr Písař1-2/+17
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-03-13Add quotasync(1) manual pagePetr Písař1-0/+72
Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-02-04quotacheck: Make sure -d provides at least as much information as -vJan Kara1-5/+5
There was a couple of useful messages that were printed when -v was specified but not when -d was specified. Fix this. Signed-off-by: Jan Kara <jack@suse.cz>
2013-02-04Do not fiddle with quota files on XFS and GFSPetr Písař1-0/+7
XFS and GFS have no quota files. Skip unnecessary examination and rename of these files when running quotacheck. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-01-21Recognize units at inode limits by edquotaPetr Písař3-6/+26
With this patch, it's possible to specify inode values including decimal units in the editor run by edquota. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-01-21Recognize units at inode limits by setquotaPetr Písař4-4/+76
This patch allows to specify suffixes at inode limits on setquota command line and standard input. Decimal Units k, m, g, t are implemented. Numeric value without suffix is equivatent to single inodes as before. This is complementary functionality to `quota -s'. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-01-21Recognize units at block limits by edquotaPetr Písař2-3/+29
With this patch, it's possible to specify block values including binary units in the editor run by edquota. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
2013-01-21Recognize block limit units on setquota standard inputPetr Písař1-4/+22
This patch adds support for binary suffixes on `setquota -b' input. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>