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
This commit is contained in:
parent
8d0a2a10ef
commit
4572e84e4f
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user