|
|
91ef859 |
From 20c717c25c5d180b720bec6902475f07b02f8b87 Mon Sep 17 00:00:00 2001
|
|
|
91ef859 |
From: Jonathan G. Underwood <jonathan.underwood@gmail.com>
|
|
|
91ef859 |
Date: Sun, 3 Jan 2010 02:16:09 +0000
|
|
|
91ef859 |
Subject: [PATCH] Set socket file descriptor in AsyncServer.start to be CLOEXEC
|
|
|
91ef859 |
|
|
|
91ef859 |
https://bugzilla.redhat.com/show_bug.cgi?id=522767
|
|
|
91ef859 |
---
|
|
|
91ef859 |
server/asyncserver.py | 4 +++-
|
|
|
91ef859 |
1 files changed, 3 insertions(+), 1 deletions(-)
|
|
|
91ef859 |
|
|
|
91ef859 |
diff --git a/server/asyncserver.py b/server/asyncserver.py
|
|
|
91ef859 |
index 35cebf1..96b62d0 100644
|
|
|
91ef859 |
--- a/server/asyncserver.py
|
|
|
91ef859 |
+++ b/server/asyncserver.py
|
|
|
91ef859 |
@@ -26,7 +26,7 @@ __license__ = "GPL"
|
|
|
91ef859 |
|
|
|
91ef859 |
from pickle import dumps, loads, HIGHEST_PROTOCOL
|
|
|
91ef859 |
from common import helpers
|
|
|
91ef859 |
-import asyncore, asynchat, socket, os, logging, sys, traceback
|
|
|
91ef859 |
+import asyncore, asynchat, socket, os, logging, sys, traceback, fcntl
|
|
|
91ef859 |
|
|
|
91ef859 |
# Gets the instance of the logger.
|
|
|
91ef859 |
logSys = logging.getLogger("fail2ban.server")
|
|
|
91ef859 |
@@ -126,6 +126,8 @@ class AsyncServer(asyncore.dispatcher):
|
|
|
91ef859 |
raise AsyncServerException("Server already running")
|
|
|
91ef859 |
# Creates the socket.
|
|
|
91ef859 |
self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
|
91ef859 |
+ fd = self.fileno()
|
|
|
91ef859 |
+ fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC)
|
|
|
91ef859 |
self.set_reuse_addr()
|
|
|
91ef859 |
try:
|
|
|
91ef859 |
self.bind(sock)
|
|
|
91ef859 |
--
|
|
|
91ef859 |
1.6.5.2
|
|
|
91ef859 |
|