From ce28475da500a977828e34bdb1be836fdf41daf9 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Wed, 27 Aug 1997 20:11:16 +0000 Subject: [PATCH] Use login_progok(). --- usr.sbin/ppp/main.c | 41 +++-------------------------------------- usr.sbin/ppp/ppp.8 | 11 +++++++---- usr.sbin/ppp/ppp.8.m4 | 11 +++++++---- 3 files changed, 17 insertions(+), 46 deletions(-) diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index bdadc96f61c9..4980212dcbc8 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.72 1997/08/25 01:52:11 brian Exp $ + * $Id: main.c,v 1.73 1997/08/26 23:20:11 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -38,8 +38,7 @@ #include #include #include -#include -#include +#include #include "modem.h" #include "os.h" #include "hdlc.h" @@ -320,40 +319,6 @@ Greetings() } } -static int -Runnable() -{ - login_cap_t *lc; - const struct passwd *pwd; - char **data; - int result; - - result = 1; /* return non-zero if I'm runnable */ - - pwd = getpwuid(getuid()); - if (!pwd) { - perror("getpwuid"); - return result; /* Run anyway - probably spawned from inetd or the like */ - } - lc = login_getpwclass(pwd); - if (!lc) { - perror("login_getpwclass"); - return result; /* Run anyway - We're missing login.conf ? */ - } - - data = login_getcaplist(lc, "prog.deny", NULL); - if (data) - for (; *data; data++) - if (!strcmp(*data, "ppp")) { - result = 0; - break; - } - - login_close(lc); - - return result; /* OK to run */ -} - int main(int argc, char **argv) { @@ -373,7 +338,7 @@ main(int argc, char **argv) if (!(mode & MODE_DIRECT)) VarTerm = stdout; - if (!Runnable()) { + if (!login_progok(getuid(), "/usr/sbin/ppp")) { LogPrintf(LogERROR, "You do not have permission to execute ppp\n"); return EX_NOPERM; } diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index 2394f27c11dd..e9fc4e04fd28 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.57 1997/08/23 23:14:24 brian Exp $ +.\" $Id: ppp.8,v 1.58 1997/08/26 23:20:16 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -131,13 +131,15 @@ stack (ie. Win95, WinNT) .It Supports execution restriction. If -.Nm +.Nm /usr/sbin/ppp is specified in the .Dv prog.deny list in .Pa /etc/login.conf , .Nm -will refuse to execute. +will refuse to execute. Refer to +.Xr login_progok 3 +for further details. .Sh GETTING STARTED @@ -2081,7 +2083,8 @@ Get port number if port number is using service name. .Xr syslog 3 , .Xr syslog.conf 5 , .Xr syslogd 8 , -.Xr login.conf 5 +.Xr login.conf 5 , +.Xr login_progok 3 .Sh HISTORY diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4 index 2394f27c11dd..e9fc4e04fd28 100644 --- a/usr.sbin/ppp/ppp.8.m4 +++ b/usr.sbin/ppp/ppp.8.m4 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.57 1997/08/23 23:14:24 brian Exp $ +.\" $Id: ppp.8,v 1.58 1997/08/26 23:20:16 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -131,13 +131,15 @@ stack (ie. Win95, WinNT) .It Supports execution restriction. If -.Nm +.Nm /usr/sbin/ppp is specified in the .Dv prog.deny list in .Pa /etc/login.conf , .Nm -will refuse to execute. +will refuse to execute. Refer to +.Xr login_progok 3 +for further details. .Sh GETTING STARTED @@ -2081,7 +2083,8 @@ Get port number if port number is using service name. .Xr syslog 3 , .Xr syslog.conf 5 , .Xr syslogd 8 , -.Xr login.conf 5 +.Xr login.conf 5 , +.Xr login_progok 3 .Sh HISTORY