summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chap.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/chap.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/chap.c')
-rw-r--r--usr.sbin/ppp/chap.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c
index 9effb34..35ae17d 100644
--- a/usr.sbin/ppp/chap.c
+++ b/usr.sbin/ppp/chap.c
@@ -17,12 +17,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: chap.c,v 1.20 1997/08/25 00:29:06 brian Exp $
+ * $Id: chap.c,v 1.21 1997/09/17 23:17:48 brian Exp $
*
* TODO:
*/
#include <sys/types.h>
#include <time.h>
+#include <utmp.h>
#include "fsm.h"
#include "chap.h"
#include "lcpproto.h"
@@ -32,6 +33,11 @@
#include "loadalias.h"
#include "vars.h"
#include "auth.h"
+#ifdef __OpenBSD__
+#include "util.h"
+#else
+#include "libutil.h"
+#endif
static char *chapcodes[] = {
"???", "CHALLENGE", "RESPONSE", "SUCCESS", "FAILURE"
@@ -184,7 +190,22 @@ RecvChapTalk(struct fsmheader * chp, struct mbuf * bp)
* Compare with the response
*/
if (bcmp(cp, cdigest, 16) == 0) {
- ChapOutput(CHAP_SUCCESS, chp->id, "Wellcome!!", 10);
+ ChapOutput(CHAP_SUCCESS, chp->id, "Welcome!!", 10);
+ 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, name, 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);
break;
}
OpenPOWER on IntegriCloud