Date: Thu, 11 Feb 1999 11:56:03 +0700 (ICT) From: Anto Prijosoesilo <anto@inet.co.th> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/10019: Bug in keyinfo and keyinit Message-ID: <199902110456.LAA03211@acct.inet.co.th>
index | next in thread | raw e-mail
>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 (<K>) {
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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902110456.LAA03211>
