From owner-freebsd-bugs Sun Aug 1 12:40:18 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 3917F14CC2 for ; Sun, 1 Aug 1999 12:40:16 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA54209; Sun, 1 Aug 1999 12:40:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from pawn.primelocation.net (pawn.primelocation.net [205.161.238.235]) by hub.freebsd.org (Postfix) with ESMTP id 3A04914CC2 for ; Sun, 1 Aug 1999 12:36:36 -0700 (PDT) (envelope-from jedgar@pawn.primelocation.net) Received: by pawn.primelocation.net (Postfix, from userid 1003) id B2098F818; Sun, 1 Aug 1999 15:36:23 -0400 (EDT) Message-Id: <19990801193623.B2098F818@pawn.primelocation.net> Date: Sun, 1 Aug 1999 15:36:23 -0400 (EDT) From: jedgar@fxp.org Reply-To: jedgar@fxp.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12912: [PATCH] lpd leaves lock file permissions afoul Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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