From owner-freebsd-bugs Wed Feb 10 21:00:06 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA19745 for freebsd-bugs-outgoing; Wed, 10 Feb 1999 21:00:06 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA19728 for ; Wed, 10 Feb 1999 21:00:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id VAA39951; Wed, 10 Feb 1999 21:00:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from acct.inet.co.th (acct.inet.co.th [203.150.17.130]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA19500 for ; Wed, 10 Feb 1999 20:56:46 -0800 (PST) (envelope-from anto@acct.inet.co.th) Received: (from anto@localhost) by acct.inet.co.th (8.8.8/8.8.8) id LAA03211; Thu, 11 Feb 1999 11:56:03 +0700 (ICT) (envelope-from anto) Message-Id: <199902110456.LAA03211@acct.inet.co.th> Date: Thu, 11 Feb 1999 11:56:03 +0700 (ICT) From: Anto Prijosoesilo Reply-To: Anto Prijosoesilo To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/10019: Bug in keyinfo and keyinit Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 10019 >Category: bin >Synopsis: Keyinfo and keyinit may use the wrong name if the uid is shared by multiple logins >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 10 21:00:01 PST 1999 >Closed-Date: >Last-Modified: >Originator: Anto Prijosoesilo >Release: FreeBSD 2.2.7-STABLE i386 >Organization: Internet Thailand >Environment: FreeBSD acct.inet.co.th 2.2.7-STABLE FreeBSD 2.2.7-STABLE #0: Fri Nov 20 08:40:26 ICT 1998 anto@inet.co.th:/usr/src/sys/compile/ACCT i386 >Description: If a uid is shared by multiple login names keyinfo and keyinit will default to the first name it finds that share the uid. >How-To-Repeat: Create a user (ex: user1). Create another login name for that user (ex: user2). Login as user1 and run keyinit. It should say 'Adding user1:'. Login as user2 and run keyinit. It should say 'Adding user2:'. The last 2 steps above will actually say 'Adding user1' and 'Updating user1'. While logged in as user1 run 'keyinfo' and 'keyinfo user1'. While logged in as user2 run 'keyinfo' and 'keyinfo user2'. One of the last 2 steps above will give different results. >Fix: diff -cr src.orig/usr.bin/keyinfo/keyinfo.pl src/usr.bin/keyinfo/keyinfo.pl *** src.orig/usr.bin/keyinfo/keyinfo.pl Thu Feb 11 11:37:23 1999 --- src/usr.bin/keyinfo/keyinfo.pl Thu Feb 11 09:06:06 1999 *************** *** 14,19 **** --- 14,23 ---- $user = $ARGV[0]; } else { $user = (getpwuid($<))[0]; + $luser = getlogin; + if ($< == getpwnam($luser)) { + $user = $luser; + } } while () { diff -cr src.orig/usr.bin/keyinit/skeyinit.c src/usr.bin/keyinit/skeyinit.c *** src.orig/usr.bin/keyinit/skeyinit.c Thu Feb 11 11:37:23 1999 --- src/usr.bin/keyinit/skeyinit.c Thu Feb 11 09:10:35 1999 *************** *** 42,49 **** gethostname(defaultseed,NAMELEN); strcpy(&defaultseed[NAMELEN],tbuf); ! pp = ppuser = getpwuid(getuid()); ! strcpy(me,pp->pw_name); defaultsetup = 1; if( argc > 1){ if(strcmp("-s", argv[1]) == 0) --- 42,54 ---- gethostname(defaultseed,NAMELEN); strcpy(&defaultseed[NAMELEN],tbuf); ! pp = getpwuid(getuid()); ! strcpy(me,getlogin()); ! ppuser = getpwnam(me); ! if (pp->pw_uid != ppuser->pw_uid) { ! ppuser = pp; ! strcpy(me,pp->pw_name); ! } defaultsetup = 1; if( argc > 1){ if(strcmp("-s", argv[1]) == 0) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message