summaryrefslogtreecommitdiff
path: root/source3/winbindd/winbindd_dual.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-04-28 13:26:57 +0200
committerVolker Lendecke <vl@samba.org>2011-04-29 16:57:36 +0200
commit0757688eb34ec1a22bf8c28f72416d6684756647 (patch)
tree4b8d8b2338f72813bf59958acc4c69faffa5f9c8 /source3/winbindd/winbindd_dual.c
parent50883cfeb4eed3d538f71443060745f8747044c9 (diff)
downloadsamba-0757688eb34ec1a22bf8c28f72416d6684756647.tar.gz
samba-0757688eb34ec1a22bf8c28f72416d6684756647.tar.bz2
samba-0757688eb34ec1a22bf8c28f72416d6684756647.zip
s3: In winbind, close parent/child sockets
This should further reduce fd load in winbind children
Diffstat (limited to 'source3/winbindd/winbindd_dual.c')
-rw-r--r--source3/winbindd/winbindd_dual.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 04ef3d8051..47ab6c17b7 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1167,7 +1167,8 @@ static void child_msg_dump_event_list(struct messaging_context *msg,
dump_event_list(winbind_event_context());
}
-bool winbindd_reinit_after_fork(const char *logfilename)
+bool winbindd_reinit_after_fork(const struct winbindd_child *myself,
+ const char *logfilename)
{
struct winbindd_domain *domain;
struct winbindd_child *cl;
@@ -1242,6 +1243,14 @@ bool winbindd_reinit_after_fork(const char *logfilename)
* go through the parent.
*/
cl->pid = (pid_t)0;
+
+ /*
+ * Close service sockets to all other children
+ */
+ if ((cl != myself) && (cl->sock != -1)) {
+ close(cl->sock);
+ cl->sock = -1;
+ }
}
/*
* This is a little tricky, children must not
@@ -1325,7 +1334,7 @@ static bool fork_domain_child(struct winbindd_child *child)
state.sock = fdpair[0];
close(fdpair[1]);
- if (!winbindd_reinit_after_fork(child->logfilename)) {
+ if (!winbindd_reinit_after_fork(child, child->logfilename)) {
_exit(0);
}