From owner-freebsd-current Thu Dec 9 22:42:18 1999 Delivered-To: freebsd-current@freebsd.org Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by hub.freebsd.org (Postfix) with ESMTP id AD62214FCF for ; Thu, 9 Dec 1999 22:42:12 -0800 (PST) (envelope-from andre.albsmeier@mchp.siemens.de) X-Envelope-Sender-Is: andre.albsmeier@mchp.siemens.de (at relayer david.siemens.de) Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.9.3/8.9.3) with ESMTP id HAA15284 for ; Fri, 10 Dec 1999 07:42:10 +0100 (MET) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) by mail1.siemens.de (8.9.3/8.9.3) with ESMTP id HAA11864 for ; Fri, 10 Dec 1999 07:42:09 +0100 (MET) Received: (from daemon@localhost) by curry.mchp.siemens.de (8.9.3/8.9.3) id HAA20660 for ; Fri, 10 Dec 1999 07:42:09 +0100 (CET) Date: Fri, 10 Dec 1999 07:42:05 +0100 From: Andre Albsmeier To: Alfred Perlstein Cc: Andre Albsmeier , Warner Losh , Garance A Drosihn , current@FreeBSD.ORG Subject: Re: NO! Re: [PATCHES] Two fixes for lpd/lpc for review and test Message-ID: <19991210074205.B12325@internal> References: <19991209153320.A62121@internal> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from bright@wintelcom.net on Thu, Dec 09, 1999 at 03:02:41PM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 09-Dec-1999 at 15:02:41 -0800, Alfred Perlstein wrote: > On Thu, 9 Dec 1999, Andre Albsmeier wrote: > > ... > > > For better reference, here is the current patch: > > > > *** lpr.c.ORI Thu Dec 9 15:30:18 1999 > > --- lpr.c Thu Dec 9 15:30:35 1999 > > *************** > > *** 370,375 **** > > --- 370,405 ---- > > } > > if (sflag) > > printf("%s: %s: not linked, copying instead\n", name, arg); > > + /* > > + * If lpr was invoked with -r we try to move the file to > > + * be printed instead of copying and deleting it later. > > + * This works if the file and lpd's spool directory are > > + * on the same filesystem as it is often the case for files > > + * printed by samba or pcnfsd. In this case, a lot of I/O > > + * and temporary disk space can be avoided. Otherwise, we > > + * will continue normally. > > + */ > > + if (f) { /* file should be deleted */ > > + seteuid(euid); /* needed for rename() */ > > + if (!rename(arg, dfname)) { > > + int i; > > + #if 0 > > + chown(dfname, userid, getegid()); > > + chmod(dfname, S_IRUSR | S_IWUSR | > > + S_IRGRP | S_IWGRP); > > + #endif > > + seteuid(uid); /* restore old uid */ > > + if (format == 'p') > > + card('T', title ? title : arg); > > + for (i = 0; i < ncopies; i++) > > + card(format, &dfname[inchar-2]); > > + card('U', &dfname[inchar-2]); > > + card('N', arg); > > + nact++; > > + continue; > > + } > > + seteuid(uid); /* restore old uid */ > > + } > > if ((i = open(arg, O_RDONLY)) < 0) { > > printf("%s: cannot open %s\n", name, arg); > > } else { > > > > > > I don't have too much time to think about this, argue me this: Sure, please tell me if you don't want to get CC'ed on this anymore. > > why should I allow a user to print any file on the system? > > the race condition is still there. Right :-(. The file won't be given to the user anymore but he can print everything. However, there must be a solution for this... > > -Alfred > -Andre To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message