From fa50ab9f3d67e00f702bcb52f3f3b8997a9ffaf9 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Jul 04 2017 14:43:14 +0000 Subject: Check for setuid and setgid calls failure in edquota tool --- diff --git a/quota-4.03-quotaops-check-setgid-setuid-return-code.patch b/quota-4.03-quotaops-check-setgid-setuid-return-code.patch new file mode 100644 index 0000000..02710df --- /dev/null +++ b/quota-4.03-quotaops-check-setgid-setuid-return-code.patch @@ -0,0 +1,38 @@ +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.spec b/quota.spec index 07f45bd..1d3a2f9 100644 --- a/quota.spec +++ b/quota.spec @@ -59,6 +59,9 @@ Patch8: quota-4.03-Do-not-install-quota_nld.8-when-quota_nld-is-not-ins.patch Patch9: 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 Patch10: 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 +Patch11: quota-4.03-quotaops-check-setgid-setuid-return-code.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -176,6 +179,7 @@ Linux/UNIX environment. %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 # Unpack forgotten LDAP scripts tar -xzkf %{SOURCE5} # Regenerate build scripts, also because of Respect-enviroment-CFLAGS.patch @@ -292,6 +296,7 @@ make check - Fix disabling features at build time - Fix a race between checking for and opening a directory to be scanned - Fix an undefined behavior on parsing yes-no answer +- Check for setuid and setgid calls failure in edquota tool * Thu Nov 10 2016 Petr Pisar - 1:4.03-4 - Fix checking a block read error (upstream bug #123)