Blame SOURCES/freeradius-set-S_IWUSER-when-creating-the-file-not-later.patch

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