Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/relay-ctrl/files/, net-mail/relay-ctrl/
Date: Sun, 31 May 2020 04:58:34
Message-Id: 1590900412.160ea25bdf79c86107ac0659146db4e76c4b5166.robbat2@gentoo
1 commit: 160ea25bdf79c86107ac0659146db4e76c4b5166
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 31 04:41:34 2020 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 04:46:52 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=160ea25b
7
8 net-mail/relay-ctrl: fix grsec RLIMIT_NOFILE overstep
9
10 Closes: https://bugs.gentoo.org/348203
11 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
12
13 .../files/relay-ctrl-3.1.1-NOFILE-overstep.patch | 25 ++++++++++++++++++++++
14 net-mail/relay-ctrl/relay-ctrl-3.1.1-r3.ebuild | 1 +
15 2 files changed, 26 insertions(+)
16
17 diff --git a/net-mail/relay-ctrl/files/relay-ctrl-3.1.1-NOFILE-overstep.patch b/net-mail/relay-ctrl/files/relay-ctrl-3.1.1-NOFILE-overstep.patch
18 new file mode 100644
19 index 00000000000..3bcd54c1f94
20 --- /dev/null
21 +++ b/net-mail/relay-ctrl/files/relay-ctrl-3.1.1-NOFILE-overstep.patch
22 @@ -0,0 +1,25 @@
23 +--- relay-ctrl-3.1.1/relay-ctrl-chdir.c 2002-04-26 18:07:38.000000000 +0200
24 ++++ relay-ctrl-3.1.1-patch/relay-ctrl-chdir.c 2010-12-08 20:49:15.449915704 +0100
25 +@@ -2,6 +2,7 @@
26 + #include <fcntl.h>
27 + #include <stdlib.h>
28 + #include <sys/stat.h>
29 ++#include <sys/resource.h>
30 + #include <unistd.h>
31 + #include "misc/misc.h"
32 + #include "msg/msg.h"
33 +@@ -14,9 +15,12 @@
34 + static int move_high(int fd)
35 + {
36 + struct stat s;
37 ++ struct rlimit rl;
38 + int newfd;
39 +-
40 +- for (newfd = fd + 1;; ++newfd) {
41 ++
42 ++ getrlimit(RLIMIT_NOFILE, &rl);
43 ++
44 ++ for (newfd = fd + 1; newfd < rl.rlim_cur; ++newfd) {
45 + if (fstat(newfd, &s) != -1) continue;
46 + if (dup2(fd, newfd) == -1) break;
47 + close(fd);
48
49 diff --git a/net-mail/relay-ctrl/relay-ctrl-3.1.1-r3.ebuild b/net-mail/relay-ctrl/relay-ctrl-3.1.1-r3.ebuild
50 index 88c8668e862..9e71696f848 100644
51 --- a/net-mail/relay-ctrl/relay-ctrl-3.1.1-r3.ebuild
52 +++ b/net-mail/relay-ctrl/relay-ctrl-3.1.1-r3.ebuild
53 @@ -28,6 +28,7 @@ src_prepare() {
54 eapply_user
55 ht_fix_file "${S}"/Makefile
56 eapply "${FILESDIR}"/authenticated.c-relayfixup.diff
57 + eapply "${FILESDIR}"/relay-ctrl-3.1.1-NOFILE-overstep.patch
58 }
59
60 src_configure() {