From 576bbc0a183f792ff3d850790fe8756ccba279e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 6 Sep 2017 15:57:27 +0200 Subject: [PATCH] 4.04 bump --- .gitignore | 1 + ...t-for-scanning-using-Q_XGETNEXTQUOTA.patch | 92 ------- quota-4.03-Build-rpc.rquotad-as-PIE.patch | 53 ---- ...uota_nld.8-when-quota_nld-is-not-ins.patch | 55 ---- ...xplicitely-disabled-options-properly.patch | 86 ------- quota-4.03-Respect-enviroment-CFLAGS.patch | 32 --- ....03-Scan-dquots-using-Q_GETNEXTQUOTA.patch | 142 ----------- ...ound-an-AC_CHECK_LIB-bug-in-Autoconf.patch | 37 --- ...llocate-memory-after-direct-scanning.patch | 99 -------- ...heck-Fix-buggy-error-check-of-read-2.patch | 34 --- ...ck-Use-direct-scanning-also-for-ext4.patch | 36 --- ...e-to-the-directory-before-opening-it.patch | 48 ---- ...ix-ask_yn-UB-when-fgets-returns-NULL.patch | 43 ---- ...ops-check-return-code-of-fgets-calls.patch | 73 ------ ...eturn-code-of-ftruncate-and-lseek-ca.patch | 128 ---------- ...aops-check-setgid-setuid-return-code.patch | 38 --- ...-same-whitespace-for-quotaio_meta-as.patch | 41 --- ...tall-rquota-3-only-if-RPC-is-enabled.patch | 44 ++++ ...a-4.04-warnquota-configuration-tunes.patch | 12 +- quota.spec | 239 ++++++++---------- sources | 3 +- 21 files changed, 163 insertions(+), 1173 deletions(-) delete mode 100644 quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch delete mode 100644 quota-4.03-Build-rpc.rquotad-as-PIE.patch delete mode 100644 quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch delete mode 100644 quota-4.03-Print-explicitely-disabled-options-properly.patch delete mode 100644 quota-4.03-Respect-enviroment-CFLAGS.patch delete mode 100644 quota-4.03-Scan-dquots-using-Q_GETNEXTQUOTA.patch delete mode 100644 quota-4.03-Work-around-an-AC_CHECK_LIB-bug-in-Autoconf.patch delete mode 100644 quota-4.03-quotacheck-Deallocate-memory-after-direct-scanning.patch delete mode 100644 quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch delete mode 100644 quota-4.03-quotacheck-Use-direct-scanning-also-for-ext4.patch delete mode 100644 quota-4.03-quotacheck-change-to-the-directory-before-opening-it.patch delete mode 100644 quota-4.03-quotacheck-fix-ask_yn-UB-when-fgets-returns-NULL.patch delete mode 100644 quota-4.03-quotaops-check-return-code-of-fgets-calls.patch delete mode 100644 quota-4.03-quotaops-check-return-code-of-ftruncate-and-lseek-ca.patch delete mode 100644 quota-4.03-quotaops-check-setgid-setuid-return-code.patch delete mode 100644 quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch create mode 100644 quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch rename quota-4.03-warnquota-configuration-tunes.patch => quota-4.04-warnquota-configuration-tunes.patch (89%) diff --git a/.gitignore b/.gitignore index 1ec9ec6..23ec9c6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ quota-3.17.tar.gz /quota-4.02.tar.gz /quota-4.03.tar.gz /ldap-scripts.tar.gz +/quota-4.04.tar.gz diff --git a/quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch b/quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch deleted file mode 100644 index 1eb0d17..0000000 --- a/quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 7367f5d511ec4555fbb7a87c1c1853fd4fd01712 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Tue, 26 Jan 2016 14:06:59 +0100 -Subject: [PATCH 2/2] Add support for scanning using Q_XGETNEXTQUOTA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add support for scanning of all available quota structures using -Q_XGETNEXTQUOTA quotactl. - -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotaio_xfs.c | 42 +++++++++++++++++++++++++++++++++++++++--- - quotaio_xfs.h | 1 + - 2 files changed, 40 insertions(+), 3 deletions(-) - -diff --git a/quotaio_xfs.c b/quotaio_xfs.c -index 903c03e..9d90a3e 100644 ---- a/quotaio_xfs.c -+++ b/quotaio_xfs.c -@@ -191,15 +191,51 @@ static int xfs_get_dquot(struct dquot *dq) - return 0; - } - -+static int xfs_kernel_scan_dquots(struct quota_handle *h, -+ int (*process_dquot)(struct dquot *dquot, char *dqname)) -+{ -+ struct dquot *dquot = get_empty_dquot(); -+ qid_t id = 0; -+ struct xfs_kern_dqblk xdqblk; -+ int ret; -+ -+ dquot->dq_h = h; -+ while (1) { -+ ret = quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type), -+ h->qh_quotadev, id, (void *)&xdqblk); -+ if (ret < 0) -+ break; -+ -+ xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk); -+ dquot->dq_id = xdqblk.d_id; -+ ret = process_dquot(dquot, NULL); -+ if (ret < 0) -+ break; -+ id = xdqblk.d_id + 1; -+ } -+ free(dquot); -+ -+ if (errno == ENOENT) -+ return 0; -+ return ret; -+} -+ - /* - * Scan all known dquots and call callback on each - */ - static int xfs_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *dquot, char *dqname)) - { -- if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h)) -- return 0; -+ int ret; -+ struct xfs_kern_dqblk xdqblk; - -- return generic_scan_dquots(h, process_dquot, xfs_get_dquot); -+ ret = quotactl(QCMD(Q_XGETNEXTQUOTA, h->qh_type), h->qh_quotadev, 0, -+ (void *)&xdqblk); -+ if (ret < 0 && (errno == ENOSYS || errno == EINVAL)) { -+ if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h)) -+ return 0; -+ return generic_scan_dquots(h, process_dquot, xfs_get_dquot); -+ } -+ return xfs_kernel_scan_dquots(h, process_dquot); - } - - /* -diff --git a/quotaio_xfs.h b/quotaio_xfs.h -index 54725b0..2236da4 100644 ---- a/quotaio_xfs.h -+++ b/quotaio_xfs.h -@@ -46,6 +46,7 @@ - #define Q_XSETQLIM XQM_CMD(0x4) /* set disk limits only */ - #define Q_XGETQSTAT XQM_CMD(0x5) /* returns fs_quota_stat_t struct */ - #define Q_XQUOTARM XQM_CMD(0x6) /* free quota files' space */ -+#define Q_XGETNEXTQUOTA XQM_CMD(0x9) /* get disk limits and usage >= ID */ - - /* - * fs_disk_quota structure: --- -2.5.0 - diff --git a/quota-4.03-Build-rpc.rquotad-as-PIE.patch b/quota-4.03-Build-rpc.rquotad-as-PIE.patch deleted file mode 100644 index 6c6381c..0000000 --- a/quota-4.03-Build-rpc.rquotad-as-PIE.patch +++ /dev/null @@ -1,53 +0,0 @@ -From cc25319e5e179da1c1d9455ab4760dcbcb66b591 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Wed, 6 Jan 2016 17:14:08 +0100 -Subject: [PATCH] Build rpc.rquotad as PIE -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Harden executables due to rpc.rquotad and quota_nld daemons. - -Recent distribution enabled hardening globally. This patch preserves the -test to catch a regression. - - - -Signed-off-by: Petr Písař ---- - Makefile.am | 2 ++ - test-hardened | 9 +++++++++ - 2 files changed, 11 insertions(+) - create mode 100644 test-hardened - -diff --git a/Makefile.am b/Makefile.am -index eb62617..1414f8d 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -232,6 +232,8 @@ quota_nld_LDADD = \ - $(DBUS_LIBS) \ - $(LIBNL3_LIBS) - -+TEST=test-hardended -+ - # ------------------ - # Rpcgen conversions - # ------------------ -diff --git a/test-hardened b/test-hardened -new file mode 100644 -index 0000000..b8f63bf ---- /dev/null -+++ b/test-hardened -@@ -0,0 +1,9 @@ -+#!/bin/sh -+# Check rpc.rquotad and quota_nld daemons are hardened (bug #983179) -+ -+for D in rpc.rquotad quota_nld; do -+ if readelf -d "$D" | fgrep -q TEXTREL; then -+ echo "*** Text relocation found in ${D}" -+ exit 1; -+ fi -+done --- -2.5.0 - diff --git a/quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch b/quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch deleted file mode 100644 index 5aaa0c4..0000000 --- a/quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 757e659344a144f86adb4c531fa4477771dfc0bc Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 12:27:31 +0300 -Subject: [PATCH] Do not install quota_nld.8 when quota_nld is not installed -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Ported to 4.03: - -commit 579425d669eb4df2ae26ceb70dfb9380c38fb521 -Author: Dmitry V. Levin -Date: Thu May 18 12:27:31 2017 +0300 - - Do not install quota_nld.8 when quota_nld is not installed - - 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 - Signed-off-by: Jan Kara - -Signed-off-by: Petr Písař ---- - Makefile.am | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 1414f8d..ff9f6a0 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -27,7 +27,6 @@ man_MANS = \ - edquota.8 \ - quotagrpadmins.5 \ - quotacheck.8 \ -- quota_nld.8 \ - quotaon.8 \ - quotastats.8 \ - quotasync.1 \ -@@ -42,6 +41,10 @@ man_MANS = \ - warnquota.8 \ - xqmstats.8 - -+if WITH_NETLINK -+man_MANS += quota_nld.8 -+endif -+ - CLEANFILES = rquota.c rquota.h rquota_clnt.c - - SUBDIRS = po --- -2.9.4 - diff --git a/quota-4.03-Print-explicitely-disabled-options-properly.patch b/quota-4.03-Print-explicitely-disabled-options-properly.patch deleted file mode 100644 index 819252e..0000000 --- a/quota-4.03-Print-explicitely-disabled-options-properly.patch +++ /dev/null @@ -1,86 +0,0 @@ -From ef6047e5645efbc05f260260b174a4043dda21fd Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Mon, 4 Jan 2016 15:36:27 +0100 -Subject: [PATCH] Print explicitely disabled options properly -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Ported to 3.04: -commit 6ccb66159a9eee6ca114b11b70eb06f4ac6900d7 -Author: Jan Kara -Date: Mon Jan 4 15:36:27 2016 +0100 - - Print explicitely disabled options properly - - 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 - -Signed-off-by: Petr Písař ---- - configure.ac | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 1994945..82aabcb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -74,7 +74,7 @@ AC_ARG_ENABLE([ldapmail], - AS_IF([test "x$enable_ldapmail" != "xno"], [ - build_ldap="yes" - AC_CHECK_LIB([ldap], [ldap_initialize], [:;], [ -- build_ldap=no -+ build_ldap="no" - AS_IF([test "x$enable_ldapmail" = "xyes"], [ - AC_MSG_ERROR([LDAP support required but library not found.]); - ]) -@@ -84,6 +84,8 @@ AS_IF([test "x$enable_ldapmail" != "xno"], [ - AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP]) - COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP" - ]) -+], [ -+ build_ldap="no" - ]) - AC_SUBST(LDAP_LIBS) - -@@ -113,6 +115,8 @@ AS_IF([test "x$enable_ext2direct" != "xno"], [ - AC_DEFINE([EXT2_DIRECT], 1, [Scanning of ext? filesystems using e2fslib]) - COMPILE_OPTS="$COMPILE_OPTS EXT2_DIRECT" - ]) -+], [ -+ build_ext2direct="no" - ]) - AC_SUBST(EXT2FS_CFLAGS) - AC_SUBST(EXT2FS_LIBS) -@@ -141,6 +145,8 @@ AS_IF([test "x$enable_netlink" != "xno"], [ - AC_MSG_ERROR([Required libnl3 libraries for quota netlink daemon not found.]) - ]) - ]) -+], [ -+ build_netlink="no" - ]) - AM_CONDITIONAL([WITH_NETLINK], [test "x$build_netlink" != "xno"]) - AC_SUBST(DBUS_CFLAGS) -@@ -171,6 +177,8 @@ AS_IF([test "x$enable_libwrap" != "xno"], [ - AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad]) - COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS" - ]) -+], [ -+ build_libwrap="no" - ]) - AC_SUBST(WRAP_LIBS) - -@@ -199,6 +207,8 @@ AS_IF([test x"$enable_rpc" != "xno"], [ - AC_DEFINE([RPC], 1, [Support for RPC]) - COMPILE_OPTS="$COMPILE_OPTS RPC" - ]) -+], [ -+ build_rpc="no" - ]) - AM_CONDITIONAL([WITH_RPC], [test x"$build_rpc" != "xno"]) - --- -2.9.4 - diff --git a/quota-4.03-Respect-enviroment-CFLAGS.patch b/quota-4.03-Respect-enviroment-CFLAGS.patch deleted file mode 100644 index 49ca2b9..0000000 --- a/quota-4.03-Respect-enviroment-CFLAGS.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 27a7f0020b0965a83559de04673551cf92eb4cbc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Thu, 7 Jan 2016 08:54:35 +0100 -Subject: [PATCH] Respect enviroment CFLAGS -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Configure fails if LDFLAGS carries -pie and CFLAGS -fPIC. That's -because confifgure.ac resets CFLAGS. - -Signed-off-by: Petr Písař ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 960a618..bb33774 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -53,7 +53,7 @@ AS_IF([test "x${prefix}" = "xNONE"], [ - # ================ - # Check for cflags - # ================ --CFLAGS="-D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" -+CFLAGS="${CFLAGS} -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" - AC_ARG_ENABLE([werror], - [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, useful for development])], - [enable_werror="$enableval"], --- -2.5.0 - diff --git a/quota-4.03-Scan-dquots-using-Q_GETNEXTQUOTA.patch b/quota-4.03-Scan-dquots-using-Q_GETNEXTQUOTA.patch deleted file mode 100644 index 38707ed..0000000 --- a/quota-4.03-Scan-dquots-using-Q_GETNEXTQUOTA.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 85687833434d50e3f5fd4b849e543eb505bf5a20 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Tue, 26 Jan 2016 13:10:59 +0100 -Subject: [PATCH 1/2] Scan dquots using Q_GETNEXTQUOTA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Check for new kernel quotactl Q_GETNEXTQUOTA and if available use it for -scanning all dquot structures. - -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quota.h | 14 ++++++++++++++ - quotaio_generic.c | 34 ++++++++++++++++++++++++++++++++++ - quotaio_generic.h | 4 ++++ - quotaio_meta.c | 14 +++++++++++++- - 4 files changed, 65 insertions(+), 1 deletion(-) - -diff --git a/quota.h b/quota.h -index 0c38427..0607e04 100644 ---- a/quota.h -+++ b/quota.h -@@ -63,6 +63,7 @@ typedef int64_t qsize_t; /* Type in which we store size limitations */ - #define Q_SETINFO 0x800006 /* set information about quota files */ - #define Q_GETQUOTA 0x800007 /* get user quota structure */ - #define Q_SETQUOTA 0x800008 /* set user quota structure */ -+#define Q_GETNEXTQUOTA 0x800009 /* get disk limits and usage >= ID */ - - /* - * Quota structure used for communication with userspace via quotactl -@@ -91,6 +92,19 @@ struct if_dqblk { - u_int32_t dqb_valid; - }; - -+struct if_nextdqblk { -+ u_int64_t dqb_bhardlimit; -+ u_int64_t dqb_bsoftlimit; -+ u_int64_t dqb_curspace; -+ u_int64_t dqb_ihardlimit; -+ u_int64_t dqb_isoftlimit; -+ u_int64_t dqb_curinodes; -+ u_int64_t dqb_btime; -+ u_int64_t dqb_itime; -+ u_int32_t dqb_valid; -+ u_int32_t dqb_id; -+}; -+ - /* - * Structure used for setting quota information about file via quotactl - * Following flags are used to specify which fields are valid -diff --git a/quotaio_generic.c b/quotaio_generic.c -index 5001a56..4bdf380 100644 ---- a/quotaio_generic.c -+++ b/quotaio_generic.c -@@ -161,3 +161,37 @@ int generic_scan_dquots(struct quota_handle *h, - free(dquot); - return ret; - } -+ -+int vfs_scan_dquots(struct quota_handle *h, -+ int (*process_dquot)(struct dquot *dquot, char *dqname)) -+{ -+ struct dquot *dquot = get_empty_dquot(); -+ qid_t id = 0; -+ struct if_nextdqblk kdqblk; -+ int ret; -+ -+ dquot->dq_h = h; -+ while (1) { -+ ret = quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), -+ h->qh_quotadev, id, (void *)&kdqblk); -+ if (ret < 0) -+ break; -+ -+ /* -+ * This is a slight hack but we know struct if_dqblk is a -+ * subset of struct if_nextdqblk -+ */ -+ generic_kern2utildqblk(&dquot->dq_dqb, -+ (struct if_dqblk *)&kdqblk); -+ dquot->dq_id = kdqblk.dqb_id; -+ ret = process_dquot(dquot, NULL); -+ if (ret < 0) -+ break; -+ id = kdqblk.dqb_id + 1; -+ } -+ free(dquot); -+ -+ if (errno == ENOENT) -+ return 0; -+ return ret; -+} -diff --git a/quotaio_generic.h b/quotaio_generic.h -index 5edc11c..a7930f0 100644 ---- a/quotaio_generic.h -+++ b/quotaio_generic.h -@@ -27,4 +27,8 @@ int generic_scan_dquots(struct quota_handle *h, - int (*process_dquot)(struct dquot *dquot, char *dqname), - int (*get_dquot)(struct dquot *dquot)); - -+/* Scan all dquots using kernel quotactl to get existing ids */ -+int vfs_scan_dquots(struct quota_handle *h, -+ int (*process_dquot)(struct dquot *dquot, char *dqname)); -+ - #endif -diff --git a/quotaio_meta.c b/quotaio_meta.c -index e52b4f4..ad6ff7a 100644 ---- a/quotaio_meta.c -+++ b/quotaio_meta.c -@@ -8,6 +8,7 @@ - - #include - #include -+#include - - #include - -@@ -55,7 +56,18 @@ static int meta_commit_dquot(struct dquot *dquot, int flags) - - static int meta_scan_dquots(struct quota_handle *h, int (*process_dquot)(struct dquot *dquot, char *dqname)) - { -- return generic_scan_dquots(h, process_dquot, vfs_get_dquot); -+ struct if_nextdqblk kdqblk; -+ int ret; -+ -+ ret = quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), h->qh_quotadev, 0, -+ (void *)&kdqblk); -+ /* -+ * Fall back to scanning using passwd if Q_GETNEXTQUOTA is not -+ * supported -+ */ -+ if (ret < 0 && (errno == ENOSYS || errno == EINVAL)) -+ return generic_scan_dquots(h, process_dquot, vfs_get_dquot); -+ return vfs_scan_dquots(h, process_dquot); - } - - struct quotafile_ops quotafile_ops_meta = { --- -2.5.0 - diff --git a/quota-4.03-Work-around-an-AC_CHECK_LIB-bug-in-Autoconf.patch b/quota-4.03-Work-around-an-AC_CHECK_LIB-bug-in-Autoconf.patch deleted file mode 100644 index 9af9c8f..0000000 --- a/quota-4.03-Work-around-an-AC_CHECK_LIB-bug-in-Autoconf.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 47601e462c6606f7a711c093fb1b03580b01ee46 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Thu, 7 Jan 2016 10:23:24 +0100 -Subject: [PATCH] Work around an AC_CHECK_LIB bug in Autoconf -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -AC_CHECK_LIB([ldap], [ldap_initialize], [], [...]) should not append -lldap to -LIBS variable because third AC_CHECK_LIB arugment is defined and -empty. - -But broken autoconf-2.69-21.fc23 thinks empty is undefined and -defaults to implicit if-found action. That results into linking all -executables to ldap library and that is unnecessary. - -Signed-off-by: Petr Písař ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index bb33774..1994945 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -73,7 +73,7 @@ AC_ARG_ENABLE([ldapmail], - ) - AS_IF([test "x$enable_ldapmail" != "xno"], [ - build_ldap="yes" -- AC_CHECK_LIB([ldap], [ldap_initialize], [], [ -+ AC_CHECK_LIB([ldap], [ldap_initialize], [:;], [ - build_ldap=no - AS_IF([test "x$enable_ldapmail" = "xyes"], [ - AC_MSG_ERROR([LDAP support required but library not found.]); --- -2.5.0 - diff --git a/quota-4.03-quotacheck-Deallocate-memory-after-direct-scanning.patch b/quota-4.03-quotacheck-Deallocate-memory-after-direct-scanning.patch deleted file mode 100644 index ee02d7b..0000000 --- a/quota-4.03-quotacheck-Deallocate-memory-after-direct-scanning.patch +++ /dev/null @@ -1,99 +0,0 @@ -From bf9b17da317ecf56ceada3a575fb95669bf2041b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= -Date: Mon, 21 Aug 2017 13:02:21 +0200 -Subject: [PATCH] quotacheck: Deallocate memory after direct scanning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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) - -Signed-off-by: Petr Písař ---- - quotacheck.c | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/quotacheck.c b/quotacheck.c -index 689ceb9..e9a84ba 100644 ---- a/quotacheck.c -+++ b/quotacheck.c -@@ -429,21 +429,31 @@ static int ext2_direct_scan(const char *device) - - if ((error = ext2fs_allocate_inode_bitmap(fs, "in-use inode map", &inode_used_map))) { - errstr(_("error (%d) while allocating file inode bitmap\n"), (int)error); -+ ext2fs_free(fs); - return -1; - } - - if ((error = ext2fs_allocate_inode_bitmap(fs, "directory inode map", &inode_dir_map))) { - errstr(_("errstr (%d) while allocating directory inode bitmap\n"), (int)error); -+ ext2fs_free_inode_bitmap(inode_used_map); -+ ext2fs_free(fs); - return -1; - } - - if ((error = ext2fs_open_inode_scan(fs, inode_buffer_blocks, &scan))) { - errstr(_("error (%d) while opening inode scan\n"), (int)error); -+ ext2fs_free_inode_bitmap(inode_dir_map); -+ ext2fs_free_inode_bitmap(inode_used_map); -+ ext2fs_free(fs); - return -1; - } - - if ((error = ext2fs_get_next_inode(scan, &i_num, &inode))) { - errstr(_("error (%d) while starting inode scan\n"), (int)error); -+ ext2fs_close_inode_scan(scan); -+ ext2fs_free_inode_bitmap(inode_dir_map); -+ ext2fs_free_inode_bitmap(inode_used_map); -+ ext2fs_free(fs); - return -1; - } - -@@ -474,9 +484,17 @@ static int ext2_direct_scan(const char *device) - - if ((error = ext2fs_get_next_inode(scan, &i_num, &inode))) { - errstr(_("Something weird happened while scanning. Error %d\n"), (int)error); -+ ext2fs_close_inode_scan(scan); -+ ext2fs_free_inode_bitmap(inode_dir_map); -+ ext2fs_free_inode_bitmap(inode_used_map); -+ ext2fs_free(fs); - return -1; - } - } -+ ext2fs_close_inode_scan(scan); -+ ext2fs_free_inode_bitmap(inode_dir_map); -+ ext2fs_free_inode_bitmap(inode_used_map); -+ ext2fs_free(fs); - return 0; - } - #endif --- -2.9.5 - diff --git a/quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch b/quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch deleted file mode 100644 index 976f3a7..0000000 --- a/quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2432de0526c282f05010cfa432059cbc9e794259 Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Wed, 6 Jul 2016 11:10:49 +0200 -Subject: [PATCH] quotacheck: Fix buggy error check of read(2) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -'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 -Signed-off-by: Petr Písař ---- - quotacheck_v2.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/quotacheck_v2.c b/quotacheck_v2.c -index de4293f..4cc8558 100644 ---- a/quotacheck_v2.c -+++ b/quotacheck_v2.c -@@ -233,7 +233,7 @@ static int buffer_entry(dqbuf_t buf, uint blk, int *corrupted, uint * lblk, int - - static void check_read_blk(int fd, uint blk, dqbuf_t buf) - { -- size_t rd; -+ ssize_t rd; - - lseek(fd, blk << QT_BLKSIZE_BITS, SEEK_SET); - rd = read(fd, buf, QT_BLKSIZE); --- -2.7.4 - diff --git a/quota-4.03-quotacheck-Use-direct-scanning-also-for-ext4.patch b/quota-4.03-quotacheck-Use-direct-scanning-also-for-ext4.patch deleted file mode 100644 index 8d5048a..0000000 --- a/quota-4.03-quotacheck-Use-direct-scanning-also-for-ext4.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 2b3795805c8d1bd8873b046508777fa6e9a5c83d Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Tue, 9 Aug 2016 19:17:56 +0200 -Subject: [PATCH] quotacheck: Use direct scanning also for ext4 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 -Signed-off-by: Petr Písař ---- - quotacheck.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/quotacheck.c b/quotacheck.c -index 6f34cff..a6fe432 100644 ---- a/quotacheck.c -+++ b/quotacheck.c -@@ -959,7 +959,10 @@ Please stop all programs writing to filesystem or use -m flag to force checking. - start_scan: - debug(FL_VERBOSE | FL_DEBUG, _("Scanning %s [%s] "), mnt->me_devname, mnt->me_dir); - #if defined(EXT2_DIRECT) -- if (!strcmp(mnt->me_type, MNTTYPE_EXT2) || !strcmp(mnt->me_type, MNTTYPE_EXT3) || !strcmp(mnt->me_type, MNTTYPE_NEXT3)) { -+ if (!strcmp(mnt->me_type, MNTTYPE_EXT2) || -+ !strcmp(mnt->me_type, MNTTYPE_EXT3) || -+ !strcmp(mnt->me_type, MNTTYPE_NEXT3) || -+ !strcmp(mnt->me_type, MNTTYPE_EXT4)) { - if ((failed = ext2_direct_scan(mnt->me_devname)) < 0) - goto out; - } --- -2.7.4 - diff --git a/quota-4.03-quotacheck-change-to-the-directory-before-opening-it.patch b/quota-4.03-quotacheck-change-to-the-directory-before-opening-it.patch deleted file mode 100644 index 0f23eca..0000000 --- a/quota-4.03-quotacheck-change-to-the-directory-before-opening-it.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 9f6a3c484ee780b0330a24941419c0a99a10ecf8 Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 12:28:10 +0300 -Subject: [PATCH] quotacheck: change to the directory before opening it, not - after -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotacheck.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/quotacheck.c b/quotacheck.c -index a6fe432..1675de8 100644 ---- a/quotacheck.c -+++ b/quotacheck.c -@@ -508,10 +508,15 @@ static int scan_dir(const char *pathname) - add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode, - st.st_nlink, qspace, 0); - -- if ((dp = opendir(pathname)) == (DIR *) NULL) -- die(2, _("\nCan open directory %s: %s\n"), pathname, strerror(errno)); -+ if (chdir(pathname) == -1) { -+ errstr(_("Cannot chdir to %s: %s\n"), pathname, strerror(errno)); -+ goto out; -+ } -+ -+ if ((dp = opendir(".")) == (DIR *) NULL) -+ die(2, _("\nCannot open directory %s: %s\n"), -+ pathname, strerror(errno)); - -- chdir(pathname); - if (flags & FL_VERYVERBOSE) - blit(pathname); - while ((de = readdir(dp)) != (struct dirent *)NULL) { --- -2.9.4 - diff --git a/quota-4.03-quotacheck-fix-ask_yn-UB-when-fgets-returns-NULL.patch b/quota-4.03-quotacheck-fix-ask_yn-UB-when-fgets-returns-NULL.patch deleted file mode 100644 index 521dcd4..0000000 --- a/quota-4.03-quotacheck-fix-ask_yn-UB-when-fgets-returns-NULL.patch +++ /dev/null @@ -1,43 +0,0 @@ -From f1a97618031701ee9561e95ace4c7a52fd5dbd79 Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 12:28:26 +0300 -Subject: [PATCH] quotacheck: fix ask_yn UB when fgets returns NULL -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotacheck.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/quotacheck.c b/quotacheck.c -index 1675de8..689ceb9 100644 ---- a/quotacheck.c -+++ b/quotacheck.c -@@ -600,8 +600,7 @@ int ask_yn(char *q, int def) - - printf("%s [%c]: ", q, def ? 'y' : 'n'); - fflush(stdout); -- while (1) { -- fgets(a, sizeof(a)-1, stdin); -+ while (fgets(a, sizeof(a)-1, stdin)) { - if (a[0] == '\n') - return def; - if (!strcasecmp(a, "y\n")) -@@ -611,6 +610,7 @@ int ask_yn(char *q, int def) - printf("Illegal answer. Please answer y/n: "); - fflush(stdout); - } -+ return def; - } - - /* Do checks and buffer quota file into memory */ --- -2.9.4 - diff --git a/quota-4.03-quotaops-check-return-code-of-fgets-calls.patch b/quota-4.03-quotaops-check-return-code-of-fgets-calls.patch deleted file mode 100644 index c6be882..0000000 --- a/quota-4.03-quotaops-check-return-code-of-fgets-calls.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a431ffcc27b364b7cc2b280ad33873e0157e7e99 Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 12:29:50 +0300 -Subject: [PATCH] quotaops: check return code of fgets calls -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -fgets can return NULL anytime, do not ignore it. - -Signed-off-by: Dmitry V. Levin -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotaops.c | 28 ++++++++++++++++++++-------- - 1 file changed, 20 insertions(+), 8 deletions(-) - -diff --git a/quotaops.c b/quotaops.c -index 5e6026e..6f245b7 100644 ---- a/quotaops.c -+++ b/quotaops.c -@@ -330,8 +330,12 @@ int readprivs(struct dquot *qlist, int infd) - /* - * Discard title lines, then read lines to process. - */ -- fgets(line, sizeof(line), fd); -- fgets(line, sizeof(line), fd); -+ if (!fgets(line, sizeof(line), fd) || -+ !fgets(line, sizeof(line), fd)) { -+ errstr(_("Bad format: two title lines assumed\n")); -+ fclose(fd); -+ return -1; -+ } - - while (fgets(line, sizeof(line), fd)) { - cnt = sscanf(line, "%s %s %s %s %s %s %s", -@@ -481,9 +485,13 @@ int readindividualtimes(struct dquot *qlist, int infd) - /* - * Discard title lines, then read lines to process. - */ -- fgets(line, sizeof(line), fd); -- fgets(line, sizeof(line), fd); -- fgets(line, sizeof(line), fd); -+ if (!fgets(line, sizeof(line), fd) || -+ !fgets(line, sizeof(line), fd) || -+ !fgets(line, sizeof(line), fd)) { -+ errstr(_("Bad format: three title lines assumed\n")); -+ fclose(fd); -+ return -1; -+ } - - time(&now); - while (fgets(line, sizeof(line), fd)) { -@@ -583,9 +591,13 @@ int readtimes(struct quota_handle **handles, int infd) - /* - * Discard three title lines, then read lines to process. - */ -- fgets(line, sizeof(line), fd); -- fgets(line, sizeof(line), fd); -- fgets(line, sizeof(line), fd); -+ if (!fgets(line, sizeof(line), fd) || -+ !fgets(line, sizeof(line), fd) || -+ !fgets(line, sizeof(line), fd)) { -+ errstr(_("Bad format: three title lines assumed\n")); -+ fclose(fd); -+ return -1; -+ } - - while (fgets(line, sizeof(line), fd)) { - cnt = sscanf(line, "%s %d %s %d %s", fsp, &btime, bunits, &itime, iunits); --- -2.9.4 - diff --git a/quota-4.03-quotaops-check-return-code-of-ftruncate-and-lseek-ca.patch b/quota-4.03-quotaops-check-return-code-of-ftruncate-and-lseek-ca.patch deleted file mode 100644 index 6980c0e..0000000 --- a/quota-4.03-quotaops-check-return-code-of-ftruncate-and-lseek-ca.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 251c3931fedc9275bd57bc75c2153674a540bbce Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 17:19:25 +0300 -Subject: [PATCH] quotaops: check return code of ftruncate and lseek calls -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotaops.c | 53 +++++++++++++++++++++++++++++------------------------ - 1 file changed, 29 insertions(+), 24 deletions(-) - -diff --git a/quotaops.c b/quotaops.c -index 6f245b7..81d7be0 100644 ---- a/quotaops.c -+++ b/quotaops.c -@@ -252,6 +252,28 @@ int editprivs(char *tmpfile) - } - - /* -+ * Duplicate a file descriptor, resetting the file offset. -+ * If it's a write descriptor, also truncate the file. -+ */ -+static FILE *dup_file(int fd, int is_write) -+{ -+ FILE *fp; -+ -+ if (is_write && ftruncate(fd, 0)) -+ die(1, _("Cannot truncate a file: %s\n"), strerror(errno)); -+ if (lseek(fd, 0, SEEK_SET)) -+ die(1, _("Cannot reset a file offset: %s\n"), strerror(errno)); -+ if ((fd = dup(fd)) < 0) -+ die(1, _("Cannot duplicate a file descriptor: %s\n"), strerror(errno)); -+ if (!(fp = fdopen(fd, is_write ? "w" : "r"))) -+ die(1, is_write ? _("Cannot open a stream to write to: %s\n") -+ : _("Cannot open a stream to read from: %s\n"), -+ strerror(errno)); -+ -+ return fp; -+} -+ -+/* - * Convert a dquot list to an ASCII file. - */ - int writeprivs(struct dquot *qlist, int outfd, char *name, int quotatype) -@@ -259,10 +281,7 @@ int writeprivs(struct dquot *qlist, int outfd, char *name, int quotatype) - struct dquot *q; - FILE *fd; - -- ftruncate(outfd, 0); -- lseek(outfd, 0, SEEK_SET); -- if (!(fd = fdopen(dup(outfd), "w"))) -- die(1, _("Cannot duplicate descriptor of file to write to: %s\n"), strerror(errno)); -+ fd = dup_file(outfd, 1); - - fprintf(fd, _("Disk quotas for %s %s (%cid %d):\n"), - _(type2name(quotatype)), name, *type2name(quotatype), qlist->dq_id); -@@ -323,9 +342,7 @@ int readprivs(struct dquot *qlist, int infd) - char inodesstring[BUFSIZ], isoftstring[BUFSIZ], ihardstring[BUFSIZ]; - const char *error; - -- lseek(infd, 0, SEEK_SET); -- if (!(fd = fdopen(dup(infd), "r"))) -- die(1, _("Cannot duplicate descriptor of temp file: %s\n"), strerror(errno)); -+ fd = dup_file(infd, 0); - - /* - * Discard title lines, then read lines to process. -@@ -435,10 +452,7 @@ int writeindividualtimes(struct dquot *qlist, int outfd, char *name, int quotaty - time_t now; - char btimestr[MAXTIMELEN], itimestr[MAXTIMELEN]; - -- ftruncate(outfd, 0); -- lseek(outfd, 0, SEEK_SET); -- if (!(fd = fdopen(dup(outfd), "w"))) -- die(1, _("Cannot duplicate descriptor of file to write to: %s\n"), strerror(errno)); -+ fd = dup_file(outfd, 1); - - fprintf(fd, _("Times to enforce softlimit for %s %s (%cid %d):\n"), - _(type2name(quotatype)), name, *type2name(quotatype), qlist->dq_id); -@@ -478,9 +492,7 @@ int readindividualtimes(struct dquot *qlist, int infd) - char iunits[BUFSIZ], bunits[BUFSIZ]; - time_t now, bseconds, iseconds; - -- lseek(infd, 0, SEEK_SET); -- if (!(fd = fdopen(dup(infd), "r"))) -- die(1, _("Cannot duplicate descriptor of temp file: %s\n"), strerror(errno)); -+ fd = dup_file(infd, 0); - - /* - * Discard title lines, then read lines to process. -@@ -543,10 +555,7 @@ int writetimes(struct quota_handle **handles, int outfd) - if (!handles[0]) - return 0; - -- ftruncate(outfd, 0); -- lseek(outfd, 0, SEEK_SET); -- if ((fd = fdopen(dup(outfd), "w")) == NULL) -- die(1, _("Cannot duplicate descriptor of file to edit: %s\n"), strerror(errno)); -+ fd = dup_file(outfd, 1); - - fprintf(fd, _("Grace period before enforcing soft limits for %ss:\n"), - _(type2name(handles[0]->qh_type))); -@@ -575,12 +584,8 @@ int readtimes(struct quota_handle **handles, int infd) - - if (!handles[0]) - return 0; -- lseek(infd, 0, SEEK_SET); -- if (!(fd = fdopen(dup(infd), "r"))) { -- errstr(_("Cannot reopen temp file: %s\n"), -- strerror(errno)); -- return -1; -- } -+ -+ fd = dup_file(infd, 0); - - /* Set all grace times to default values */ - for (i = 0; handles[i]; i++) { --- -2.9.4 - diff --git a/quota-4.03-quotaops-check-setgid-setuid-return-code.patch b/quota-4.03-quotaops-check-setgid-setuid-return-code.patch deleted file mode 100644 index 02710df..0000000 --- a/quota-4.03-quotaops-check-setgid-setuid-return-code.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 9aa3a11857109297b521d0a8926dd90361b991ed Mon Sep 17 00:00:00 2001 -From: "Dmitry V. Levin" -Date: Thu, 18 May 2017 12:28:51 +0300 -Subject: [PATCH] quotaops: check setgid/setuid return code -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -setgid/setuid syscalls may fail for different reasons, -do not ignore these errors. - -Signed-off-by: Dmitry V. Levin -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - quotaops.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/quotaops.c b/quotaops.c -index 56cf622..5e6026e 100644 ---- a/quotaops.c -+++ b/quotaops.c -@@ -218,8 +218,10 @@ int editprivs(char *tmpfile) - int i; - - sigprocmask(SIG_SETMASK, &omask, NULL); -- setgid(getgid()); -- setuid(getuid()); -+ if (setgid(getgid())) -+ die(1, _("%s failed: %s\n"), "setgid", strerror(errno)); -+ if (setuid(getuid())) -+ die(1, _("%s failed: %s\n"), "setuid", strerror(errno)); - if (!(ed = getenv("VISUAL"))) - if (!(ed = getenv("EDITOR"))) - ed = _PATH_VI; --- -2.9.4 - diff --git a/quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch b/quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch deleted file mode 100644 index aece8b5..0000000 --- a/quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7e2dc84c72231bb78a5999a6ccd1da632f09fc1f Mon Sep 17 00:00:00 2001 -From: Theodore Ts'o -Date: Mon, 4 Apr 2016 00:35:40 -0400 -Subject: [PATCH] repquota: use the same whitespace for quotaio_meta as - quotaio_v2 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 -Signed-off-by: Jan Kara -Signed-off-by: Petr Písař ---- - repquota.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/repquota.c b/repquota.c -index 957dc8d..ea79fc8 100644 ---- a/repquota.c -+++ b/repquota.c -@@ -400,9 +400,10 @@ static void report_it(struct quota_handle *h, int type) - if (h->qh_ops->scan_dquots(h, output) < 0) - return; - dump_cached_dquots(type); -- if (h->qh_ops->report && ofmt == QOF_DEFAULT) { -+ if (ofmt == QOF_DEFAULT) { - putchar('\n'); -- h->qh_ops->report(h, flags & FL_VERBOSE); -+ if (h->qh_ops->report) -+ h->qh_ops->report(h, flags & FL_VERBOSE); - putchar('\n'); - } - if (ofmt == QOF_XML) --- -2.5.5 - diff --git a/quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch b/quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch new file mode 100644 index 0000000..a35bf5f --- /dev/null +++ b/quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch @@ -0,0 +1,44 @@ +From b5ed9878d60bf2c6764ce8e1de4f69e64c4bdfaf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 6 Sep 2017 16:25:09 +0200 +Subject: [PATCH] Install rquota(3) only if RPC is enabled +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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ř +--- + Makefile.am | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 8d80bee..9b852d2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -27,7 +27,6 @@ man_MANS = \ + quota.1 \ + quot.8 \ + repquota.8 \ +- rquota.3 \ + setquota.8 \ + warnquota.conf.5 \ + warnquota.8 \ +@@ -69,7 +68,10 @@ librpcclient_a_CFLAGS = -Wno-unused + RPCLIBS = librpcclient.a + BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c + CLEANFILES = rquota.c rquota.h rquota_clnt.c +-man_MANS += rpc.rquotad.8 ++man_MANS += \ ++ rpc.rquotad.8 \ ++ rquota.3 ++ + endif + + libquota_a_SOURCES = \ +-- +2.13.5 + diff --git a/quota-4.03-warnquota-configuration-tunes.patch b/quota-4.04-warnquota-configuration-tunes.patch similarity index 89% rename from quota-4.03-warnquota-configuration-tunes.patch rename to quota-4.04-warnquota-configuration-tunes.patch index 2c189b6..9030e2e 100644 --- a/quota-4.03-warnquota-configuration-tunes.patch +++ b/quota-4.04-warnquota-configuration-tunes.patch @@ -1,4 +1,4 @@ -From 7b44aa5bd3a10f2073c96ffc1eb0d2dce45585ab Mon Sep 17 00:00:00 2001 +From 67a0dbf6434552e720b0d311597553b3a76f779e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 23 Aug 2011 13:45:15 +0200 Subject: [PATCH] warnquota configuration tunes @@ -17,15 +17,15 @@ Signed-off-by: Petr Písař 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/warnquota.c b/warnquota.c -index 3734f0e..ff626b5 100644 +index 0d911e4..2c8e084 100644 --- a/warnquota.c +++ b/warnquota.c -@@ -821,7 +821,7 @@ static int readconfigfile(const char *filename, struct configparams *config) - verify_format(config->group_signature, "GROUP_SIGNATURE"); +@@ -837,7 +837,7 @@ cc_parse_err: } + #ifdef USE_LDAP_MAIL_LOOKUP else if (!strcmp(var, "LDAP_MAIL")) { - if(strcasecmp(value, "true") == 0) -+ if(strncasecmp(value, "true", 4) == 0) ++ if(strncasecmp(value, "true", 4) == 0) config->use_ldap_mail = 1; else config->use_ldap_mail = 0; @@ -72,5 +72,5 @@ index b06f81f..7e00947 100644 GROUP_MESSAGE = Hello,|\ your group %i is using too much disk space at %h.|\ -- -2.5.0 +2.13.5 diff --git a/quota.spec b/quota.spec index 7d01dff..565d91e 100644 --- a/quota.spec +++ b/quota.spec @@ -1,14 +1,17 @@ # Use netlink to monitor quota usage and warn interractive users %bcond_without quota_enables_netlink +# Enable getting quotas over remotely +%bcond_without quota_enables_rpc # Allow setting quota remotely %bcond_without quota_enables_rpcsetquota +# Add TCP Wrappers guard to RCP quota daemon +%bcond_without quota_enables_tcpwrappers -Name: quota -Epoch: 1 -Version: 4.03 -Release: 12%{?dist} -Group: System Environment/Base -Summary: System administration tools for monitoring users' disk usage +Name: quota +Epoch: 1 +Version: 4.04 +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, quotaops.c, quot.c, quotaon.c, edquota.c, quot.h, quota.c, @@ -16,15 +19,27 @@ Summary: System administration tools for monitoring users' disk usage # COPYING: GPLv2 text and license declaration ## Only in quota-rpc and quota-nls binary package # svc_socket.c copied from glibc: LGPLv2+ +## Only in quota-nls binary package +# po/cs.po: GPLv2+ ## Not involved in the binary package -# m4/iconv.m4: GPL+ with exception -# ar-lib: GPLv2 with exception -# missing: GPLv2+ with exception -# config.guess: GPLv3+ with exception -# config.rpath: LGPLv2+ -# install-sh: MIT -# configure: FSFUL # aclocal.m4: FSFULLR and (GPLv2+ with exception) +# ar-lib: GPLv2 with exception +# depcomp: GPLv2+ with exception +# config.guess: GPLv3+ with exception +# config.rpath: GPLv2+ with exception +# config.sub: GPLv3+ with exception +# configure: FSFUL +# install-sh: MIT +# m4/gettext.m4: GPL with exception +# m4/iconv.m4: GPL with exception +# m4/lib-ld.m4: GPL with exception +# m4/lib-link.m4: GPL with exception +# m4/lib-prefix.m4: GPL with exception +# m4/nls.m4: GPL with exception +# m4/po.m4: GPL with exception +# m4/progtest.m4: GPL with exception +# Makefile.in: FSFULLR +# missing: GPLv2+ with exception # mkinstalldirs: Public Domain License: BSD and GPLv2 and GPLv2+ URL: http://sourceforge.net/projects/linuxquota/ @@ -33,74 +48,37 @@ Source1: quota_nld.service Source2: quota_nld.sysconfig Source3: rpc-rquotad.service Source4: rpc-rquotad.sysconfig -# LDAP scripts forgotten in 4.03, taken from upstream git -# 861154efb90ed049e0473cc36935b8d03c78a869, fixed in upstream after 4.03 -Source5: ldap-scripts.tar.gz # Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa) -Patch0: quota-4.03-warnquota-configuration-tunes.patch -Patch1: quota-4.03-Build-rpc.rquotad-as-PIE.patch -Patch2: quota-4.03-Validate-upper-bound-of-RPC-port.patch -# Fix build script to work with hardended flags, submitted to upstream -# -Patch3: quota-4.03-Respect-enviroment-CFLAGS.patch -# Work around Autoconf bug not to link ldap library to everything, -# bug #1296455, reported to upstream -# -Patch4: quota-4.03-Work-around-an-AC_CHECK_LIB-bug-in-Autoconf.patch -# Query kernel for next quota on file system with hiden quota files, -# bug #1306195, in upstream after 4.03 -Patch5: quota-4.03-Scan-dquots-using-Q_GETNEXTQUOTA.patch -# Query kernel for next XFS quota, bug #1306195, in upstream after 4.03 -Patch6: quota-4.03-Add-support-for-scanning-using-Q_XGETNEXTQUOTA.patch -# Correct repquota indentation for file systems with hiden quota files, -# in upstream after 4.03 -Patch7: quota-4.03-repquota-use-the-same-whitespace-for-quotaio_meta-as.patch -# Fix checking a block read error, in upstream after 4.03, -# -Patch8: quota-4.03-quotacheck-Fix-buggy-error-check-of-read-2.patch -# Use direct scanning also for ext4, in upsream after 4.03 -Patch9: quota-4.03-quotacheck-Use-direct-scanning-also-for-ext4.patch -# Fix disabling disabled features, in upstream after 4.03 -Patch10: quota-4.03-Print-explicitely-disabled-options-properly.patch -# Do not install quota_nld.8 when netlink support is disabled, -# in upstream after 4.03 -Patch11: quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch -# Fix a race between checking for and opening a directory to be scanned, -# in upstream after 4.03 -Patch12: quota-4.03-quotacheck-change-to-the-directory-before-opening-it.patch -# Fix an undefined behavior on parsing yes-no answer, in upstream after 4.03 -Patch13: quota-4.03-quotacheck-fix-ask_yn-UB-when-fgets-returns-NULL.patch -# Check for setuid and setgid calls failure in edquota tool, -# in upstream after 4.03 -Patch14: quota-4.03-quotaops-check-setgid-setuid-return-code.patch -# Check for failures when reading edquota input, in upstream after 4.03 -Patch15: quota-4.03-quotaops-check-return-code-of-fgets-calls.patch -# Check for failures when duplicating a file handle, in upstream after 4.03 -Patch16: quota-4.03-quotaops-check-return-code-of-ftruncate-and-lseek-ca.patch -# Fix memory leaks when running quotacheck on ext file systems, bug #1483543, -# -Patch17: quota-4.03-quotacheck-Deallocate-memory-after-direct-scanning.patch -BuildRequires: autoconf -BuildRequires: automake -BuildRequires: bash -BuildRequires: coreutils -BuildRequires: e2fsprogs-devel -BuildRequires: gcc -BuildRequires: gettext-devel -# glibc-common for rpcgen tool -BuildRequires: glibc-common -BuildRequires: make -BuildRequires: openldap-devel +Patch0: quota-4.04-warnquota-configuration-tunes.patch +Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch +# Install rquotad(3) only if RPC is enabled, +# +Patch2: quota-4.04-Install-rquota-3-only-if-RPC-is-enabled.patch +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: bash +BuildRequires: coreutils +BuildRequires: e2fsprogs-devel +BuildRequires: gcc +BuildRequires: gettext-devel +BuildRequires: make +BuildRequires: openldap-devel %if %{with quota_enables_netlink} -BuildRequires: pkgconfig(dbus-1) -BuildRequires: pkgconfig(libnl-3.0) >= 3.1 -BuildRequires: pkgconfig(libnl-genl-3.0) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: pkgconfig(libnl-3.0) >= 3.1 +BuildRequires: pkgconfig(libnl-genl-3.0) %endif -BuildRequires: systemd -BuildRequires: tcp_wrappers-devel -Requires: tcp_wrappers -Requires: quota-nls = %{epoch}:%{version}-%{release} -Conflicts: kernel < 2.4 +%if %{with quota_enables_rpc} +# glibc-common for rpcgen tool +BuildRequires: glibc-common +BuildRequires: pkgconfig(libtirpc) +BuildRequires: systemd +%if %{with quota_enables_tcpwrappers} +BuildRequires: tcp_wrappers-devel +%endif +%endif +Requires: quota-nls = %{epoch}:%{version}-%{release} +Conflicts: kernel < 2.4 %description The quota package contains system administration tools for monitoring @@ -109,12 +87,11 @@ and limiting user and or group disk usage per file system. %if %{with quota_enables_netlink} %package nld -Group: System Environment/Daemons -Summary: quota_nld daemon -Requires: quota-nls = %{epoch}:%{version}-%{release} -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd +Summary: quota_nld daemon +Requires: quota-nls = %{epoch}:%{version}-%{release} +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd %description nld Daemon that listens on netlink socket and processes received quota warnings. @@ -125,27 +102,30 @@ a dialog) and writing them to the terminal user has last accessed. %endif +%if %{with quota_enables_rpc} %package rpc -Group: System Environment/Daemons -Summary: RPC quota daemon -License: BSD and LGPLv2+ and GPLv2 and GPLv2+ -Requires: quota-nls = %{epoch}:%{version}-%{release} -Requires: rpcbind -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -Conflicts: quota < 1:4.02-3 +Summary: RPC quota daemon +License: BSD and LGPLv2+ and GPLv2 and GPLv2+ +Requires: quota-nls = %{epoch}:%{version}-%{release} +Requires: rpcbind +%if %{with quota_enables_tcpwrappers} +Requires: tcp_wrappers +%endif +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +Conflicts: quota < 1:4.02-3 %description rpc The RPC daemon allows to query and set disk quotas over network. If you run the daemon on NFS server, you could use quota tools to manage the quotas from NFS client. +%endif %package warnquota -Group: System Environment/Base -Summary: Send e-mail to users over quota -Requires: quota-nls = %{epoch}:%{version}-%{release} +Summary: Send e-mail to users over quota +Requires: quota-nls = %{epoch}:%{version}-%{release} %description warnquota Utility that checks disk quota for each local file system and mails a warning @@ -154,33 +134,32 @@ via cron(8). %package nls -Group: System Environment/Base -Summary: Gettext catalogs for disk quota tools -License: BSD and LGPLv2+ and GPLv2 and GPLv2+ -BuildArch: noarch +Summary: Gettext catalogs for disk quota tools +License: BSD and LGPLv2+ and GPLv2 and GPLv2+ +BuildArch: noarch %description nls Disk quota tools messages translated into different natural languages. +%if %{with quota_enables_rpc} %package devel -Group: Development/Libraries -Summary: Development files for quota RPC -License: GPLv2 +Summary: Development files for quota RPC +License: GPLv2 # Do not run-require main package, the header files define RPC API to be # implemented by the developer, not an API for an existing quota library. %description devel This package contains development header files for implementing disk quotas on remote machines. +%endif %package doc -Group: Documentation -Summary: Additional documentation for disk quotas -Requires: quota = %{epoch}:%{version}-%{release} -BuildArch: noarch -AutoReq: 0 +Summary: Additional documentation for disk quotas +Requires: quota = %{epoch}:%{version}-%{release} +BuildArch: noarch +AutoReq: 0 %description doc This package contains additional documentation for disk quotas concept in @@ -190,28 +169,9 @@ Linux/UNIX environment. %prep %setup -q %patch0 -p1 -%ifnarch ppc ppc64 %patch1 -p1 -%endif %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 -# Unpack forgotten LDAP scripts -tar -xzkf %{SOURCE5} -# Regenerate build scripts, also because of Respect-enviroment-CFLAGS.patch +# Regenerate build scripts autoreconf -f -i %build @@ -220,7 +180,11 @@ autoreconf -f -i --enable-bsd-behaviour \ --enable-ext2direct=yes \ --enable-ldapmail=yes \ +%if %{with quota_enables_tcpwrappers} --enable-libwrap=yes \ +%else + --disable-libwrap \ +%endif %if %{with quota_enables_netlink} --enable-netlink=yes \ %else @@ -228,7 +192,11 @@ autoreconf -f -i %endif --enable-nls \ --disable-rpath \ +%if %{with quota_enables_rpc} --enable-rpc=yes \ +%else + --disable-rpc \ +%endif %if %{with quota_enables_rpcsetquota} --enable-rpcsetquota=yes \ %else @@ -248,9 +216,11 @@ install -p -m644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/quota_nld.service install -p -m644 -D %{SOURCE2} \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/quota_nld %endif +%if %{with quota_enables_rpc} install -p -m644 -D %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/rpc-rquotad.service install -p -m644 -D %{SOURCE4} \ $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/rpc-rquotad +%endif %find_lang %{name} @@ -271,6 +241,7 @@ make check %endif +%if %{with quota_enables_rpc} %post rpc %systemd_post rpc-rquotad.service @@ -279,18 +250,23 @@ make check %postun rpc %systemd_postun_with_restart rpc-rquotad.service +%endif %files %{_bindir}/* %{_sbindir}/* %exclude %{_sbindir}/quota_nld +%if %{with quota_enables_rpc} %exclude %{_sbindir}/rpc.rquotad +%endif %exclude %{_sbindir}/warnquota %{_mandir}/man1/* %{_mandir}/man8/* %exclude %{_mandir}/man8/quota_nld.8* +%if %{with quota_enables_rpc} %exclude %{_mandir}/man8/rpc.rquotad.8* +%endif %exclude %{_mandir}/man8/warnquota.8* %doc Changelog @@ -303,12 +279,14 @@ make check %doc Changelog %endif +%if %{with quota_enables_rpc} %files rpc %config(noreplace) %{_sysconfdir}/sysconfig/rpc-rquotad %{_unitdir}/rpc-rquotad.service %{_sbindir}/rpc.rquotad %{_mandir}/man8/rpc.rquotad.8* %doc Changelog +%endif %files warnquota %config(noreplace) %{_sysconfdir}/quotagrpadmins @@ -324,17 +302,22 @@ make check %license COPYING %doc Changelog +%if %{with quota_enables_rpc} %files devel %license COPYING %dir %{_includedir}/rpcsvc %{_includedir}/rpcsvc/* %{_mandir}/man3/* +%endif %files doc %doc doc/* ldap-scripts %changelog +* Wed Sep 06 2017 Petr Pisar - 1:4.04-1 +- 4.04 bump + * Mon Aug 28 2017 Petr Pisar - 1:4.03-12 - Fix memory leaks when running quotacheck on ext file systems (bug #1483543) diff --git a/sources b/sources index 744bf20..355ae1c 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -95b900db79931806bc6dc9f89c615a1b ldap-scripts.tar.gz -6b09f9c93515c25a528be5754cdfb6f5 quota-4.03.tar.gz +SHA512 (quota-4.04.tar.gz) = adc33863d2a966b4c46983fa3926e6b6ba75e260ed21bdff646584237840e6beb0dcfbfd2f655969aa5675c3c398ac2e483afb933f03f983756ebb3352d0eaad