From root@gits.dyndns.org  Thu May 10 14:54:23 2001
Return-Path: <root@gits.dyndns.org>
Received: from mail.noos.fr (zola.noos.net [212.198.2.76])
	by hub.freebsd.org (Postfix) with ESMTP id 080D737B422
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 10 May 2001 14:54:22 -0700 (PDT)
	(envelope-from root@gits.dyndns.org)
Received: (qmail 28154382 invoked by uid 0); 10 May 2001 21:54:19 -0000
Received: from d165.dhcp212-198-231.noos.fr (HELO gits.dyndns.org) ([212.198.231.165]) (envelope-sender <root@gits.dyndns.org>)
          by zola.noos.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP
          for <FreeBSD-gnats-submit@freebsd.org>; 10 May 2001 21:54:19 -0000
Received: (from root@localhost)
	by gits.dyndns.org (8.11.3/8.11.3) id f4ALsHS60127;
	Thu, 10 May 2001 23:54:17 +0200 (CEST)
	(envelope-from root)
Message-Id: <200105102154.f4ALsHS60127@gits.dyndns.org>
Date: Thu, 10 May 2001 23:54:17 +0200 (CEST)
From: Cyrille Lefevre <clefevre@poboxes.com>
Reply-To: clefevre@poboxes.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: getty didn't check if if= isn't empty
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         27258
>Category:       bin
>Synopsis:       getty(8) didn't check if if= isn't empty
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 10 15:00:00 PDT 2001
>Closed-Date:    
>Last-Modified:  Wed May 21 20:53:46 UTC 2008
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
ACME
>Environment:

System: FreeBSD gits 4.3-STABLE FreeBSD 4.3-STABLE #21: Sun Apr 22 22:20:03 CEST 2001 root@gits:/disk2/4.x-stable/src/sys/compile/CUSTOM i386

>Description:
	
	all is in the subject. this is not so important, but be safe.

>How-To-Repeat:

	:if=: in gettytab

>Fix:

Index: main.c
===================================================================
RCS file: /home/ncvs/src/libexec/getty/main.c,v
retrieving revision 1.28.2.2
diff -u -r1.28.2.2 main.c
--- main.c	2001/03/05 11:17:08	1.28.2.2
+++ main.c	2001/03/11 06:02:46
@@ -324,7 +324,7 @@
 
 		/* if this is the first time through this, and an
 		   issue file has been given, then send it */
-		if (first_time && IF) {
+		if (first_time && IF && *IF) {
 			int fd;
 
 			if ((fd = open(IF, O_RDONLY)) != -1) {
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Cyrille Lefevre <clefevre@poboxes.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: Fri, 11 May 2001 17:43:22 +1000 (EST)

 On Thu, 10 May 2001, Cyrille Lefevre wrote:
 
 > >Description:
 > 	
 > 	all is in the subject. this is not so important, but be safe.
 > 
 > >How-To-Repeat:
 > 
 > 	:if=: in gettytab
 > 
 > >Fix:
 > 
 > Index: main.c
 > ===================================================================
 > RCS file: /home/ncvs/src/libexec/getty/main.c,v
 > retrieving revision 1.28.2.2
 > diff -u -r1.28.2.2 main.c
 > --- main.c	2001/03/05 11:17:08	1.28.2.2
 > +++ main.c	2001/03/11 06:02:46
 > @@ -324,7 +324,7 @@
 >  
 >  		/* if this is the first time through this, and an
 >  		   issue file has been given, then send it */
 > -		if (first_time && IF) {
 > +		if (first_time && IF && *IF) {
 >  			int fd;
 >  
 >  			if ((fd = open(IF, O_RDONLY)) != -1) {
 
 This is safer than `:if=/bin/sh:'.  It just causes the open to fail
 just like for any other nonexistent file (POSIX standard).
 
 Bruce
 

From: Cyrille Lefevre <clefevre-lists@noos.fr>
To: Bruce Evans <bde@zeta.org.au>
Cc: Cyrille Lefevre <clefevre@poboxes.com>,
	FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: 14 May 2001 03:36:16 +0200

 Bruce Evans <bde@zeta.org.au> writes:
 
 [snip]
 > > -		if (first_time && IF) {
 > > +		if (first_time && IF && *IF) {
 > >  			int fd;
 > >  
 > >  			if ((fd = open(IF, O_RDONLY)) != -1) {
 > 
 > This is safer than `:if=/bin/sh:'.  It just causes the open to fail
 > just like for any other nonexistent file (POSIX standard).
 
 yes, but this syscall isn't needed, so, why not to get rid of it if
 if= is empty ?
 
 Cyrille.
 --
 home: mailto:clefevre@poboxes.com   UNIX is user-friendly; it's just particular
 work: mailto:Cyrille.Lefevre@edf.fr   about who it chooses to be friends with.

From: Bruce Evans <bde@zeta.org.au>
To: Cyrille Lefevre <clefevre@poboxes.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: Mon, 14 May 2001 19:01:55 +1000 (EST)

 On 14 May 2001, Cyrille Lefevre wrote:
 
 > Bruce Evans <bde@zeta.org.au> writes:
 > 
 > [snip]
 > > > -		if (first_time && IF) {
 > > > +		if (first_time && IF && *IF) {
 > > >  			int fd;
 > > >  
 > > >  			if ((fd = open(IF, O_RDONLY)) != -1) {
 > > 
 > > This is safer than `:if=/bin/sh:'.  It just causes the open to fail
 > > just like for any other nonexistent file (POSIX standard).
 > 
 > yes, but this syscall isn't needed, so, why not to get rid of it if
 > if= is empty ?
 
 It takes more code, and takes longer in the usual case.
 
 Bruce
 

From: Cyrille Lefevre <clefevre-lists@noos.fr>
To: Bruce Evans <bde@zeta.org.au>
Cc: Cyrille Lefevre <clefevre@poboxes.com>,
	FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: 15 May 2001 02:32:11 +0200

 Bruce Evans <bde@zeta.org.au> writes:
 
 > On 14 May 2001, Cyrille Lefevre wrote:
 > 
 > > Bruce Evans <bde@zeta.org.au> writes:
 > > 
 > > [snip]
 > > > > -		if (first_time && IF) {
 > > > > +		if (first_time && IF && *IF) {
 > > > >  			int fd;
 > > > >  
 > > > >  			if ((fd = open(IF, O_RDONLY)) != -1) {
 > > > 
 > > > This is safer than `:if=/bin/sh:'.  It just causes the open to fail
 > > > just like for any other nonexistent file (POSIX standard).
 > > 
 > > yes, but this syscall isn't needed, so, why not to get rid of it if
 > > if= is empty ?
 > 
 > It takes more code, and takes longer in the usual case.
 
 are you joking ? a syscall faster than a simple test like this ?
 
 Cyrille.
 --
 home: mailto:clefevre@poboxes.com   UNIX is user-friendly; it's just particular
 work: mailto:Cyrille.Lefevre@edf.fr   about who it chooses to be friends with.

From: Bruce Evans <bde@zeta.org.au>
To: Cyrille Lefevre <clefevre@poboxes.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: Tue, 15 May 2001 19:35:36 +1000 (EST)

 On 15 May 2001, Cyrille Lefevre wrote:
 
 > Bruce Evans <bde@zeta.org.au> writes:
 > 
 > > On 14 May 2001, Cyrille Lefevre wrote:
 > > 
 > > > Bruce Evans <bde@zeta.org.au> writes:
 > > > 
 > > > [snip]
 > > > > > -		if (first_time && IF) {
 > > > > > +		if (first_time && IF && *IF) {
 > > > > >  			int fd;
 > > > > >  
 > > > > >  			if ((fd = open(IF, O_RDONLY)) != -1) {
 > > > > 
 > > > > This is safer than `:if=/bin/sh:'.  It just causes the open to fail
 > > > > just like for any other nonexistent file (POSIX standard).
 > > > 
 > > > yes, but this syscall isn't needed, so, why not to get rid of it if
 > > > if= is empty ?
 > > 
 > > It takes more code, and takes longer in the usual case.
 > 
 > are you joking ? a syscall faster than a simple test like this ?
 
 No.  The null test is faster than a simple test.
 
 Bruce
 

From: "Cyrille Lefevre" <cyrille.lefevre@laposte.net>
To: "gnats-submit @FreeBSD.org" <FreeBSD-gnats-submit@freebsd.org>
Cc:  
Subject: Re: bin/27258: getty didn't check if if= isn't empty
Date: Thu, 4 Mar 2004 16:24:01 +0100

 anyone to commit this PR which is a one line patch !
 
 thanks in advance.
 
 Cyrille Lefevre.
 -- 
 home: mailto:cyrille.lefevre@laposte.net
>Unformatted:
