bk: 54f1a644dvmU_20LIYcuNn9Tw3XFeA
* [Bug 2756] ntpd hangs in startup with gcc 3.3.5 on ARM.
* [Bug 2757] Quiet compiler warnings.
* [Bug 2759] Expose nonvolatile/clk_wander_threshold to ntpq.
+* [Bug 2766] ntp-keygen output files should not be world-readable.
---
(4.2.8p1) 2015/02/04 Released by Harlan Stenn <stenn@ntp.org>
FILE *str; /* file handle */
char linkname[MAXFILENAME]; /* link name */
int temp;
+ mode_t orig_umask;
snprintf(filename, sizeof(filename), "ntpkey_%s_%s.%u", file,
owner, fstamp);
- if ((str = fopen(filename, "w")) == NULL) {
+ orig_umask = umask( S_IWGRP | S_IRWXO );
+ str = fopen(filename, "w");
+ (void) umask(orig_umask);
+ if (str == NULL) {
perror("Write");
exit (-1);
}