From 540cfa0f957d6aa9f2b0e74c11858fb5bd0fc40a Mon Sep 17 00:00:00 2001 From: brian Date: Mon, 20 Dec 1999 20:30:40 +0000 Subject: Use getpwuid() instead of getlogin() in ``allow users''. --- usr.sbin/ppp/systems.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ppp') diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index a29b902..6fe6a8e 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -185,16 +185,17 @@ AllowUsers(struct cmdargs const *arg) { /* arg->bundle may be NULL (see system_IsValid()) ! */ int f; - char *user; + struct passwd *pwd; userok = 0; - user = getlogin(); - if (user && *user) + pwd = getpwuid(getuid()); + if (pwd != NULL) for (f = arg->argn; f < arg->argc; f++) - if (!strcmp("*", arg->argv[f]) || !strcmp(user, arg->argv[f])) { + if (!strcmp("*", arg->argv[f]) || !strcmp(pwd->pw_name, arg->argv[f])) { userok = 1; break; } + endpwent(); return 0; } -- cgit v1.1