summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1998-02-19 02:10:13 +0000
committerbrian <brian@FreeBSD.org>1998-02-19 02:10:13 +0000
commit5b9c68270e4cd9c5f15391f1690bab700d14d3c6 (patch)
tree79cdbf4ab50c51835cc0f9372fe5b2c4e08750de /usr.sbin/ppp
parent7a0499eae564b147d6bd8e5703bdce285e56e446 (diff)
downloadFreeBSD-src-5b9c68270e4cd9c5f15391f1690bab700d14d3c6.zip
FreeBSD-src-5b9c68270e4cd9c5f15391f1690bab700d14d3c6.tar.gz
MFMP: Allow 8 character login names.
Do the login()/logwtmp()/logout() as id 0.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/chap.c9
-rw-r--r--usr.sbin/ppp/id.c47
-rw-r--r--usr.sbin/ppp/id.h6
-rw-r--r--usr.sbin/ppp/modem.c13
-rw-r--r--usr.sbin/ppp/pap.c9
5 files changed, 57 insertions, 27 deletions
diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c
index 28bd5e3..727699d 100644
--- a/usr.sbin/ppp/chap.c
+++ b/usr.sbin/ppp/chap.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: chap.c,v 1.27 1997/12/07 23:55:25 brian Exp $
+ * $Id: chap.c,v 1.28 1997/12/24 09:28:53 brian Exp $
*
* TODO:
*/
@@ -56,6 +56,7 @@
#include "loadalias.h"
#include "vars.h"
#include "auth.h"
+#include "id.h"
static const char *chapcodes[] = {
"???", "CHALLENGE", "RESPONSE", "SUCCESS", "FAILURE"
@@ -232,11 +233,9 @@ RecvChapTalk(struct fsmheader *chp, struct mbuf *bp)
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_name, name, sizeof ut.ut_name);
strncpy(ut.ut_line, VarBaseDevice, sizeof ut.ut_line - 1);
- if (logout(ut.ut_line))
- logwtmp(ut.ut_line, "", "");
- login(&ut);
+ ID0login(&ut);
Utmp = 1;
}
NewPhase(PHASE_NETWORK);
diff --git a/usr.sbin/ppp/id.c b/usr.sbin/ppp/id.c
index af41207..b6ff63f 100644
--- a/usr.sbin/ppp/id.c
+++ b/usr.sbin/ppp/id.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: id.c,v 1.5 1997/12/27 19:23:12 brian Exp $
+ * $Id: id.c,v 1.6 1998/01/21 02:15:16 brian Exp $
*/
#include <sys/types.h>
@@ -32,18 +32,20 @@
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
+#include <string.h>
#include <sysexits.h>
#include <unistd.h>
-
-#include "command.h"
-#include "mbuf.h"
-#include "log.h"
-#include "main.h"
#ifdef __OpenBSD__
#include <util.h>
#else
#include <libutil.h>
#endif
+#include <utmp.h>
+
+#include "command.h"
+#include "mbuf.h"
+#include "log.h"
+#include "main.h"
#include "id.h"
static int uid;
@@ -175,3 +177,36 @@ ID0uu_unlock(const char *basettyname)
ID0setuser();
return ret;
}
+
+void
+ID0login(struct utmp *ut)
+{
+ ID0set0();
+ if (logout(ut->ut_line)) {
+ LogPrintf(LogID0, "logout(\"%s\")\n", ut->ut_line);
+ logwtmp(ut->ut_line, "", "");
+ LogPrintf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut->ut_line);
+ }
+ login(ut);
+ LogPrintf(LogID0, "login(\"%s\", \"%.*s\")\n",
+ ut->ut_line, sizeof ut->ut_name, ut->ut_name);
+ ID0setuser();
+}
+
+void
+ID0logout(const char *device)
+{
+ struct utmp ut;
+
+ strncpy(ut.ut_line, device, sizeof ut.ut_line - 1);
+ ut.ut_line[sizeof ut.ut_line - 1] = '\0';
+
+ ID0set0();
+ if (logout(ut.ut_line)) {
+ LogPrintf(LogID0, "logout(\"%s\")\n", ut.ut_line);
+ logwtmp(ut.ut_line, "", "");
+ LogPrintf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut.ut_line);
+ } else
+ LogPrintf(LogERROR, "ID0logout: No longer logged in on %s\n", ut.ut_line);
+ ID0setuser();
+}
diff --git a/usr.sbin/ppp/id.h b/usr.sbin/ppp/id.h
index 121e8da..6dba7b8 100644
--- a/usr.sbin/ppp/id.h
+++ b/usr.sbin/ppp/id.h
@@ -23,9 +23,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: id.h,v 1.2 1997/12/21 12:11:05 brian Exp $
+ * $Id: id.h,v 1.3 1997/12/27 19:23:13 brian Exp $
*/
+struct utmp;
+
extern void ID0init(void);
extern uid_t ID0realuid(void);
extern int ID0ioctl(int, unsigned long, void *);
@@ -36,3 +38,5 @@ extern int ID0open(const char *, int);
extern int ID0write(int, const void *, size_t);
extern int ID0uu_lock(const char *);
extern int ID0uu_unlock(const char *);
+extern void ID0login(struct utmp *);
+extern void ID0logout(const char *);
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index 2412755..ae6be96 100644
--- a/usr.sbin/ppp/modem.c
+++ b/usr.sbin/ppp/modem.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: modem.c,v 1.76 1998/01/21 02:15:22 brian Exp $
+ * $Id: modem.c,v 1.77 1998/01/29 00:42:05 brian Exp $
*
* TODO:
*/
@@ -738,18 +738,11 @@ CloseLogicalModem(void)
{
LogPrintf(LogDEBUG, "CloseLogicalModem\n");
if (modem >= 0) {
- ClosePhysicalModem();
if (Utmp) {
- struct utmp ut;
- strncpy(ut.ut_line, VarBaseDevice, sizeof ut.ut_line - 1);
- ut.ut_line[sizeof ut.ut_line - 1] = '\0';
- if (logout(ut.ut_line))
- logwtmp(ut.ut_line, "", "");
- else
- LogPrintf(LogERROR, "CloseLogicalModem: No longer logged in on %s\n",
- ut.ut_line);
+ ID0logout(VarBaseDevice);
Utmp = 0;
}
+ ClosePhysicalModem();
UnlockModem();
}
}
diff --git a/usr.sbin/ppp/pap.c b/usr.sbin/ppp/pap.c
index ac2c763..2a320ac 100644
--- a/usr.sbin/ppp/pap.c
+++ b/usr.sbin/ppp/pap.c
@@ -18,7 +18,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: pap.c,v 1.19 1997/11/22 03:37:43 brian Exp $
+ * $Id: pap.c,v 1.20 1997/12/24 09:29:11 brian Exp $
*
* TODO:
*/
@@ -51,6 +51,7 @@
#include "lcpproto.h"
#include "phase.h"
#include "auth.h"
+#include "id.h"
static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" };
@@ -173,11 +174,9 @@ PapInput(struct mbuf * bp)
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_name, cp+1, sizeof ut.ut_name);
strncpy(ut.ut_line, VarBaseDevice, sizeof ut.ut_line - 1);
- if (logout(ut.ut_line))
- logwtmp(ut.ut_line, "", "");
- login(&ut);
+ ID0login(&ut);
Utmp = 1;
}
NewPhase(PHASE_NETWORK);
OpenPOWER on IntegriCloud