]> git.pld-linux.org Git - packages/ntp.git/blame - ntp-4.2.4-groups.patch
- move drift to ntp user writable /var/lib/ntp
[packages/ntp.git] / ntp-4.2.4-groups.patch
CommitLineData
6fca7355
ER
1--- ntp-4.2.4/ntpd/ntpd.c.groups 2006-12-29 00:02:02.000000000 +0100
2+++ ntp-4.2.4/ntpd/ntpd.c 2007-01-02 16:24:21.000000000 +0100
3@@ -874,10 +874,18 @@
4 sw_uid = (uid_t)strtoul(user, &endp, 0);
5 if (*endp != '\0')
6 goto getuser;
7+
8+ if ((pw = getpwuid(sw_uid)) != NULL) {
9+ user = strdup(pw->pw_name);
10+ } else {
11+ user = (char *)-1;
12+ }
13+
14 } else {
15 getuser:
16 if ((pw = getpwnam(user)) != NULL) {
17 sw_uid = pw->pw_uid;
18+ sw_gid = pw->pw_gid;
19 } else {
20 errno = 0;
21 msyslog(LOG_ERR, "Cannot find user `%s'", user);
22@@ -913,6 +921,13 @@
23 exit (-1);
24 }
25 }
26+
27+ if (user && (user != (char *)-1) && initgroups(user, sw_gid)) {
28+ msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user);
29+ exit (-1);
30+ }
31+
32+
33 if (group && setgid(sw_gid)) {
34 msyslog(LOG_ERR, "Cannot setgid() to group `%s': %m", group);
35 exit (-1);
This page took 0.06586 seconds and 4 git commands to generate.