mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-25 11:57:36 -08:00
net-mail/relay-ctrl: fix grsec RLIMIT_NOFILE overstep
Closes: https://bugs.gentoo.org/348203 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
--- relay-ctrl-3.1.1/relay-ctrl-chdir.c 2002-04-26 18:07:38.000000000 +0200
|
||||
+++ relay-ctrl-3.1.1-patch/relay-ctrl-chdir.c 2010-12-08 20:49:15.449915704 +0100
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
#include "misc/misc.h"
|
||||
#include "msg/msg.h"
|
||||
@@ -14,9 +15,12 @@
|
||||
static int move_high(int fd)
|
||||
{
|
||||
struct stat s;
|
||||
+ struct rlimit rl;
|
||||
int newfd;
|
||||
-
|
||||
- for (newfd = fd + 1;; ++newfd) {
|
||||
+
|
||||
+ getrlimit(RLIMIT_NOFILE, &rl);
|
||||
+
|
||||
+ for (newfd = fd + 1; newfd < rl.rlim_cur; ++newfd) {
|
||||
if (fstat(newfd, &s) != -1) continue;
|
||||
if (dup2(fd, newfd) == -1) break;
|
||||
close(fd);
|
||||
@@ -28,6 +28,7 @@ src_prepare() {
|
||||
eapply_user
|
||||
ht_fix_file "${S}"/Makefile
|
||||
eapply "${FILESDIR}"/authenticated.c-relayfixup.diff
|
||||
eapply "${FILESDIR}"/relay-ctrl-3.1.1-NOFILE-overstep.patch
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
|
||||
Reference in New Issue
Block a user