Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/quota.git#46caab50684a295721df911b22f3e67e2447cc95
This commit is contained in:
DistroBaker 2020-11-10 12:13:33 +00:00
parent 9e23c72ddf
commit ecf3529a0c
29 changed files with 51 additions and 1940 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ quota-3.17.tar.gz
/ldap-scripts.tar.gz
/quota-4.04.tar.gz
/quota-4.05.tar.gz
/quota-4.06.tar.gz

View File

@ -1,106 +0,0 @@
From b6bb53e1124e6b813fe4de5682b9d9a9f8a1fba8 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 2 Apr 2019 16:54:49 +0200
Subject: [PATCH] COPYING: Update mailing address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
COPYING | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/COPYING b/COPYING
index 784e9cf..bb6a5e0 100644
--- a/COPYING
+++ b/COPYING
@@ -1,16 +1,16 @@
This package, the quota tools, are made available under the GNU Public License
version 2.
-----------------------------------------------------------------------
+-----------------------------------------------------------------------
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -19,7 +19,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -59,8 +59,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
-
- GNU GENERAL PUBLIC LICENSE
+
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -114,7 +114,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
-
+
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -172,7 +172,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
-
+
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -229,7 +229,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
-
+
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -259,7 +259,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -281,4 +281,4 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
--
2.20.1

View File

@ -1,49 +0,0 @@
From 110b4a4011655fb650f82c88312ba44d7e249060 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 21 Feb 2020 10:00:05 +0100
Subject: [PATCH] Fix ignoring disabled quotas
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
quotaops.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/quotaops.c b/quotaops.c
index 1a8d7fe..ff4d16e 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -127,11 +127,13 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
char *estr;
/* If rpc.rquotad is not running, filesystem might be just without quotas... */
- if (ignore_noquota && errno == ECONNREFUSED)
+ if (ignore_noquota && (errno == ENOENT || errno == ECONNREFUSED))
continue;
if (errno == ECONNREFUSED) {
estr = _("Cannot connect to RPC quota service");
+ } else if (errno == ENOENT) {
+ estr = _("Quota not enabled");
} else {
estr = strerror(errno);
}
--
2.21.1

View File

@ -1,42 +0,0 @@
From 13bb8c2daca0f1c1099ce6ba9dcb23319f7955d0 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 20 May 2020 16:22:52 +0200
Subject: [PATCH 2/2] Fix limits setting on XFS filesystem
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index a4d6f67..3333bb1 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -165,7 +165,9 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
if (flags & COMMIT_USAGE) /* block usage */
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
} else {
- xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ if (flags & COMMIT_LIMITS) /* warn/limit */
+ xdqblk.d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD |
+ FS_DQ_ISOFT | FS_DQ_IHARD;
if (flags & COMMIT_TIMES) /* indiv grace period */
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
}
--
2.25.4

View File

@ -1,104 +0,0 @@
From e777f46f3044ade15908dbb4c925dbb66556a595 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 21 Sep 2020 13:30:32 +0200
Subject: [PATCH 2/2] Handle grace time overflows for XFS quotas
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add checks and error handling to report when grace times set for XFS
quotas would overflow.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 26 +++++++++++++++++---------
quotaio_xfs.h | 3 +++
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 9854ec2..2db1c0c 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -65,6 +65,11 @@ static inline int want_bigtime(time_t timer)
return timer > INT32_MAX || timer < INT32_MIN;
}
+static inline int timer_fits_xfs_dqblk(time_t timer)
+{
+ return timer >= FS_DQUOT_TIMER_MIN && timer <= FS_DQUOT_TIMER_MAX;
+}
+
/*
* Convert XFS kernel quota format to utility format
*/
@@ -83,7 +88,7 @@ static inline void xfs_kern2utildqblk(struct util_dqblk *u, struct xfs_kern_dqbl
/*
* Convert utility quota format to XFS kernel format
*/
-static inline void xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqblk *u)
+static inline int xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqblk *u)
{
memset(k, 0, sizeof(struct xfs_kern_dqblk));
k->d_ino_hardlimit = u->dqb_ihardlimit;
@@ -92,10 +97,16 @@ static inline void xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqbl
k->d_blk_softlimit = u->dqb_bsoftlimit << 1;
k->d_icount = u->dqb_curinodes;
k->d_bcount = u->dqb_curspace >> 9;
+ if (!timer_fits_xfs_dqblk(u->dqb_itime) ||
+ !timer_fits_xfs_dqblk(u->dqb_btime)) {
+ errno = ERANGE;
+ return -1;
+ }
if (want_bigtime(u->dqb_itime) || want_bigtime(u->dqb_btime))
k->d_fieldmask |= FS_DQ_BIGTIME;
xfs_util2kerndqblk_ts(k, &k->d_itimer, &k->d_itimer_hi, u->dqb_itime);
xfs_util2kerndqblk_ts(k, &k->d_btimer, &k->d_btimer_hi, u->dqb_btime);
+ return 0;
}
/*
@@ -176,7 +187,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h) && !XFS_PRJQUOTA(h))
return 0;
- xfs_util2kerndqblk(&xdqblk, &dquot->dq_dqb);
+ if (xfs_util2kerndqblk(&xdqblk, &dquot->dq_dqb) < 0)
+ return -1;
if (XFS_USRQUOTA(h))
xdqblk.d_flags |= XFS_USER_QUOTA;
else if (XFS_GRPQUOTA(h))
@@ -198,13 +210,9 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
}
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
- if (quotactl(qcmd, h->qh_quotadev, id, (void *)&xdqblk) < 0) {
- ;
- }
- else {
- return 0;
- }
- return -1;
+ if (quotactl(qcmd, h->qh_quotadev, id, (void *)&xdqblk) < 0)
+ return -1;
+ return 0;
}
/*
diff --git a/quotaio_xfs.h b/quotaio_xfs.h
index e0c2a62..28dc27e 100644
--- a/quotaio_xfs.h
+++ b/quotaio_xfs.h
@@ -85,6 +85,9 @@ typedef struct fs_disk_quota {
char d_padding4[8]; /* yet more padding */
} fs_disk_quota_t;
+#define FS_DQUOT_TIMER_MAX (((__s64)1 << 39) - 1)
+#define FS_DQUOT_TIMER_MIN (-((__s64)1 << 39))
+
/*
* These fields are sent to Q_XSETQLIM to specify fields that need to change.
*/
--
2.25.4

View File

@ -1,74 +0,0 @@
From bbcf9eedb2299ab55a0ae208e196eb2ca59ad97e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 30 May 2019 13:20:25 +0200
Subject: [PATCH] Make a directory for quota_nld PID file configurable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
configure.ac | 10 ++++++++++
quota_nld.c | 4 ++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index b783568..3cb57c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,6 +277,15 @@ AS_IF([test "$with_proc_mounts" != "no"], [
AC_DEFINE_UNQUOTED([ALT_MTAB], ["$with_proc_mounts"], [File with mounted filesystems])
])
+AC_ARG_WITH([pid-dir],
+ [AS_HELP_STRING([--with-pid-dir=DIRECTORY], [Create PID files in this directory instead of /var/run])],
+ [with_pid_dir="$withval"]
+)
+AS_IF([test "X$with_pid_dir" == "X" -o "$with_pid_dir" == "yes" -o "$with_pid_dir" == "no"],[
+ with_pid_dir="/var/run"
+])
+AC_DEFINE_UNQUOTED([PID_DIR], ["$with_pid_dir"], [Directory for PID files])
+
AC_DEFINE_UNQUOTED([COMPILE_OPTS], ["$COMPILE_OPTS"], [Configuration options])
AC_CONFIG_FILES([
@@ -297,6 +306,7 @@ Build configuration:
libwrap: ${build_libwrap}
netlink: ${build_netlink}
nls: ${enable_nls}
+ pid-dir: ${with_pid_dir}
proc-mounts: ${with_proc_mounts}
rpc: ${build_rpc}
rpcsetquota: ${enable_rpcsetquota}
diff --git a/quota_nld.c b/quota_nld.c
index ac24bdb..72d99a9 100644
--- a/quota_nld.c
+++ b/quota_nld.c
@@ -403,12 +403,12 @@ static char *build_pid_file_name(void)
errstr(_("Undefined program name.\n"));
return NULL;
}
- pid_name = malloc(9 + strlen(progname) + 4 + 1);
+ pid_name = malloc(strlen(PID_DIR) + 1 + strlen(progname) + 4 + 1);
if (!pid_name) {
errstr(_("Not enough memory to build PID file name.\n"));
return NULL;
}
- sprintf(pid_name, "/var/run/%s.pid", progname);
+ sprintf(pid_name, "%s/%s.pid", PID_DIR, progname);
return pid_name;
}
--
2.20.1

View File

@ -1,112 +0,0 @@
From a4b0af23e1e3761825e9d4ac075e3fcae8ab91cb Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 24 May 2019 12:03:27 +0200
Subject: [PATCH 1/4] Make messages about failures for NFS consistent with
local filesystems
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
edquota.c | 4 ++--
quota.c | 2 +-
quotaops.c | 2 +-
setquota.c | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/edquota.c b/edquota.c
index 912f833..a77106c 100644
--- a/edquota.c
+++ b/edquota.c
@@ -176,7 +176,7 @@ static void copy_prototype(int argc, char **argv, struct quota_handle **handles)
protoprivs = getprivs(protoid, handles, 0);
while (argc-- > 0) {
id = name2id(*argv, quotatype, !!(flags & FL_NUMNAMES), NULL);
- curprivs = getprivs(id, handles, 0);
+ curprivs = getprivs(id, handles, !dirname);
if (!curprivs)
die(1, _("Cannot get quota information for user %s\n"), *argv);
argv++;
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
else {
for (; argc > 0; argc--, argv++) {
id = name2id(*argv, quotatype, !!(flags & FL_NUMNAMES), NULL);
- curprivs = getprivs(id, handles, 0);
+ curprivs = getprivs(id, handles, !dirname);
if (!curprivs)
die(1, _("Cannot get quota information for user %s.\n"), *argv);
if (flags & FL_EDIT_TIMES) {
diff --git a/quota.c b/quota.c
index 8235013..be494e3 100644
--- a/quota.c
+++ b/quota.c
@@ -168,7 +168,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0)
| ((flags & FL_LOCALONLY) ? MS_LOCALONLY : 0)
| ((flags & FL_NFSALL) ? MS_NFS_ALL : 0));
- qlist = getprivs(id, handles, !!(flags & FL_QUIETREFUSE));
+ qlist = getprivs(id, handles, !mntcnt || (flags & FL_QUIETREFUSE));
if (!qlist) {
over = 1;
goto out_handles;
diff --git a/quotaops.c b/quotaops.c
index 976e6b3..ad29fd9 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -125,7 +125,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) {
/* If rpc.rquotad is not running filesystem might be just without quotas... */
- if (errno != ENOENT && (errno != ECONNREFUSED || !quiet)) {
+ if (!quiet || (errno != ENOENT && errno != ECONNREFUSED)) {
int olderrno = errno;
id2name(id, handles[i]->qh_type, name);
diff --git a/setquota.c b/setquota.c
index bfd6682..08fdbfc 100644
--- a/setquota.c
+++ b/setquota.c
@@ -314,7 +314,7 @@ static int setlimits(struct quota_handle **handles)
struct dquot *q, *protoq, *protoprivs = NULL, *curprivs;
int ret = 0;
- curprivs = getprivs(id, handles, 0);
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
if (flags & FL_PROTO) {
protoprivs = getprivs(protoid, handles, 0);
for (q = curprivs, protoq = protoprivs; q && protoq; q = q->dq_next, protoq = protoq->dq_next) {
@@ -435,7 +435,7 @@ static int batch_setlimits(struct quota_handle **handles)
int ret = 0;
while (!read_entry(&id, &isoftlimit, &ihardlimit, &bsoftlimit, &bhardlimit)) {
- curprivs = getprivs(id, handles, 0);
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
for (q = curprivs; q; q = q->dq_next) {
q->dq_dqb.dqb_bsoftlimit = bsoftlimit;
q->dq_dqb.dqb_bhardlimit = bhardlimit;
@@ -474,7 +474,7 @@ static int setindivgraces(struct quota_handle **handles)
int ret = 0;
struct dquot *q, *curprivs;
- curprivs = getprivs(id, handles, 0);
+ curprivs = getprivs(id, handles, !!(flags & FL_ALL));
for (q = curprivs; q; q = q->dq_next) {
if (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit)
q->dq_dqb.dqb_btime = toset.dqb_btime;
--
2.20.1

View File

@ -1,73 +0,0 @@
From 00d61f21bfa3ccf40826ce22de12cfeeab8a40a5 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Mon, 1 Apr 2019 02:23:59 +0300
Subject: [PATCH] Revert "configure.ac: fix pkg_check_modules calls"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
configure.ac | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index e8e6412..ff7b9df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,13 +104,13 @@ AC_ARG_ENABLE([ext2direct],
)
AS_IF([test "x$enable_ext2direct" != "xno"], [
build_ext2direct="yes"
- PKG_CHECK_MODULES([COM_ERR],[com_err], [CFLAGS="$CFLAGS $COM_ERR_CFLAGS" LIBS="$LIBS $COMM_ERR_LIBS"], [
+ PKG_CHECK_MODULES([COM_ERR],[com_err], [], [
build_ext2direct="no"
AS_IF([test "x$enable_ext2direct" = "xyes"], [
AC_MSG_ERROR([Ext2direct requested but required com_err library not found])
])
])
- PKG_CHECK_MODULES([EXT2FS],[ext2fs], [CFLAGS="$CFLAGS $EXT2FS_CFLAGS" LIBS="$LIBS $EXT2FS_LIBS"], [
+ PKG_CHECK_MODULES([EXT2FS],[ext2fs], [], [
build_ext2direct="no"
AS_IF([test "x$enable_ext2direct" = "xyes"], [
AC_MSG_ERROR([Ext2direct requested but required ext2fs library not found])
@@ -138,13 +138,13 @@ AC_ARG_ENABLE([netlink],
)
AS_IF([test "x$enable_netlink" != "xno"], [
build_netlink="yes"
- PKG_CHECK_MODULES([DBUS], [dbus-1], [CFLAGS="$CFLAGS $DBUS_CFLAGS" LIBS="$LIBS $DBUS_LIBS"], [
+ PKG_CHECK_MODULES([DBUS], [dbus-1], [], [
build_netlink="no"
AS_IF([test "x$enable_netlink" = "xyes"] , [
AC_MSG_ERROR([Required dbus libraries for quota netlink daemon not found.])
])
])
- PKG_CHECK_MODULES([LIBNL3], [libnl-3.0 >= 3.1 libnl-genl-3.0], [CFLAGS="$CFLAGS $LIBNL3_CFLAGS" LIBS="$LIBS $LIBNL3_LIBS"], [
+ PKG_CHECK_MODULES([LIBNL3], [libnl-3.0 >= 3.1 libnl-genl-3.0], [], [
build_netlink="no"
AS_IF([test "x$enable_netlink" = "xyes"] , [
AC_MSG_ERROR([Required libnl3 libraries for quota netlink daemon not found.])
@@ -207,7 +207,7 @@ AS_IF([test x"$enable_rpc" != "xno"], [
build_rpc="no"
])
- PKG_CHECK_MODULES([TIRPC], [libtirpc], [CFLAGS="$CFLAGS $TIRPC_CFLAGS" LIBS="$LIBS $TIRPC_LIBS"], [
+ PKG_CHECK_MODULES([TIRPC], [libtirpc], [], [
AS_IF([test x"$enable_rpc" = "xyes"], [
AC_MSG_ERROR([could not locate required libtirpc])
], [
--
2.20.1

View File

@ -1,109 +0,0 @@
From 16b60cb9e315ed0e859dba6bea0f206d674d519f Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Sat, 5 Sep 2020 09:50:26 -0700
Subject: [PATCH 1/2] Support grace period expirations past y2038 for XFS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 33 +++++++++++++++++++++++++++++----
quotaio_xfs.h | 11 ++++++++++-
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 3333bb1..9854ec2 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -42,6 +42,29 @@ scan_dquots: xfs_scan_dquots,
report: xfs_report
};
+static inline time_t xfs_kern2utildqblk_ts(const struct xfs_kern_dqblk *k,
+ __s32 timer, __s8 timer_hi)
+{
+ if (k->d_fieldmask & FS_DQ_BIGTIME)
+ return (__u32)timer | (__s64)timer_hi << 32;
+ return timer;
+}
+
+static inline void xfs_util2kerndqblk_ts(const struct xfs_kern_dqblk *k,
+ __s32 *timer_lo, __s8 *timer_hi, time_t timer)
+{
+ *timer_lo = timer;
+ if (k->d_fieldmask & FS_DQ_BIGTIME)
+ *timer_hi = timer >> 32;
+ else
+ *timer_hi = 0;
+}
+
+static inline int want_bigtime(time_t timer)
+{
+ return timer > INT32_MAX || timer < INT32_MIN;
+}
+
/*
* Convert XFS kernel quota format to utility format
*/
@@ -53,8 +76,8 @@ static inline void xfs_kern2utildqblk(struct util_dqblk *u, struct xfs_kern_dqbl
u->dqb_bsoftlimit = k->d_blk_softlimit >> 1;
u->dqb_curinodes = k->d_icount;
u->dqb_curspace = ((qsize_t)k->d_bcount) << 9;
- u->dqb_itime = k->d_itimer;
- u->dqb_btime = k->d_btimer;
+ u->dqb_itime = xfs_kern2utildqblk_ts(k, k->d_itimer, k->d_itimer_hi);
+ u->dqb_btime = xfs_kern2utildqblk_ts(k, k->d_btimer, k->d_btimer_hi);
}
/*
@@ -69,8 +92,10 @@ static inline void xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqbl
k->d_blk_softlimit = u->dqb_bsoftlimit << 1;
k->d_icount = u->dqb_curinodes;
k->d_bcount = u->dqb_curspace >> 9;
- k->d_itimer = u->dqb_itime;
- k->d_btimer = u->dqb_btime;
+ if (want_bigtime(u->dqb_itime) || want_bigtime(u->dqb_btime))
+ k->d_fieldmask |= FS_DQ_BIGTIME;
+ xfs_util2kerndqblk_ts(k, &k->d_itimer, &k->d_itimer_hi, u->dqb_itime);
+ xfs_util2kerndqblk_ts(k, &k->d_btimer, &k->d_btimer_hi, u->dqb_btime);
}
/*
diff --git a/quotaio_xfs.h b/quotaio_xfs.h
index be7f86f..e0c2a62 100644
--- a/quotaio_xfs.h
+++ b/quotaio_xfs.h
@@ -72,7 +72,10 @@ typedef struct fs_disk_quota {
__s32 d_btimer; /* similar to above; for disk blocks */
__u16 d_iwarns; /* # warnings issued wrt num inodes */
__u16 d_bwarns; /* # warnings issued wrt disk blocks */
- __s32 d_padding2; /* padding2 - for future use */
+ __s8 d_itimer_hi; /* upper 8 bits of timer values */
+ __s8 d_btimer_hi;
+ __s8 d_rtbtimer_hi;
+ __s8 d_padding2; /* padding2 - for future use */
__u64 d_rtb_hardlimit; /* absolute limit on realtime blks */
__u64 d_rtb_softlimit; /* preferred limit on RT disk blks */
__u64 d_rtbcount; /* # realtime blocks owned */
@@ -114,6 +117,12 @@ typedef struct fs_disk_quota {
#define FS_DQ_RTBCOUNT (1<<14)
#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
+/*
+ * Quota expiration timestamps are 40-bit signed integers, with the upper 8
+ * bits encoded in the _hi fields.
+ */
+#define FS_DQ_BIGTIME (1<<15)
+
/*
* Various flags related to quotactl(2). Only relevant to XFS filesystems.
*/
--
2.25.4

View File

@ -1,115 +0,0 @@
From 4aac5400dfd61416ffe7ff912f32061854e57e45 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 21 Sep 2020 13:28:45 +0200
Subject: [PATCH] quota: Add --filesystem option
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quota.1 | 9 +++++++++
quota.c | 23 +++++++++++++++++++----
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/quota.1 b/quota.1
index 8166853..f2195a1 100644
--- a/quota.1
+++ b/quota.1
@@ -142,6 +142,15 @@ device.
.B -f, --filesystem-list
report quotas only for filesystems specified on command line.
.TP
+.B --filesystem=\f2path\f1
+report quotas only for filesystem
+.BR path .
+This option can be specified multiple types and quota will be reported for each
+specified filesystem. Unlike command line option
+.B -f
+remaining command like arguments are still treated as user / group / project names
+to report.
+.TP
.B -m, --no-mixed-pathnames
Currently, pathnames of NFSv4 mountpoints are sent without leading slash in the path.
.BR rpc.rquotad
diff --git a/quota.c b/quota.c
index b453ee3..a6ed61f 100644
--- a/quota.c
+++ b/quota.c
@@ -82,6 +82,9 @@ static void usage(void)
-F, --format=formatname display quota of a specific format\n\
-f, --filesystem-list display quota information only for given\n\
filesystems\n\
+ --filesystem=path display quota information only for given\n\
+ filesystem, remaining command line arguments\n\
+ are still treated as user/group/project names\n\
-A, --all-nfs display quota for all NFS mountpoints\n\
-m, --no-mixed-pathnames trim leading slashes from NFSv4 mountpoints\n\
--show-mntpoint show mount point of the file system in output\n\
@@ -287,6 +290,8 @@ int main(int argc, char **argv)
{
int ngroups;
gid_t gidset[NGROUPS_MAX], *gidsetp;
+ char **fsnames = NULL;
+ int fscount = 0;
int i, ret, type = 0;
struct option long_opts[] = {
{ "help", 0, NULL, 'h' },
@@ -309,6 +314,7 @@ int main(int argc, char **argv)
{ "no-mixed-pathnames", 0, NULL, 'm' },
{ "show-mntpoint", 0, NULL, 257 },
{ "hide-device", 0, NULL, 258 },
+ { "filesystem", 1, NULL, 259 },
{ NULL, 0, NULL, 0 }
};
@@ -377,6 +383,13 @@ int main(int argc, char **argv)
case 258:
flags &= ~FL_SHOW_DEVICE;
break;
+ case 259:
+ fscount++;
+ fsnames = reallocarray(fsnames, fscount, sizeof(char *));
+ if (!fsnames)
+ die(1, _("Not enough memory for filesystem names"));
+ fsnames[fscount - 1] = optarg;
+ break;
case 'V':
version();
exit(0);
@@ -390,8 +403,10 @@ int main(int argc, char **argv)
if (!(flags & FL_USER) && !(flags & FL_GROUP) && !(flags & FL_PROJECT))
flags |= FL_USER;
- if (flags & FL_FSLIST && flags & (FL_LOCALONLY | FL_NOAUTOFS))
+ if (((flags & FL_FSLIST) || fscount) && flags & (FL_LOCALONLY | FL_NOAUTOFS))
errstr(_("Warning: Ignoring -%c when filesystem list specified.\n"), flags & FL_LOCALONLY ? 'l' : 'i');
+ if (fscount && flags & FL_FSLIST)
+ die(1, "Cannot use both --filesystem and -f");
init_kernel_interface();
@@ -432,12 +447,12 @@ int main(int argc, char **argv)
if (flags & FL_USER)
for (; argc > 0; argc--, argv++)
- ret |= showquotas(USRQUOTA, user2uid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL);
+ ret |= showquotas(USRQUOTA, user2uid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames);
else if (flags & FL_GROUP)
for (; argc > 0; argc--, argv++)
- ret |= showquotas(GRPQUOTA, group2gid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL);
+ ret |= showquotas(GRPQUOTA, group2gid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames);
else if (flags & FL_PROJECT)
for (; argc > 0; argc--, argv++)
- ret |= showquotas(PRJQUOTA, project2pid(*argv, !!(flags & FL_NUMNAMES), NULL), 0, NULL);
+ ret |= showquotas(PRJQUOTA, project2pid(*argv, !!(flags & FL_NUMNAMES), NULL), fscount, fsnames);
return ret;
}
--
2.25.4

View File

@ -1,34 +0,0 @@
From 75930ad1b962ceae08e8c2415b42794cd95ff874 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 21 Sep 2020 13:26:29 +0200
Subject: [PATCH] quota: Add synopsis for project quota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quota.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/quota.c b/quota.c
index be494e3..b453ee3 100644
--- a/quota.c
+++ b/quota.c
@@ -54,10 +54,11 @@ char *progname;
static void usage(void)
{
- errstr( "%s%s%s%s%s",
+ errstr( "%s%s%s%s%s%s",
_("Usage: quota [-guPqvswim] [-l | [-Q | -A]] [-F quotaformat]\n"),
_("\tquota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ...\n"),
_("\tquota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ...\n"),
+ _("\tquota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -P projectname ...\n"),
_("\tquota [-qvswugPQm] [-F quotaformat] -f filesystem ...\n"),
_("\n\
-u, --user display quota for user\n\
--
2.25.4

View File

@ -1,39 +0,0 @@
From be96da2353669d433b0abddb85b26ccaf35e3451 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Thu, 14 May 2020 12:17:29 +0200
Subject: [PATCH 1/2] quota-tools: Set FS_DQ_TIMER_MASK for individual xfs
grace times
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index b22c7b4..a4d6f67 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -166,6 +166,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
} else {
xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ if (flags & COMMIT_TIMES) /* indiv grace period */
+ xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
}
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
--
2.25.4

View File

@ -1,56 +0,0 @@
From fdd774bf08e56872ae4c0420e0f01efa25e715d6 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Fri, 8 May 2020 14:36:46 -0500
Subject: [PATCH] quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 2 +-
quotaon_xfs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 56daf89..b22c7b4 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h)
struct xfs_mem_dqinfo info;
int qcmd;
- qcmd = QCMD(Q_XFS_GETQSTAT, 0);
+ qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
return -1;
diff --git a/quotaon_xfs.c b/quotaon_xfs.c
index d557a75..d137240 100644
--- a/quotaon_xfs.c
+++ b/quotaon_xfs.c
@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
if (flags & STATEFLAG_ALL)
return 0; /* noop */
- if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) {
+ if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
return -1;
}
--
2.25.4

View File

@ -1,42 +0,0 @@
From 61e57e73a6c63ad50825182ca80bc2a5fcb3e1e2 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 30 Jul 2019 17:25:46 +0200
Subject: [PATCH] quotacheck: Skip checking of filesystems with hidded quota
files early
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotacheck.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/quotacheck.c b/quotacheck.c
index 2cdf475..1311c10 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -1181,11 +1181,11 @@ static int check_all(void)
continue;
}
cfmt = fmt;
- if (uwant && me_hasquota(mnt, USRQUOTA))
+ if (uwant && me_hasquota(mnt, USRQUOTA) && mnt->me_qfmt[USRQUOTA] != QF_META)
ucheck = 1;
else
ucheck = 0;
- if (gwant && me_hasquota(mnt, GRPQUOTA))
+ if (gwant && me_hasquota(mnt, GRPQUOTA) && mnt->me_qfmt[GRPQUOTA] != QF_META)
gcheck = 1;
else
gcheck = 0;
--
2.21.0

View File

@ -1,205 +0,0 @@
From 7b89abbc983d6cf7f1baf52a9ad90211eee02103 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 19 Oct 2020 17:44:46 +0200
Subject: [PATCH] quotacheck,quotaon: Suggest using quota feature for ext4
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotacheck.c | 59 +++++++++++++++++++++++++++++++---------------------
quotaon.c | 11 ++++++++++
quotasys.c | 27 ++++++++++++++++++++++++
quotasys.h | 3 +++
4 files changed, 76 insertions(+), 24 deletions(-)
diff --git a/quotacheck.c b/quotacheck.c
index 1311c10..5810ced 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -1130,8 +1130,8 @@ static int compatible_fs_qfmt(char *fstype, int fmt)
return !!strcmp(fstype, MNTTYPE_GFS2);
}
-/* Parse kernel version and warn if not using journaled quotas */
-static void warn_if_jquota_supported(void)
+/* Parse kernel version and return 1 if journaled quota is supported */
+static int kernel_supports_jquota(void)
{
struct utsname stats;
int v;
@@ -1139,28 +1139,25 @@ static void warn_if_jquota_supported(void)
if (uname(&stats) < 0) {
errstr(_("Cannot get system info: %s\n"), strerror(errno));
- return;
+ return 0;
}
if (strcmp(stats.sysname, "Linux"))
- return;
+ return 0;
v = strtol(stats.release, &errch, 10);
if (v < 2)
- return;
+ return 0;
if (v >= 3)
- goto warn;
+ return 1;
if (*errch != '.')
- return;
+ return 0;
v = strtol(errch + 1, &errch, 10);
if (*errch != '.' || v < 6)
- return;
+ return 0;
v = strtol(errch + 1, &errch, 10);
if (v < 11)
- return;
-warn:
- errstr(_("Your kernel probably supports journaled quota but you are "
- "not using it. Consider switching to journaled quota to avoid"
- " running quotacheck after an unclean shutdown.\n"));
+ return 0;
+ return 1;
}
/* Return 0 in case of success, non-zero otherwise. */
@@ -1202,17 +1199,31 @@ static int check_all(void)
debug(FL_DEBUG, _("Detected quota format %s\n"), fmt2name(cfmt));
}
- if (flags & (FL_VERBOSE | FL_DEBUG) &&
- !str_hasmntopt(mnt->me_opts, MNTOPT_USRJQUOTA) &&
- !str_hasmntopt(mnt->me_opts, MNTOPT_GRPJQUOTA) &&
- !warned &&
- (!strcmp(mnt->me_type, MNTTYPE_EXT3) ||
- !strcmp(mnt->me_type, MNTTYPE_EXT4) ||
- !strcmp(mnt->me_type, MNTTYPE_NEXT3) ||
- !strcmp(mnt->me_type, MNTTYPE_EXT4DEV) ||
- !strcmp(mnt->me_type, MNTTYPE_REISER))) {
- warned = 1;
- warn_if_jquota_supported();
+ if (flags & (FL_VERBOSE | FL_DEBUG) && !warned) {
+ if (!strcmp(mnt->me_type, MNTTYPE_EXT4) &&
+ ext4_supports_quota_feature()) {
+ warned = 1;
+ errstr(_("Your kernel probably supports ext4 "
+ "quota feature but you are using "
+ "external quota files. Please switch "
+ "your filesystem to use ext4 quota "
+ "feature as external quota files on "
+ "ext4 are deprecated.\n"));
+ } else if (!str_hasmntopt(mnt->me_opts, MNTOPT_USRJQUOTA) &&
+ !str_hasmntopt(mnt->me_opts, MNTOPT_GRPJQUOTA) &&
+ (!strcmp(mnt->me_type, MNTTYPE_EXT3) ||
+ !strcmp(mnt->me_type, MNTTYPE_EXT4) ||
+ !strcmp(mnt->me_type, MNTTYPE_NEXT3) ||
+ !strcmp(mnt->me_type, MNTTYPE_EXT4DEV) ||
+ !strcmp(mnt->me_type, MNTTYPE_REISER)) &&
+ kernel_supports_jquota()) {
+ warned = 1;
+ errstr(_("Your kernel probably supports "
+ "journaled quota but you are not "
+ "using it. Consider switching to "
+ "journaled quota to avoid running "
+ "quotacheck after an unclean shutdown.\n"));
+ }
}
checked++;
diff --git a/quotaon.c b/quotaon.c
index 508e57e..aceb6ec 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -243,6 +243,7 @@ static int v2_newstate(struct mount_entry *mnt, int type, char *file, int flags,
*/
static int newstate(struct mount_entry *mnt, int type, char *extra)
{
+ static int warned;
int sflags, ret = 0;
sflags = flags & FL_OFF ? STATEFLAG_OFF : STATEFLAG_ON;
@@ -269,6 +270,16 @@ static int newstate(struct mount_entry *mnt, int type, char *extra)
if (!me_hasquota(mnt, type))
return 0;
+ if (flags & FL_VERBOSE && !warned &&
+ !strcmp(mnt->me_type, MNTTYPE_EXT4) &&
+ ext4_supports_quota_feature()) {
+ warned = 1;
+ errstr(_("Your kernel probably supports ext4 quota "
+ "feature but you are using external quota "
+ "files. Please switch your filesystem to use "
+ "ext4 quota feature as external quota files "
+ "on ext4 are deprecated.\n"));
+ }
if (fmt == -1) {
if (get_qf_name(mnt, type, QF_VFSV0,
NF_FORMAT, &extra) >= 0)
diff --git a/quotasys.c b/quotasys.c
index d8c0e48..885fb1f 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -24,6 +24,7 @@
#include <sys/stat.h>
#include <sys/vfs.h>
#include <stdint.h>
+#include <sys/utsname.h>
#include "pot.h"
#include "bylabel.h"
@@ -1597,3 +1598,29 @@ void end_mounts_scan(void)
check_dirs = NULL;
check_dirs_cnt = 0;
}
+
+/* Parse kernel version and return 1 if ext4 supports quota feature */
+int ext4_supports_quota_feature(void)
+{
+ struct utsname stats;
+ int v;
+ char *errch;
+
+ if (uname(&stats) < 0) {
+ errstr(_("Cannot get system info: %s\n"), strerror(errno));
+ return 0;
+ }
+ if (strcmp(stats.sysname, "Linux"))
+ return 0;
+ v = strtol(stats.release, &errch, 10);
+ if (v < 4)
+ return 0;
+ if (v > 4)
+ return 1;
+ if (*errch != '.')
+ return 0;
+ v = strtol(errch + 1, &errch, 10);
+ if (*errch != '.' || v < 9)
+ return 0;
+ return 1;
+}
diff --git a/quotasys.h b/quotasys.h
index 05f8ad5..841251e 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -203,6 +203,9 @@ struct mount_entry *get_next_mount(void);
/* Free all structures associated with mountpoints scan */
void end_mounts_scan(void);
+/* Parse kernel version and return 1 if ext4 supports quota feature */
+int ext4_supports_quota_feature(void);
+
/* Quota output formats */
#define QOF_ERROR -1
#define QOF_DEFAULT 0
--
2.25.4

View File

@ -1,68 +0,0 @@
From 7942290a0a6230fcc56eae42bf436e6eeca88777 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 24 May 2019 12:25:15 +0200
Subject: [PATCH 3/4] quotaops: Do not leak dquot structures on failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaops.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/quotaops.c b/quotaops.c
index 3d65490..e067d29 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -80,7 +80,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
if (euid != id && euid != 0) {
uid2user(id, name);
errstr(_("%s (uid %d): Permission denied\n"), name, id);
- return (struct dquot *)NULL;
+ goto out_err;
}
break;
case GRPQUOTA:
@@ -92,7 +92,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
if (!gidsetp) {
gid2group(id, name);
errstr(_("%s (gid %d): gid set allocation (%d): %s\n"), name, id, ngroups, strerror(errno));
- return (struct dquot *)NULL;
+ goto out_err;
}
}
else
@@ -103,7 +103,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
free(gidsetp);
gid2group(id, name);
errstr(_("%s (gid %d): error while trying getgroups(): %s\n"), name, id, strerror(errno));
- return (struct dquot *)NULL;
+ goto out_err;
}
for (j = 0; j < ngroups; j++)
@@ -115,7 +115,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
gid2group(id, name);
errstr(_("%s (gid %d): Permission denied\n"),
name, id);
- return (struct dquot *)NULL;
+ goto out_err;
}
break;
default:
@@ -134,6 +134,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
id2name(id, handles[i]->qh_type, name);
errstr(_("error while getting quota from %s for %s (id %u): %s\n"),
handles[i]->qh_quotadev, name, id, strerror(olderrno));
+out_err:
freeprivs(qhead);
return NULL;
}
--
2.20.1

View File

@ -1,61 +0,0 @@
From e6decbfe6c44935584954ab01c8be2f5d02acf1b Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 24 May 2019 12:21:46 +0200
Subject: [PATCH 2/4] quotaops: Do not return partial list from getprivs()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaops.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/quotaops.c b/quotaops.c
index ad29fd9..3d65490 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -61,7 +61,7 @@ void update_grace_times(struct dquot *q)
/*
* Collect the requested quota information.
*/
-struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
+struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquota)
{
struct dquot *q, *qtail = NULL, *qhead = NULL;
int i;
@@ -124,15 +124,18 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
#endif
if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) {
+ int olderrno = errno;
+
/* If rpc.rquotad is not running filesystem might be just without quotas... */
- if (!quiet || (errno != ENOENT && errno != ECONNREFUSED)) {
- int olderrno = errno;
+ if (ignore_noquota &&
+ (errno == ENOENT || errno == ECONNREFUSED))
+ continue;
- id2name(id, handles[i]->qh_type, name);
- errstr(_("error while getting quota from %s for %s (id %u): %s\n"),
- handles[i]->qh_quotadev, name, id, strerror(olderrno));
- }
- continue;
+ id2name(id, handles[i]->qh_type, name);
+ errstr(_("error while getting quota from %s for %s (id %u): %s\n"),
+ handles[i]->qh_quotadev, name, id, strerror(olderrno));
+ freeprivs(qhead);
+ return NULL;
}
if (qhead == NULL)
qhead = q;
--
2.20.1

View File

@ -1,32 +0,0 @@
From d9996b2b6b3cdcd41485804eabadbf576506c8fa Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 28 May 2019 16:39:22 +0200
Subject: [PATCH] quotaops: Make error string translatable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add forgotten translation quotes to the error string.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/quotaops.c b/quotaops.c
index 16475e8..1a8d7fe 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -131,7 +131,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
continue;
if (errno == ECONNREFUSED) {
- estr = "Cannot connect to RPC quota service";
+ estr = _("Cannot connect to RPC quota service");
} else {
estr = strerror(errno);
}
--
2.20.1

View File

@ -1,127 +0,0 @@
From 4cd287f3fa3838a31eb6636366f8ce26ee6e1425 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 28 May 2019 10:52:49 +0200
Subject: [PATCH] rpc: Clarify error message when cannot connect to rpc.rquotad
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaops.c | 14 +++++++++-----
rquota_client.c | 14 --------------
2 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/quotaops.c b/quotaops.c
index e067d29..16475e8 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -124,16 +124,20 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int ignore_noquo
#endif
if (!(q = handles[i]->qh_ops->read_dquot(handles[i], id))) {
- int olderrno = errno;
+ char *estr;
- /* If rpc.rquotad is not running filesystem might be just without quotas... */
- if (ignore_noquota &&
- (errno == ENOENT || errno == ECONNREFUSED))
+ /* If rpc.rquotad is not running, filesystem might be just without quotas... */
+ if (ignore_noquota && errno == ECONNREFUSED)
continue;
+ if (errno == ECONNREFUSED) {
+ estr = "Cannot connect to RPC quota service";
+ } else {
+ estr = strerror(errno);
+ }
id2name(id, handles[i]->qh_type, name);
errstr(_("error while getting quota from %s for %s (id %u): %s\n"),
- handles[i]->qh_quotadev, name, id, strerror(olderrno));
+ handles[i]->qh_quotadev, name, id, estr);
out_err:
freeprivs(qhead);
return NULL;
diff --git a/rquota_client.c b/rquota_client.c
index a3a4ae3..7f8e821 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -148,7 +148,6 @@ int rpc_rquota_get(struct dquot *dquot)
} args;
char *fsname_tmp, *host, *pathname;
struct timeval timeout = { 2, 0 };
- int rquotaprog_not_registered = 0;
int ret;
/*
@@ -210,8 +209,6 @@ int rpc_rquota_get(struct dquot *dquot)
}
else {
result = NULL;
- if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
- rquotaprog_not_registered = 1;
}
if (result == NULL || !result->status) {
@@ -251,16 +248,12 @@ int rpc_rquota_get(struct dquot *dquot)
clnt_destroy(clnt);
} else {
result = NULL;
- if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
- rquotaprog_not_registered = 1;
}
}
}
free(fsname_tmp);
if (result)
ret = result->status;
- else if (rquotaprog_not_registered)
- ret = Q_NOQUOTA;
else
ret = -1;
return rquota_err(ret);
@@ -280,7 +273,6 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
} args;
char *fsname_tmp, *host, *pathname;
struct timeval timeout = { 2, 0 };
- int rquotaprog_not_registered = 0;
int ret;
/* RPC limits values to 32b variables. Prevent value wrapping. */
@@ -340,8 +332,6 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
}
else {
result = NULL;
- if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
- rquotaprog_not_registered = 1;
}
if (result == NULL || !result->status) {
@@ -383,16 +373,12 @@ int rpc_rquota_set(int qcmd, struct dquot *dquot)
clnt_destroy(clnt);
} else {
result = NULL;
- if (rpc_createerr.cf_stat == RPC_PROGNOTREGISTERED)
- rquotaprog_not_registered = 1;
}
}
}
free(fsname_tmp);
if (result)
ret = result->status;
- else if (rquotaprog_not_registered)
- ret = Q_NOQUOTA;
else
ret = -1;
return rquota_err(ret);
--
2.20.1

View File

@ -1,73 +0,0 @@
From daba90fb6d9b8c8f1361457bf2bea7b18f4e35ec Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 24 May 2019 12:53:32 +0200
Subject: [PATCH 4/4] setquota: Report failure to obtain quota information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
setquota.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/setquota.c b/setquota.c
index 08fdbfc..993d920 100644
--- a/setquota.c
+++ b/setquota.c
@@ -315,8 +315,17 @@ static int setlimits(struct quota_handle **handles)
int ret = 0;
curprivs = getprivs(id, handles, !!(flags & FL_ALL));
+ if (!curprivs) {
+ errstr(_("Error getting quota information to update.\n"));
+ return -1;
+ }
if (flags & FL_PROTO) {
protoprivs = getprivs(protoid, handles, 0);
+ if (!protoprivs) {
+ errstr(_("Error getting prototype quota information.\n"));
+ ret = -1;
+ goto out;
+ }
for (q = curprivs, protoq = protoprivs; q && protoq; q = q->dq_next, protoq = protoq->dq_next) {
q->dq_dqb.dqb_bsoftlimit = protoq->dq_dqb.dqb_bsoftlimit;
q->dq_dqb.dqb_bhardlimit = protoq->dq_dqb.dqb_bhardlimit;
@@ -337,6 +346,7 @@ static int setlimits(struct quota_handle **handles)
}
if (putprivs(curprivs, COMMIT_LIMITS) == -1)
ret = -1;
+out:
freeprivs(curprivs);
return ret;
}
@@ -436,6 +446,10 @@ static int batch_setlimits(struct quota_handle **handles)
while (!read_entry(&id, &isoftlimit, &ihardlimit, &bsoftlimit, &bhardlimit)) {
curprivs = getprivs(id, handles, !!(flags & FL_ALL));
+ if (!curprivs) {
+ errstr(_("Error getting quota information to update.\n"));
+ return -1;
+ }
for (q = curprivs; q; q = q->dq_next) {
q->dq_dqb.dqb_bsoftlimit = bsoftlimit;
q->dq_dqb.dqb_bhardlimit = bhardlimit;
@@ -475,6 +489,10 @@ static int setindivgraces(struct quota_handle **handles)
struct dquot *q, *curprivs;
curprivs = getprivs(id, handles, !!(flags & FL_ALL));
+ if (!curprivs) {
+ errstr(_("Error getting quota information to update.\n"));
+ return -1;
+ }
for (q = curprivs; q; q = q->dq_next) {
if (q->dq_dqb.dqb_bsoftlimit && toqb(q->dq_dqb.dqb_curspace) > q->dq_dqb.dqb_bsoftlimit)
q->dq_dqb.dqb_btime = toset.dqb_btime;
--
2.20.1

View File

@ -1,34 +0,0 @@
From 662e9e93babc9be39bb2d6267ffe428703ca137e Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 12 Sep 2019 10:18:01 +0200
Subject: [PATCH] warnquota: Clarify that CC_TO gets resolved through LDAP
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Petr Písař: Ported to Fedora 32.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.conf | 2 ++
1 file changed, 2 insertions(+)
diff --git a/warnquota.conf b/warnquota.conf
index 7e00947..34bfe53 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -8,6 +8,8 @@ MAIL_CMD = "/usr/sbin/sendmail -t"
FROM = "root@example.com"
# but they don't have to be:
SUBJECT = NOTE: You are exceeding your allocated disk space limits
+# Note that if LDAP is configured, the name in CC_TO gets looked up in LDAP
+# to obtain email address similarly to email recipient address.
CC_TO = "root@example.com"
# If you set this variable CC will be used only when user has less than
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
--
2.21.0

View File

@ -1,33 +0,0 @@
From 1ae10f8692981285ad52af9e9ae3e5f16201b187 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 12 Aug 2019 16:31:31 +0200
Subject: [PATCH] warnquota: Fix help text
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The help text was wrongly saying that -v is equivalent to --version.
It should be -V.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/warnquota.c b/warnquota.c
index 5158094..606b7cc 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -1042,7 +1042,7 @@ static void usage(void)
-q, --quota-tab=quotatab-file non-default quotatab\n\
-a, --admins-file=admins-file non-default admins file\n\
-h, --help display this help message and exit\n\
--v, --version display version information and exit\n\n"));
+-V, --version display version information and exit\n\n"));
errstr(_("Bugs to %s\n"), PACKAGE_BUGREPORT);
wc_exit(1);
}
--
2.21.0

View File

@ -1,36 +0,0 @@
From a543b200cdd1e798383cc1070e51ad13ff424543 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 5 Nov 2019 12:11:14 +0100
Subject: [PATCH] warnquota: Free LDAP error message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
warnquota.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/warnquota.c b/warnquota.c
index d54b4c1..f6b42d5 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -190,8 +190,11 @@ static void print_ldap_error(int err, char *prefix)
sstrncat(outbuf, ": %s\n", LDAP_ERR_BUF_SIZE);
errstr(outbuf, ldap_err2string(err));
ldap_get_option(ldapconn, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void *)&msg);
- if (msg && strcmp(msg, ""))
+ if (msg) {
+ if (strcmp(msg, ""))
errstr(_("Additional error info: %s\n"), msg);
+ ldap_memfree(msg);
+ }
}
static int setup_ldap(struct configparams *config)
--
2.21.0

View File

@ -1,61 +0,0 @@
From 50c3f30d610ed9979a1291422e8641e05f881212 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 5 Nov 2019 14:20:46 +0100
Subject: [PATCH] warnquota: Initialize all members of a configparams structure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
warnquota.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index f6b42d5..2882fee 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -759,13 +759,13 @@ static int readconfigfile(const char *filename, struct configparams *config)
char *locale;
/* set default values */
+ memset(config, 0, sizeof(*config));
sstrncpy(config->mail_cmd, MAIL_CMD, CNF_BUFFER);
sstrncpy(config->from, FROM, CNF_BUFFER);
sstrncpy(config->subject, SUBJECT, CNF_BUFFER);
sstrncpy(config->cc_to, CC_TO, CNF_BUFFER);
sstrncpy(config->support, SUPPORT, CNF_BUFFER);
sstrncpy(config->phone, PHONE, CNF_BUFFER);
- (config->charset)[0] = '\0';
setlocale(LC_ALL, NULL);
locale = setlocale(LC_MESSAGES, NULL);
#ifdef HAVE_NL_LANGINFO
@@ -775,17 +775,11 @@ static int readconfigfile(const char *filename, struct configparams *config)
}
#endif
maildev[0] = 0;
- config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
config->cc_before = -1;
#ifdef USE_LDAP_MAIL_LOOKUP
- config->use_ldap_mail = 0;
- config->ldap_starttls = 0;
config->ldap_tls = LDAP_OPT_X_TLS_NEVER;
config->ldap_vers = LDAP_VERSION3;
- config->ldap_port = config->ldap_is_setup = 0;
- config->ldap_host[0] = 0;
- config->ldap_uri[0] = 0;
#endif
if (!(fp = fopen(filename, "r"))) {
--
2.21.0

View File

@ -1,82 +0,0 @@
From 52ead0d37dcbce59338dcb765527712c9ee656e1 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 12 Sep 2019 10:06:38 +0200
Subject: [PATCH] warnquota: Print also additional error info for LDAP errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
LDAP library provides additional error information in some cases. Print
it make debugging LDAP setup easier.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 24d7410..d54b4c1 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -178,6 +178,22 @@ static void wc_exit(int ex_stat)
}
#ifdef USE_LDAP_MAIL_LOOKUP
+
+#define LDAP_ERR_BUF_SIZE 1024
+
+static void print_ldap_error(int err, char *prefix)
+{
+ char *msg = NULL;
+ char outbuf[LDAP_ERR_BUF_SIZE];
+
+ sstrncpy(outbuf, prefix, LDAP_ERR_BUF_SIZE);
+ sstrncat(outbuf, ": %s\n", LDAP_ERR_BUF_SIZE);
+ errstr(outbuf, ldap_err2string(err));
+ ldap_get_option(ldapconn, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void *)&msg);
+ if (msg && strcmp(msg, ""))
+ errstr(_("Additional error info: %s\n"), msg);
+}
+
static int setup_ldap(struct configparams *config)
{
int ret;
@@ -187,7 +203,7 @@ static int setup_ldap(struct configparams *config)
ret = ldap_initialize(&ldapconn, config->ldap_uri);
if (ret != LDAP_SUCCESS) {
- errstr(_("ldap_initialize() failed: %s\n"), ldap_err2string(ret));
+ print_ldap_error(ret, _("ldap_initialize() failed"));
return -1;
}
@@ -196,13 +212,13 @@ static int setup_ldap(struct configparams *config)
ldap_set_option(ldapconn, LDAP_OPT_X_TLS_REQUIRE_CERT, &(config->ldap_tls));
ret = ldap_start_tls_s(ldapconn, NULL, NULL);
if (ret != LDAP_SUCCESS) {
- errstr(_("ldap_start_tls_s() failed: %s\n"), ldap_err2string(ret));
- return -1;
+ print_ldap_error(ret, _("ldap_start_tls_s() failed"));
+ return -1;
}
}
ret = ldap_sasl_bind_s(ldapconn, config->ldap_binddn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
if (ret != LDAP_SUCCESS) {
- errstr(_("ldap_sasl_bind_s() failed: %s\n"), ldap_err2string(ret));
+ print_ldap_error(ret, _("ldap_sasl_bind_s() failed"));
return -1;
}
return 0;
@@ -428,7 +444,7 @@ static char *lookup_user(struct configparams *config, char *user)
if (ret != LDAP_SUCCESS) {
errstr(_("Error with %s.\n"), user);
- errstr(_("ldap_search_ext_s() failed: %s\n"), ldap_err2string(ret));
+ print_ldap_error(ret, _("ldap_search_ext_s() failed"));
return NULL;
}
--
2.21.0

View File

@ -1,42 +0,0 @@
From 3615f3ec7dd3c867a8394640c0fc4736189315df Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 5 Sep 2019 16:29:08 +0200
Subject: [PATCH] warnquota: Properly detect LDAP errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 53da671..24d7410 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -201,7 +201,7 @@ static int setup_ldap(struct configparams *config)
}
}
ret = ldap_sasl_bind_s(ldapconn, config->ldap_binddn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, NULL);
- if(ret < 0) {
+ if (ret != LDAP_SUCCESS) {
errstr(_("ldap_sasl_bind_s() failed: %s\n"), ldap_err2string(ret));
return -1;
}
@@ -426,7 +426,7 @@ static char *lookup_user(struct configparams *config, char *user)
searchbuf, NULL, 0, NULL, NULL, NULL,
0, &result);
- if (ret < 0) {
+ if (ret != LDAP_SUCCESS) {
errstr(_("Error with %s.\n"), user);
errstr(_("ldap_search_ext_s() failed: %s\n"), ldap_err2string(ret));
return NULL;
--
2.21.0

View File

@ -1,4 +1,4 @@
From 67a0dbf6434552e720b0d311597553b3a76f779e Mon Sep 17 00:00:00 2001
From 6400cf65afed09c63d96cc62b1e7eee964bdb6cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 13:45:15 +0200
Subject: [PATCH] warnquota configuration tunes
@ -8,19 +8,20 @@ Content-Transfer-Encoding: 8bit
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream (we had root@... addresses and more enterprise
wordings usually there).
wordings usually there). Later improved by the upstream in
0efb2331f1c39c9665fb6e92e83c7d080b877de1.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 2 +-
warnquota.conf | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
warnquota.conf | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 0d911e4..2c8e084 100644
index 2882fee..48d79c0 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -837,7 +837,7 @@ cc_parse_err:
@@ -883,7 +883,7 @@ cc_parse_err:
}
#ifdef USE_LDAP_MAIL_LOOKUP
else if (!strcmp(var, "LDAP_MAIL")) {
@ -30,33 +31,36 @@ index 0d911e4..2c8e084 100644
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index b06f81f..7e00947 100644
index 5bbd0ab..366c3e0 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,17 +4,16 @@
# and even blank lines
@@ -19,20 +19,20 @@ FAIL = "configure /etc/warnquota.conf before running warnquota"
#
# command used for sending mails
#
-MAIL_CMD = "/usr/lib/sendmail -t"
+MAIL_CMD = "/usr/sbin/sendmail -t"
# values can be quoted:
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
-MAIL_CMD = "/bin/echo"
-FROM = "bas@example.com"
+MAIL_CMD = "/usr/sbin/sendmail -t"
+FROM = "root@example.com"
# but they don't have to be:
-SUBJECT = Hey, user, clean up your account!
-CC_TO = "sysadm@example.com"
+SUBJECT = NOTE: You are exceeding your allocated disk space limits
#
# Standard mail fields
-FROM = "root@localhost"
-SUBJECT = "Your account quota has exceeded!"
+FROM = "root@example.com"
+SUBJECT = "You are exceeding your allocated disk space limits"
# Note that if LDAP is configured, the name in CC_TO gets looked up in LDAP
# to obtain email address similarly to email recipient address.
-CC_TO = "root@localhost"
+CC_TO = "root@example.com"
# If you set this variable CC will be used only when user has less than
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
# 12 hours, 5 days)
# CC_BEFORE = 2 days
-SUPPORT = "support@example.com"
-SUPPORT = "root@localhost"
+SUPPORT = "root@example.com"
PHONE = "(123) 456-1111 or (222) 333-4444"
PHONE = "123 456 789"
# Text in the beginning of the mail (if not specified, default text is used)
# This way text can be split to more lines
@@ -22,11 +21,11 @@ PHONE = "(123) 456-1111 or (222) 333-4444"
@@ -40,11 +40,11 @@ PHONE = "123 456 789"
# The expressions %i, %h, %d, and %% are substituted for user/group name,
# host name, domain name, and '%' respectively. For backward compatibility
# %s behaves as %i but is deprecated.
@ -72,5 +76,5 @@ index b06f81f..7e00947 100644
GROUP_MESSAGE = Hello,|\
your group %i is using too much disk space at %h.|\
--
2.13.5
2.25.4

View File

@ -1,24 +1,23 @@
# Scan ext file systems directly to increase performace of a quota
# Scan ext file systems directly to increase the performace of a quota
# initialization and check
%bcond_without quota_enables_extdirect
# Use netlink to monitor quota usage and warn interactive users
%bcond_without quota_enables_netlink
# Enable getting quotas over remotely
# Enable getting quotas remotely over network
%bcond_without quota_enables_rpc
# Allow setting quota remotely
# Allow setting quota remotely over network
%bcond_without quota_enables_rpcsetquota
# Disable TCP Wrappers guard in RPC quota daemon
# Disable TCP Wrappers guard in the RPC quota daemon
%bcond_with quota_enables_tcpwrappers
Name: quota
Epoch: 1
Version: 4.05
Release: 17%{?dist}
Version: 4.06
Release: 1%{?dist}
Summary: System administration tools for monitoring users' disk usage
# quota_nld.c, quotaio_xfs.h: GPLv2
# bylabel.c copied from util-linux: GPLv2+
# doc/quotas.ms, edquota.c: BSD
# COPYING: GPLv2 text and license declaration
# COPYING: GPLv2 text and a license declaration
## Only in quota-rpc binary package
# rquota_server.c: GPLv2+
## Only in quota-rpc and quota-nls binary packages
@ -49,79 +48,17 @@ Summary: System administration tools for monitoring users' disk usage
# Makefile.in: FSFULLR
# missing: GPLv2+ with exception
# mkinstalldirs: Public Domain
License: BSD and GPLv2 and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
Source1: quota_nld.service
Source2: quota_nld.sysconfig
Source3: rpc-rquotad.service
Source4: rpc-rquotad.sysconfig
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
Patch0: quota-4.04-warnquota-configuration-tunes.patch
Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch
# Fix modifying CFLAGS and LDFLAGS by pkgconfig, in upstream after 4.05
Patch2: quota-4.05-Revert-configure.ac-fix-pkg_check_modules-calls.patch
# 1/6 Report an error if an RPC fails on an explicitly requested file system,
# <https://sourceforge.net/p/linuxquota/bugs/134/>, in upstream after 4.05
Patch3: quota-4.05-Make-messages-about-failures-for-NFS-consistent-with.patch
# 2/6
Patch4: quota-4.05-quotaops-Do-not-return-partial-list-from-getprivs.patch
# 3/6
Patch5: quota-4.05-quotaops-Do-not-leak-dquot-structures-on-failure.patch
# 4/6
Patch6: quota-4.05-setquota-Report-failure-to-obtain-quota-information.patch
# 5/6
Patch7: quota-4.05-rpc-Clarify-error-message-when-cannot-connect-to-rpc.patch
# 6/6
Patch8: quota-4.05-quotaops-Make-error-string-translatable.patch
# Fix Free Software Foundation's postal address,
# <https://sourceforge.net/p/linuxquota/bugs/133/>, in upstream after 4.05
Patch9: quota-4.05-COPYING-Update-mailing-address.patch
# Move quota_nld.pid file to /run,
# <https://sourceforge.net/p/linuxquota/patches/49/>, in upstream after 4.05
Patch10: quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch
# Optimize out useless checking of file systems with hidden quota files,
# in upstream after 4.05
Patch11: quota-4.05-quotacheck-Skip-checking-of-filesystems-with-hidded-.patch
# Fix warnquota --help output, in upstream after 4.05
Patch12: quota-4.05-warnquota-Fix-help-text.patch
# Fix checking for the LDAP failures in the warnquota tool,
# in upstream after 4.05
Patch13: quota-4.05-warnquota-Properly-detect-LDAP-errors.patch
# 1/2 Report detailed LDAP failures, in upstream after 4.05
Patch14: quota-4.05-warnquota-Print-also-additional-error-info-for-LDAP-.patch
# 2/2 Report detailed LDAP failures, in upstream after 4.05,
# <https://sourceforge.net/p/linuxquota/patches/50/>
Patch15: quota-4.05-warnquota-Free-LDAP-error-message.patch
# Document CC_TO in warquota.conf is looked up with LDAP,
# in upstream after 4.05
Patch16: quota-4.05-warnquota-Clarify-that-CC_TO-gets-resolved-through-L.patch
# Initialize all members of a configparams structure in warnquota,
# in upstream after 4.05, <https://sourceforge.net/p/linuxquota/patches/51/>
Patch17: quota-4.05-warnquota-Initialize-all-members-of-a-configparams-s.patch
# Fix ignoring disabled quotas, bug #1805110, in upstream after 4.05,
# <https://sourceforge.net/p/linuxquota/bugs/136/>
Patch18: quota-4.05-Fix-ignoring-disabled-quotas.patch
# Pass quota type for Q_XFS_GETQSTAT, in upstream after 4.05
Patch19: quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
# 1/2 Support setting individual grace times for XFS, in upstream after 4.05
Patch20: quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
# 2/2 Support setting individual grace times for XFS, in upstream after 4.05
Patch21: quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
# 1/2 Support grace period expirations past 2038 year for XFS,
# in upstream after 4.05
Patch22: quota-4.05-Support-grace-period-expirations-past-y2038-for-XFS.patch
# 2/2 Support grace period expirations past 2038 year for XFS,
# in upstream after 4.05
Patch23: quota-4.05-Handle-grace-time-overflows-for-XFS-quotas.patch
# Add a synopsis for a project quota option in the quota tool,
# in upstream after 4.05
Patch24: quota-4.05-quota-Add-synopsis-for-project-quota.patch
# Add a --filesystem option to the quota tool, in upstream after 4.05
Patch25: quota-4.05-quota-Add-filesystem-option.patch
# Complain that ext4 external quota files are deprecated,
# in upstream after 4.05
Patch26: quota-4.05-quotacheck-quotaon-Suggest-using-quota-feature-for-e.patch
License: GPLv2 and GPLv2+
URL: http://sourceforge.net/projects/linuxquota/
Source0: http://downloads.sourceforge.net/linuxquota/%{name}-%{version}.tar.gz
Source1: quota_nld.service
Source2: quota_nld.sysconfig
Source3: rpc-rquotad.service
Source4: rpc-rquotad.sysconfig
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa), bug #680919
Patch0: quota-4.06-warnquota-configuration-tunes.patch
# Fix parsing a TCP port number
Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
@ -207,7 +144,7 @@ via cron(8).
%package nls
Summary: Gettext catalogs for disk quota tools
License: BSD and LGPLv2+ and GPLv2 and GPLv2+
License: LGPLv2+ and GPLv2 and GPLv2+
BuildArch: noarch
%description nls
@ -244,31 +181,6 @@ Linux/UNIX environment.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
# Regenerate build scripts
autoreconf -f -i
@ -418,6 +330,9 @@ make check
%changelog
* Tue Nov 10 2020 Petr Pisar <ppisar@redhat.com> - 1:4.06-1
- 4.06 bump
* Fri Nov 06 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-17
- Support grace period expirations past 2038 year for XFS
- Add a synopsis for a project quota option in the quota tool

View File

@ -1 +1 @@
SHA512 (quota-4.05.tar.gz) = a13ca93fb6fad032cb032874dda2f5d792e619b41e89b481e6aaa4f06ac5774e2728b09dd625addfbe22efccb1d85892b093736084c72f75675a60df168b92f2
SHA512 (quota-4.06.tar.gz) = cece46b8e3a82e8afcf8bfc9f6b310ec91afe034102cebc031bc7d7e04287fdbffb21ab1d3e6e1825175cffa4bad0a4ecbefec0efee028d961b14ac626d5c871