mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
MFMP: Allow 8 character login names.
Do the login()/logwtmp()/logout() as id 0.
This commit is contained in:
parent
86b1080174
commit
45ad566f11
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33603
5 changed files with 57 additions and 27 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 *);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue