diff options
author | Shawn Routhier <sar@isc.org> | 2014-05-07 11:54:27 -0700 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2014-05-07 11:54:27 -0700 |
commit | d8c7c34ef64922f1b7d60c5bd5ac01d8ad5ffdca (patch) | |
tree | ff416f246e67e2601a30373c5886e0b087cfead9 /server/dhcpd.c | |
parent | 02b0bdc3cf068b872ed5efb88b98e06ab0717157 (diff) | |
download | isc-dhcp-d8c7c34ef64922f1b7d60c5bd5ac01d8ad5ffdca.tar.gz |
[master] Print out files used and move the dropping of privileges in paranoia
17551 - When starting up in verbose mode have the server print out
the files it will use
25806 - Moving the paranoia code that drops the privileges to be after
the server has written the PID file.
Diffstat (limited to 'server/dhcpd.c')
-rw-r--r-- | server/dhcpd.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/server/dhcpd.c b/server/dhcpd.c index 28cc5629..bd9e1efb 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -308,7 +308,13 @@ main(int argc, char **argv) { local_family_set = 1; #endif /* DHCPv6 */ } else if (!strcmp (argv [i], "--version")) { - log_info("isc-dhcpd-%s", PACKAGE_VERSION); + const char vstring[] = "isc-dhcpd-"; + IGNORE_RET(write(STDERR_FILENO, vstring, + strlen(vstring))); + IGNORE_RET(write(STDERR_FILENO, + PACKAGE_VERSION, + strlen(PACKAGE_VERSION))); + IGNORE_RET(write(STDERR_FILENO, "\n", 1)); exit (0); #if defined (TRACING) } else if (!strcmp (argv [i], "-tf")) { @@ -394,6 +400,9 @@ main(int argc, char **argv) { log_info (copyright); log_info (arr); log_info (url); + log_info ("Config file: %s", path_dhcpd_conf); + log_info ("Database file: %s", path_dhcpd_db); + log_info ("PID file: %s", path_dhcpd_pid); } else { quiet = 0; log_perror = 0; @@ -690,22 +699,6 @@ main(int argc, char **argv) { exit (0); } -#if defined (PARANOIA) - /* change uid to the specified one */ - - if (set_gid) { - if (setgroups (0, (void *)0)) - log_fatal ("setgroups: %m"); - if (setgid (set_gid)) - log_fatal ("setgid(%d): %m", (int) set_gid); - } - - if (set_uid) { - if (setuid (set_uid)) - log_fatal ("setuid(%d): %m", (int) set_uid); - } -#endif /* PARANOIA */ - /* * Deal with pid files. If the user told us * not to write a file we don't read one either @@ -742,6 +735,22 @@ main(int argc, char **argv) { } } +#if defined (PARANOIA) + /* change uid to the specified one */ + + if (set_gid) { + if (setgroups (0, (void *)0)) + log_fatal ("setgroups: %m"); + if (setgid (set_gid)) + log_fatal ("setgid(%d): %m", (int) set_gid); + } + + if (set_uid) { + if (setuid (set_uid)) + log_fatal ("setuid(%d): %m", (int) set_uid); + } +#endif /* PARANOIA */ + /* If we were requested to log to stdout on the command line, keep doing so; otherwise, stop. */ if (log_perror == -1) |