WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Set the close-on-exec flag on the RPC soc

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Set the close-on-exec flag on the RPC socket in tool stack.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Aug 2006 20:30:27 +0000
Delivery-date: Tue, 15 Aug 2006 13:34:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 5db6984e4503a6ddf2cb0db58c5af189d70f1f78
# Parent  fdc4531aefe06f7092e6c2113be76cbefaf77bf2
Set the close-on-exec flag on the RPC socket in tool stack.
Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tools/python/xen/util/xmlrpclib2.py |   12 ++++++++++++
 tools/python/xen/web/httpserver.py  |    7 +++++++
 2 files changed, 19 insertions(+)

diff -r fdc4531aefe0 -r 5db6984e4503 tools/python/xen/util/xmlrpclib2.py
--- a/tools/python/xen/util/xmlrpclib2.py       Tue Aug 15 16:25:39 2006 +0100
+++ b/tools/python/xen/util/xmlrpclib2.py       Tue Aug 15 16:26:39 2006 +0100
@@ -22,6 +22,7 @@ An enhanced XML-RPC client/server interf
 
 import string
 import types
+import fcntl
 
 from httplib import HTTPConnection, HTTP
 from xmlrpclib import Transport
@@ -136,6 +137,17 @@ class TCPXMLRPCServer(SocketServer.Threa
                  logRequests=1):
         SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests)
 
+        flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
+        flags |= fcntl.FD_CLOEXEC
+        fcntl.fcntl(self.fileno(), fcntl.F_SETFD, flags)
+
+    def get_request(self):
+        (client, addr) = SimpleXMLRPCServer.get_request(self)
+        flags = fcntl.fcntl(client.fileno(), fcntl.F_GETFD)
+        flags |= fcntl.FD_CLOEXEC
+        fcntl.fcntl(client.fileno(), fcntl.F_SETFD, flags)
+        return (client, addr)
+                                                                               
 
     def _marshaled_dispatch(self, data, dispatch_method = None):
         params, method = xmlrpclib.loads(data)
         if False:
diff -r fdc4531aefe0 -r 5db6984e4503 tools/python/xen/web/httpserver.py
--- a/tools/python/xen/web/httpserver.py        Tue Aug 15 16:25:39 2006 +0100
+++ b/tools/python/xen/web/httpserver.py        Tue Aug 15 16:26:39 2006 +0100
@@ -24,6 +24,7 @@ from urllib import quote, unquote
 from urllib import quote, unquote
 import os
 import os.path
+import fcntl
 
 from xen.xend import sxp
 from xen.xend.Args import ArgError
@@ -294,6 +295,9 @@ class HttpServer:
 
     def bind(self):
         self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        flags = fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)
+        flags |= fcntl.FD_CLOEXEC
+        fcntl.fcntl(self.socket.fileno(), fcntl.F_SETFD, flags)
         self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
         self.socket.bind((self.interface, self.port))
 
@@ -338,3 +342,6 @@ class UnixHttpServer(HttpServer):
         
     def bind(self):
         self.socket = unix.bind(self.path)
+        flags = fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)
+        flags |= fcntl.FD_CLOEXEC
+        fcntl.fcntl(self.socket.fileno(), fcntl.F_SETFD, flags)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Set the close-on-exec flag on the RPC socket in tool stack., Xen patchbot-unstable <=