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

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