From 099d6bc2beef00972d73a5bdc4e02cc14317ab61 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 1 Oct 2008 20:26:29 +0000 Subject: Use the real uid instead of getlogin() to determine the identity of the invoking user. OK deraadt@ --- libexec/lockspool/lockspool.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'libexec/lockspool/lockspool.c') diff --git a/libexec/lockspool/lockspool.c b/libexec/lockspool/lockspool.c index c712984ea03..7430420e793 100644 --- a/libexec/lockspool/lockspool.c +++ b/libexec/lockspool/lockspool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lockspool.c,v 1.13 2006/03/31 00:37:26 deraadt Exp $ */ +/* $OpenBSD: lockspool.c,v 1.14 2008/10/01 20:26:28 millert Exp $ */ /* * Copyright (c) 1998 Theo de Raadt @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: lockspool.c,v 1.13 2006/03/31 00:37:26 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: lockspool.c,v 1.14 2008/10/01 20:26:28 millert Exp $"; #endif /* not lint */ #include @@ -64,21 +64,12 @@ main(int argc, char *argv[]) signal(SIGPIPE, unhold); if (argc == 2) - from = argv[1]; + pw = getpwnam(argv[1]); else - from = getlogin(); - - if (from) { - pw = getpwnam(from); - if (pw == NULL) - exit (1); - } else { pw = getpwuid(getuid()); - if (pw) - from = pw->pw_name; - else - exit (1); - } + if (pw == NULL) + exit (1); + from = pw->pw_name; holdfd = getlock(from, pw); if (holdfd == -1) { -- cgit v1.2.3