aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/lpd/printjob.c
diff options
context:
space:
mode:
authorGarance A Drosehn <gad@FreeBSD.org>2004-12-19 05:14:29 +0000
committerGarance A Drosehn <gad@FreeBSD.org>2004-12-19 05:14:29 +0000
commita6ed151d3c3709be3a4319eb0c590011cc4b6a30 (patch)
tree36954484fa126d14b78de7e9c809204b1b9ddbcb /usr.sbin/lpr/lpd/printjob.c
parent5f1f4b090815fdcf4efe83018a4521583fe58a33 (diff)
Call umask() before opening the lock-file for a queue, to make sure
the file will be created with the right access, if the call to open() does create it. Also fix the other call to umask() to turn off "write others", just as a matter of general safety. PR: 74418 MFC after: 4 days
Notes
Notes: svn path=/head/; revision=139035
Diffstat (limited to 'usr.sbin/lpr/lpd/printjob.c')
-rw-r--r--usr.sbin/lpr/lpd/printjob.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index da99e1fff1cc..ae5ffc55be08 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -202,6 +202,7 @@ printjob(struct printer *pp)
}
if (stat(pp->lock_file, &stb) == 0 && (stb.st_mode & LFM_PRINT_DIS))
exit(0); /* printing disabled */
+ umask(S_IWOTH);
lfd = open(pp->lock_file, O_WRONLY|O_CREAT|O_EXLOCK|O_NONBLOCK,
LOCK_FILE_MODE);
if (lfd < 0) {
@@ -1974,7 +1975,7 @@ pstatus(const struct printer *pp, const char *msg, ...)
va_list ap;
va_start(ap, msg);
- umask(0);
+ umask(S_IWOTH);
fd = open(pp->status_file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE);
if (fd < 0) {
syslog(LOG_ERR, "%s: open(%s): %m", pp->printer,