Subject: bin/2618: 'halt' won't work as a login shell
To: None <gnats-bugs@NetBSD.ORG>
From: None <cgd@cs.cmu.edu>
List: netbsd-bugs
Date: 07/11/1996 15:14:33
>Number:         2618
>Category:       bin
>Synopsis:       'halt' won't work as a login shell, reboots instead.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 11 15:35:01 1996
>Last-Modified:
>Originator:     Chris G. Demetriou
>Organization:
Kernel Hackers 'r' Us
>Release:        1.2_ALPHA
>Environment:
System: NetBSD bunnahabhain.pdl.cs.cmu.edu 1.2A NetBSD 1.2A (GENERIC) #37: Tue Jul 9 00:07:21 EDT 1996 cgd@bunnahabhain.pdl.cs.cmu.edu:/nfsmnt/usr8/cgd/mac/trunk-src/sys/arch/alpha/compile/GENERIC alpha


>Description:
	Halt doesn't work as a login shell.  It reboots instead.

>How-To-Repeat:
	
	Set up a passwd entry like:

	halt:*:0:0:Charlie &:/root:/sbin/halt

	Give it a password, log in as 'halt', and notice that it reboots.

>Fix:
	A patch to fix the "problem" is included here.

*** reboot.c.old	Thu Jul 11 15:05:04 1996
--- reboot.c	Thu Jul 11 15:02:19 1996
***************
*** 72,78 ****
  	int ch, howto, lflag, nflag, qflag, sverrno;
  	char *p, *user;
  
! 	if (!strcmp((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) {
  		dohalt = 1;
  		howto = RB_HALT;
  	} else
--- 72,79 ----
  	int ch, howto, lflag, nflag, qflag, sverrno;
  	char *p, *user;
  
! 	p = (p = rindex(*argv, '/')) ? p + 1 : *argv;
! 	if (!strcmp(p, "halt") || !strcmp(p, "-halt")) {
  		dohalt = 1;
  		howto = RB_HALT;
  	} else
>Audit-Trail:
>Unformatted: