]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/dnsmasq/0055-Fix-last-commit-to-not-crash-if-uid-changing-not-con.patch
dnsmasq: Import latest git version of dnsmasq
[ipfire-2.x.git] / src / patches / dnsmasq / 0055-Fix-last-commit-to-not-crash-if-uid-changing-not-con.patch
1 From 9003b50b13da624ca45f3e0cf99abb623b8d026b Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Mon, 2 Mar 2015 22:47:23 +0000
4 Subject: [PATCH 55/55] Fix last commit to not crash if uid changing not
5 configured.
6
7 ---
8 src/dnsmasq.c | 2 +-
9 src/dnsmasq.h | 2 +-
10 src/dnssec.c | 4 ++--
11 3 files changed, 4 insertions(+), 4 deletions(-)
12
13 diff --git a/src/dnsmasq.c b/src/dnsmasq.c
14 index 769a19afe6c5..9e05c0e31569 100644
15 --- a/src/dnsmasq.c
16 +++ b/src/dnsmasq.c
17 @@ -374,7 +374,7 @@ int main (int argc, char **argv)
18 die(_("unknown user or group: %s"), baduser, EC_BADCONF);
19
20 #ifdef HAVE_DNSSEC
21 - badtime = setup_timestamp(ent_pw->pw_uid);
22 + badtime = setup_timestamp(ent_pw);
23 #endif
24
25 /* implement group defaults, "dip" if available, or group associated with uid */
26 diff --git a/src/dnsmasq.h b/src/dnsmasq.h
27 index b2f02dda63f0..a451cb4dd03c 100644
28 --- a/src/dnsmasq.h
29 +++ b/src/dnsmasq.h
30 @@ -1152,7 +1152,7 @@ int dnssec_chase_cname(time_t now, struct dns_header *header, size_t plen, char
31 int dnskey_keytag(int alg, int flags, unsigned char *rdata, int rdlen);
32 size_t filter_rrsigs(struct dns_header *header, size_t plen);
33 unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name);
34 -int setup_timestamp(uid_t uid);
35 +int setup_timestamp(struct passwd *ent_pw);
36
37 /* util.c */
38 void rand_init(void);
39 diff --git a/src/dnssec.c b/src/dnssec.c
40 index bf4406469de0..c60eacf73c6b 100644
41 --- a/src/dnssec.c
42 +++ b/src/dnssec.c
43 @@ -402,7 +402,7 @@ static int serial_compare_32(unsigned long s1, unsigned long s2)
44 static time_t timestamp_time;
45 static int back_to_the_future;
46
47 -int setup_timestamp(uid_t uid)
48 +int setup_timestamp(struct passwd *ent_pw)
49 {
50 struct stat statbuf;
51
52 @@ -437,7 +437,7 @@ int setup_timestamp(uid_t uid)
53
54 timestamp_time = timbuf.actime = timbuf.modtime = 1420070400; /* 1-1-2015 */
55 if (utime(daemon->timestamp_file, &timbuf) == 0 &&
56 - (getuid() != 0 || chown(daemon->timestamp_file, uid, -1) == 0))
57 + (!ent_pw || getuid() != 0 || chown(daemon->timestamp_file, ent_pw->pw_uid, -1) == 0))
58 goto check_and_exit;
59 }
60 }
61 --
62 2.1.0
63