summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/pap.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-09-22 23:59:16 +0000
committerbrian <brian@FreeBSD.org>1997-09-22 23:59:16 +0000
commit3884570228b4fa8937f60dd6d2fcba459b3a17d3 (patch)
tree50b89e1bd1f71f2296e7205dab3ed03434607277 /usr.sbin/ppp/pap.c
parent21a8eb1d318f2fd4ee79da9aac7115e89b4bc033 (diff)
downloadFreeBSD-src-3884570228b4fa8937f60dd6d2fcba459b3a17d3.zip
FreeBSD-src-3884570228b4fa8937f60dd6d2fcba459b3a17d3.tar.gz
Don't allow accept/deny when it's not appropriate.
Log PAP/CHAP users in utmp & wtmp, allowing it to be avoided with "disable utmp"
Diffstat (limited to 'usr.sbin/ppp/pap.c')
-rw-r--r--usr.sbin/ppp/pap.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c
index 2fd39cd..0ef06de 100644
--- a/usr.sbin/ppp/pap.c
+++ b/usr.sbin/ppp/pap.c
@@ -18,10 +18,12 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pap.c,v 1.13 1997/06/09 03:27:32 brian Exp $
+ * $Id: pap.c,v 1.14 1997/08/25 00:29:24 brian Exp $
*
* TODO:
*/
+#include <time.h>
+#include <utmp.h>
#include "fsm.h"
#include "lcp.h"
#include "pap.h"
@@ -31,6 +33,11 @@
#include "lcpproto.h"
#include "phase.h"
#include "auth.h"
+#ifdef __OpenBSD__
+#include "util.h"
+#else
+#include "libutil.h"
+#endif
#ifndef NOPASSWDAUTH
#include "passwdauth.h"
@@ -141,8 +148,24 @@ PapInput(struct mbuf * bp)
if (PapValidate(cp, cp + *cp + 1)) {
SendPapCode(php->id, PAP_ACK, "Greetings!!");
lcp->auth_ineed = 0;
- if (lcp->auth_iwait == 0)
+ if (lcp->auth_iwait == 0) {
+ if ((mode & MODE_DIRECT) && isatty(modem) && Enabled(ConfUtmp))
+ if (Utmp)
+ LogPrintf(LogERROR, "Oops, already logged in on %s\n",
+ VarBaseDevice);
+ else {
+ struct utmp ut;
+ memset(&ut, 0, sizeof(ut));
+ time(&ut.ut_time);
+ strncpy(ut.ut_name, cp+1, sizeof(ut.ut_name)-1);
+ strncpy(ut.ut_line, VarBaseDevice, sizeof(ut.ut_line)-1);
+ if (logout(ut.ut_line))
+ logwtmp(ut.ut_line, "", "");
+ login(&ut);
+ Utmp = 1;
+ }
NewPhase(PHASE_NETWORK);
+ }
} else {
SendPapCode(php->id, PAP_NAK, "Login incorrect");
reconnect(RECON_FALSE);
OpenPOWER on IntegriCloud