File: 08-Logfile-group.patch

package info (click to toggle)
super 3.30.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,860 kB
  • sloc: ansic: 24,673; sh: 297; makefile: 296
file content (36 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Robert Luberda <robert@debian.org>
Date: Sat, 2 Jan 2010 13:57:00 +0100
Subject: 08 Logfile group.

Create log files owned by the adm group (closes: #112700).
---
 utils.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/utils.c b/utils.c
index a063f8f..08a04fb 100644
--- a/utils.c
+++ b/utils.c
@@ -1102,6 +1102,22 @@ pid_t *pid_p;	/* filled with pid of created logger */
 	    (void) close(fildes[1]);
 	    exit(1);
 	}
+
+	/* Debian bug#112700 - set group & umask for log files */
+	int adm = findgid(0, "adm");
+	if (adm >= 0)
+	{
+	    if ((setgid((gid_t)adm)) == -1) {
+		Error(1, 0, "failed to setgid %d before opening logfile; no logging: ", adm);
+		exit(1);
+	    }
+	    umask(0037);
+	}
+	else
+	{
+	   umask(0077);
+	}
+
 	if (user && *user != '\0') {
 	    stringcopy(localinfo.user, user, sizeof(localinfo.user));
 	    *localinfo.euser = '\0';