Date: Sun, 1 Aug 1999 15:36:23 -0400 (EDT) From: jedgar@fxp.org To: FreeBSD-gnats-submit@freebsd.org Subject: bin/12912: [PATCH] lpd leaves lock file permissions afoul Message-ID: <19990801193623.B2098F818@pawn.primelocation.net>
next in thread | raw e-mail | index | archive | help
>Number: 12912 >Category: bin >Synopsis: [PATCH] lpd leaves lock file permissions afoul >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 1 12:40:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Chris D. Faulhaber >Release: FreeBSD 3.2-STABLE i386 >Organization: >Environment: FreeBSD earth.fxp 3.2-STABLE FreeBSD 3.2-STABLE #12: Sun Aug 1 10:29:14 EDT 1999 >Description: When using a custom definition in /etc/printcap (for a remote printer in my case, modeled of the example therein) and the lock file does not exist, lpd leaves permissions on the lock file as follows: -------rwx 1 root daemon 22 Aug 1 15:16 lock which leave the printer disabled until the permissions are fixed. If the lock file exists, permissions are left as normal: -rw-rw-r-- 1 root daemon 22 Aug 1 15:20 lock In addition, the lock file file-descriptor (lfd) is never closed. >How-To-Repeat: Create a custom /etc/printcap entry: lp|sol printer:\ :sh:\ :mx#0:\ :rm=sol:sd=/var/spool/output/sol:lf=/var/log/lpd-errs: create the spool directory, but do not create the lock file itself. After restarting lpd and printing something, the lock file's permissions will be left as 0007. >Fix: Either create the lock file (though shouldn't be necessary), or apply the following patch. --- /usr/src/usr.sbin/lpr/lpd/printjob.c.orig Fri Sep 11 14:49:32 1998 +++ /usr/src/usr.sbin/lpr/lpd/printjob.c Sun Aug 1 15:16:21 1999 @@ -311,6 +311,10 @@ strlen(pp->trailer)); } (void) close(ofd); + if (fchmod(lfd, LOG_FILE_MODE) < 0) + syslog(LOG_ERR, "%s: %s: %m", pp->printer, + pp->lock_file); + (void) close(lfd); (void) wait(NULL); (void) unlink(tempfile); exit(0); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990801193623.B2098F818>