From 1a39666a0dc41d76524001461cd47a19600deaba Mon Sep 17 00:00:00 2001
From: "Alan T. DeKok" <aland@freeradius.org>
Date: Mon, 8 May 2017 16:00:01 -0400
Subject: [PATCH] set S_IWUSER when creating the file, not later
(cherry picked from commit 8f53382c64114936a0433d68101a24570783e13a)
---
src/main/tls.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/main/tls.c b/src/main/tls.c
index e992062dc..1008e8a51 100644
--- a/src/main/tls.c
+++ b/src/main/tls.c
@@ -1382,7 +1382,7 @@ static int cbtls_new_session(SSL *ssl, SSL_SESSION *sess)
/* open output file */
snprintf(filename, sizeof(filename), "%s%c%s.asn1",
conf->session_cache_path, FR_DIR_SEP, buffer);
- fd = open(filename, O_RDWR|O_CREAT|O_EXCL, 0600);
+ fd = open(filename, O_RDWR|O_CREAT|O_EXCL, S_IWUSR);
if (fd < 0) {
if (request) RERROR("Session serialisation failed, failed opening session file %s: %s",
filename, fr_syserror(errno));
@@ -1400,8 +1400,6 @@ static int cbtls_new_session(SSL *ssl, SSL_SESSION *sess)
fr_pair_value_strcpy(vp, filename);
fr_pair_add(&request->state, vp);
}
-
- (void) fchmod(fd, S_IWUSR);
}
todo = blob_len;
--
2.11.0