|
|
905b4d |
From 39087a3cbdadb2f61aee6f2f81e365f5e0e65fb0 Mon Sep 17 00:00:00 2001
|
|
|
905b4d |
From: Pavel Reichl <preichl@redhat.com>
|
|
|
905b4d |
Date: Fri, 24 Oct 2014 10:06:55 +0100
|
|
|
905b4d |
Subject: [PATCH 45/46] RESPONDERS: Don't hard-code umask value in utility
|
|
|
905b4d |
function
|
|
|
905b4d |
|
|
|
905b4d |
Resolves:
|
|
|
905b4d |
https://fedorahosted.org/sssd/ticket/2468
|
|
|
905b4d |
|
|
|
905b4d |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
905b4d |
(cherry picked from commit cbcb834028794a4c658a85965516113f8c0760c1)
|
|
|
905b4d |
---
|
|
|
905b4d |
src/responder/common/responder_common.c | 8 ++++----
|
|
|
905b4d |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
905b4d |
|
|
|
905b4d |
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
|
|
|
905b4d |
index 9a13c95d63d93df96ffceb51f969eb562c3a6b08..6646fa2587a8299de40eaef35830351136b8149a 100644
|
|
|
905b4d |
--- a/src/responder/common/responder_common.c
|
|
|
905b4d |
+++ b/src/responder/common/responder_common.c
|
|
|
905b4d |
@@ -587,6 +587,7 @@ static int sss_dp_init(struct resp_ctx *rctx,
|
|
|
905b4d |
int create_pipe_fd(const char *sock_name, int *_fd, mode_t umaskval)
|
|
|
905b4d |
{
|
|
|
905b4d |
struct sockaddr_un addr;
|
|
|
905b4d |
+ mode_t orig_umaskval;
|
|
|
905b4d |
errno_t ret;
|
|
|
905b4d |
int fd;
|
|
|
905b4d |
|
|
|
905b4d |
@@ -595,7 +596,7 @@ int create_pipe_fd(const char *sock_name, int *_fd, mode_t umaskval)
|
|
|
905b4d |
return EIO;
|
|
|
905b4d |
}
|
|
|
905b4d |
|
|
|
905b4d |
- umask(umaskval);
|
|
|
905b4d |
+ orig_umaskval = umask(umaskval);
|
|
|
905b4d |
|
|
|
905b4d |
ret = set_nonblocking(fd);
|
|
|
905b4d |
if (ret != EOK) {
|
|
|
905b4d |
@@ -636,9 +637,8 @@ int create_pipe_fd(const char *sock_name, int *_fd, mode_t umaskval)
|
|
|
905b4d |
ret = EOK;
|
|
|
905b4d |
|
|
|
905b4d |
done:
|
|
|
905b4d |
- /* we want default permissions on created files to be very strict,
|
|
|
905b4d |
- so set our umask to 0177 */
|
|
|
905b4d |
- umask(0177);
|
|
|
905b4d |
+ /* restore previous umask value */
|
|
|
905b4d |
+ umask(orig_umaskval);
|
|
|
905b4d |
if (ret == EOK) {
|
|
|
905b4d |
*_fd = fd;
|
|
|
905b4d |
} else {
|
|
|
905b4d |
--
|
|
|
905b4d |
1.9.3
|
|
|
905b4d |
|