Subject: bin/17274: "su" program broken during conversion to use "getopt()"
To: None <gnats-bugs@gnats.netbsd.org>
From: Paul Shupak <paul@Plectere.com>
List: netbsd-bugs
Date: 06/15/2002 21:36:38
>Number:         17274
>Category:       bin
>Synopsis:       traditional "su - account" no longer works
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 15 21:37:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul Shupak
>Release:        NetBSD 1.6A today -- code broken last Wednesday
>Organization:
>Environment:
System: NetBSD svcs 1.6A NetBSD 1.6A (PCOM-$Revision: 1.25 $) #239: Thu Jun 13 17:32:35 PDT 2002 paul@svcs:/usr/src/sys/arch/i386/compile/PCOM i386
Architecture: i386
Machine: i386
>Description:
	"su - account" no longer works, though unexpected nonstandard
	"su -- account" does function
>How-To-Repeat:
	try "su - any_account" and get error message "su: unknown login -"
>Fix:
	There MUST be a better way, but

*** su.c	Sat Jun 15 21:28:10 2002
--- su.c-broken Wed Jun 12 04:32:01 2002
***************
*** 139,149 ****
  
  	asme = asthem = fastlogin = 0;
  	shell = class = NULL;
+ 
+ 	/* Handle "traditional" 'su - account' syntax */
+ 	if ( !strcmp( argv[1], "-" ) )
+ 		argv[1] = "-l" ;
+ 
  	while ((ch = getopt(argc, argv, ARGSTR)) != -1)
  		switch((char)ch) {
  #if defined(KERBEROS) || defined(KERBEROS5)
--- 139,144 ----
***************
*** 159,164 ****
--- 154,160 ----
  		case 'f':
  			fastlogin = 1;
  			break;
- 		case '-':
  		case 'l':
  			asme = 0;
  			asthem = 1;
>Release-Note:
>Audit-Trail:
>Unformatted: