mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix last commit to not crash if uid changing not configured.
This commit is contained in:
@@ -374,7 +374,7 @@ int main (int argc, char **argv)
|
|||||||
die(_("unknown user or group: %s"), baduser, EC_BADCONF);
|
die(_("unknown user or group: %s"), baduser, EC_BADCONF);
|
||||||
|
|
||||||
#ifdef HAVE_DNSSEC
|
#ifdef HAVE_DNSSEC
|
||||||
badtime = setup_timestamp(ent_pw->pw_uid);
|
badtime = setup_timestamp(ent_pw);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* implement group defaults, "dip" if available, or group associated with uid */
|
/* implement group defaults, "dip" if available, or group associated with uid */
|
||||||
|
|||||||
@@ -1152,7 +1152,7 @@ int dnssec_chase_cname(time_t now, struct dns_header *header, size_t plen, char
|
|||||||
int dnskey_keytag(int alg, int flags, unsigned char *rdata, int rdlen);
|
int dnskey_keytag(int alg, int flags, unsigned char *rdata, int rdlen);
|
||||||
size_t filter_rrsigs(struct dns_header *header, size_t plen);
|
size_t filter_rrsigs(struct dns_header *header, size_t plen);
|
||||||
unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name);
|
unsigned char* hash_questions(struct dns_header *header, size_t plen, char *name);
|
||||||
int setup_timestamp(uid_t uid);
|
int setup_timestamp(struct passwd *ent_pw);
|
||||||
|
|
||||||
/* util.c */
|
/* util.c */
|
||||||
void rand_init(void);
|
void rand_init(void);
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ static int serial_compare_32(unsigned long s1, unsigned long s2)
|
|||||||
static time_t timestamp_time;
|
static time_t timestamp_time;
|
||||||
static int back_to_the_future;
|
static int back_to_the_future;
|
||||||
|
|
||||||
int setup_timestamp(uid_t uid)
|
int setup_timestamp(struct passwd *ent_pw)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ int setup_timestamp(uid_t uid)
|
|||||||
|
|
||||||
timestamp_time = timbuf.actime = timbuf.modtime = 1420070400; /* 1-1-2015 */
|
timestamp_time = timbuf.actime = timbuf.modtime = 1420070400; /* 1-1-2015 */
|
||||||
if (utime(daemon->timestamp_file, &timbuf) == 0 &&
|
if (utime(daemon->timestamp_file, &timbuf) == 0 &&
|
||||||
(getuid() != 0 || chown(daemon->timestamp_file, uid, -1) == 0))
|
(!ent_pw || getuid() != 0 || chown(daemon->timestamp_file, ent_pw->pw_uid, -1) == 0))
|
||||||
goto check_and_exit;
|
goto check_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user