|
|
905b4d |
From 3ec755f9b2db95fa05cd38ca32a0dddb255014f8 Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
Date: Wed, 7 Jan 2015 10:42:09 +0100
|
|
|
905b4d |
Subject: [PATCH 155/160] GPO: Don't use stdout for output in gpo_child
|
|
|
905b4d |
|
|
|
905b4d |
Resolves:
|
|
|
905b4d |
https://fedorahosted.org/sssd/ticket/2544
|
|
|
905b4d |
|
|
|
905b4d |
Use a dedicated fd instead to work around
|
|
|
905b4d |
https://bugzilla.samba.org/show_bug.cgi?id=11036
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Sumit Bose <sbose@redhat.com>
|
|
|
905b4d |
(cherry picked from commit f00a61b6079d8de81432077a59daf015d85800d2)
|
|
|
905b4d |
---
|
|
|
905b4d |
src/providers/ad/ad_gpo.c | 7 ++++---
|
|
|
905b4d |
src/providers/ad/ad_gpo.h | 4 ++++
|
|
|
905b4d |
src/providers/ad/ad_gpo_child.c | 7 ++++---
|
|
|
905b4d |
3 files changed, 12 insertions(+), 6 deletions(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
|
|
|
905b4d |
index 1ae62e7c4727702d5338258046e89e4b654904eb..083fc8c2cde36bb15d1a1becd3ddac383a4008fe 100644
|
|
|
905b4d |
--- a/src/providers/ad/ad_gpo.c
|
|
|
905b4d |
+++ b/src/providers/ad/ad_gpo.c
|
|
|
905b4d |
@@ -3961,9 +3961,10 @@ gpo_fork_child(struct tevent_req *req)
|
|
|
905b4d |
pid = fork();
|
|
|
905b4d |
|
|
|
905b4d |
if (pid == 0) { /* child */
|
|
|
905b4d |
- err = exec_child(state,
|
|
|
905b4d |
- pipefd_to_child, pipefd_from_child,
|
|
|
905b4d |
- GPO_CHILD, gpo_child_debug_fd);
|
|
|
905b4d |
+ err = exec_child_ex(state,
|
|
|
905b4d |
+ pipefd_to_child, pipefd_from_child,
|
|
|
905b4d |
+ GPO_CHILD, gpo_child_debug_fd, NULL,
|
|
|
905b4d |
+ STDIN_FILENO, AD_GPO_CHILD_OUT_FILENO);
|
|
|
905b4d |
DEBUG(SSSDBG_CRIT_FAILURE, "Could not exec gpo_child: [%d][%s].\n",
|
|
|
905b4d |
err, strerror(err));
|
|
|
905b4d |
return err;
|
|
|
905b4d |
diff --git a/src/providers/ad/ad_gpo.h b/src/providers/ad/ad_gpo.h
|
|
|
905b4d |
index 77051aadaed7858cce808b5c6c51f0be515d9800..9fd590a2b262b66c1efd493d8736774bdfa61b40 100644
|
|
|
905b4d |
--- a/src/providers/ad/ad_gpo.h
|
|
|
905b4d |
+++ b/src/providers/ad/ad_gpo.h
|
|
|
905b4d |
@@ -23,6 +23,10 @@
|
|
|
905b4d |
#ifndef AD_GPO_H_
|
|
|
905b4d |
#define AD_GPO_H_
|
|
|
905b4d |
|
|
|
905b4d |
+#include "providers/ad/ad_access.h"
|
|
|
905b4d |
+
|
|
|
905b4d |
+#define AD_GPO_CHILD_OUT_FILENO 3
|
|
|
905b4d |
+
|
|
|
905b4d |
/*
|
|
|
905b4d |
* This pair of functions provides client-side GPO processing.
|
|
|
905b4d |
*
|
|
|
905b4d |
diff --git a/src/providers/ad/ad_gpo_child.c b/src/providers/ad/ad_gpo_child.c
|
|
|
905b4d |
index c6eb52f06b1daadb083bd4c9efb299a12031d4d5..27f0db3ec2504e55886094a35cda1f536a7494ee 100644
|
|
|
905b4d |
--- a/src/providers/ad/ad_gpo_child.c
|
|
|
905b4d |
+++ b/src/providers/ad/ad_gpo_child.c
|
|
|
905b4d |
@@ -33,6 +33,7 @@
|
|
|
905b4d |
#include "util/util.h"
|
|
|
905b4d |
#include "util/child_common.h"
|
|
|
905b4d |
#include "providers/dp_backend.h"
|
|
|
905b4d |
+#include "providers/ad/ad_gpo.h"
|
|
|
905b4d |
#include "sss_cli.h"
|
|
|
905b4d |
|
|
|
905b4d |
#define SMB_BUFFER_SIZE 65536
|
|
|
905b4d |
@@ -778,7 +779,7 @@ main(int argc, const char *argv[])
|
|
|
905b4d |
|
|
|
905b4d |
errno = 0;
|
|
|
905b4d |
|
|
|
905b4d |
- written = sss_atomic_write_s(STDOUT_FILENO, resp->buf, resp->size);
|
|
|
905b4d |
+ written = sss_atomic_write_s(AD_GPO_CHILD_OUT_FILENO, resp->buf, resp->size);
|
|
|
905b4d |
if (written == -1) {
|
|
|
905b4d |
ret = errno;
|
|
|
905b4d |
DEBUG(SSSDBG_CRIT_FAILURE, "write failed [%d][%s].\n", ret,
|
|
|
905b4d |
@@ -793,13 +794,13 @@ main(int argc, const char *argv[])
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
DEBUG(SSSDBG_TRACE_FUNC, "gpo_child completed successfully\n");
|
|
|
905b4d |
- close(STDOUT_FILENO);
|
|
|
905b4d |
+ close(AD_GPO_CHILD_OUT_FILENO);
|
|
|
905b4d |
talloc_free(main_ctx);
|
|
|
905b4d |
return EXIT_SUCCESS;
|
|
|
905b4d |
|
|
|
905b4d |
fail:
|
|
|
905b4d |
DEBUG(SSSDBG_CRIT_FAILURE, "gpo_child failed!\n");
|
|
|
905b4d |
- close(STDOUT_FILENO);
|
|
|
905b4d |
+ close(AD_GPO_CHILD_OUT_FILENO);
|
|
|
905b4d |
talloc_free(main_ctx);
|
|
|
905b4d |
return EXIT_FAILURE;
|
|
|
905b4d |
}
|
|
|
905b4d |
--
|
|
|
905b4d |
2.1.0
|
|
|
905b4d |
|