Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. From 3358e0e85bf40351bc4a8357a878c844c4190ef2 Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Thu, 1 Jan 2015 13:06:38 -0600
  4. Subject: [PATCH 01/13] be more verbose when logging privsep errors
  5. Make it easy for a sysadmin to diagnose a privilege separation path
  6. problem without looking at the source code.
  7. ---
  8. src/usr.sbin/ntpd/ntp.c | 11 +++++++----
  9. 1 file changed, 7 insertions(+), 4 deletions(-)
  10. diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c
  11. index 87b769b..625364a 100644
  12. --- a/src/usr.sbin/ntpd/ntp.c
  13. +++ b/src/usr.sbin/ntpd/ntp.c
  14. @@ -121,10 +121,13 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
  15. ntp_dns(pipe_dns, nconf, pw);
  16. close(pipe_dns[1]);
  17. - if (stat(pw->pw_dir, &stb) == -1)
  18. - fatal("stat");
  19. - if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0)
  20. - fatalx("bad privsep dir permissions");
  21. + if (stat(pw->pw_dir, &stb) == -1) {
  22. + fatal("privsep dir %s could not be opened", pw->pw_dir);
  23. + }
  24. + if (stb.st_uid != 0 || (stb.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
  25. + fatalx("bad privsep dir %s permissions: %o",
  26. + pw->pw_dir, stb.st_mode);
  27. + }
  28. if (chroot(pw->pw_dir) == -1)
  29. fatal("chroot");
  30. if (chdir("/") == -1)
  31. --
  32. 1.9.1