diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-01 20:26:29 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-01 20:26:29 +0000 |
commit | 099d6bc2beef00972d73a5bdc4e02cc14317ab61 (patch) | |
tree | 228de49ca5c9dfd2006b60993884d63545ef6892 /libexec/lockspool/lockspool.c | |
parent | 6b5dc4ed53339689f73190dc26aa21a78f44e0fc (diff) |
Use the real uid instead of getlogin() to determine the identity
of the invoking user. OK deraadt@
Diffstat (limited to 'libexec/lockspool/lockspool.c')
-rw-r--r-- | libexec/lockspool/lockspool.c | 21 |
1 files changed, 6 insertions, 15 deletions
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 <deraadt@theos.com> @@ -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 <signal.h> @@ -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) { |