Allow 8 character login names.
Pointed out by: Forgotten Do the login()/logwtmp()/logout() as id 0.
This commit is contained in:
parent
8282a07e16
commit
f1316a8643
@ -17,7 +17,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: chap.c,v 1.28.2.8 1998/02/09 19:20:34 brian Exp $
|
* $Id: chap.c,v 1.28.2.9 1998/02/15 23:59:43 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -62,6 +62,7 @@
|
|||||||
#include "descriptor.h"
|
#include "descriptor.h"
|
||||||
#include "physical.h"
|
#include "physical.h"
|
||||||
#include "bundle.h"
|
#include "bundle.h"
|
||||||
|
#include "id.h"
|
||||||
|
|
||||||
static const char *chapcodes[] = {
|
static const char *chapcodes[] = {
|
||||||
"???", "CHALLENGE", "RESPONSE", "SUCCESS", "FAILURE"
|
"???", "CHALLENGE", "RESPONSE", "SUCCESS", "FAILURE"
|
||||||
@ -245,11 +246,9 @@ RecvChapTalk(struct bundle *bundle, struct fsmheader *chp, struct mbuf *bp,
|
|||||||
struct utmp ut;
|
struct utmp ut;
|
||||||
memset(&ut, 0, sizeof ut);
|
memset(&ut, 0, sizeof ut);
|
||||||
time(&ut.ut_time);
|
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);
|
strncpy(ut.ut_line, VarBaseDevice, sizeof ut.ut_line - 1);
|
||||||
if (logout(ut.ut_line))
|
ID0login(&ut);
|
||||||
logwtmp(ut.ut_line, "", "");
|
|
||||||
login(&ut);
|
|
||||||
Utmp = 1;
|
Utmp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: id.c,v 1.6 1998/01/21 02:15:16 brian Exp $
|
* $Id: id.c,v 1.6.4.1 1998/02/08 11:07:30 brian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -32,18 +32,20 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "command.h"
|
|
||||||
#include "mbuf.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "main.h"
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#else
|
#else
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <utmp.h>
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
#include "mbuf.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "main.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
static int uid;
|
static int uid;
|
||||||
@ -175,3 +177,36 @@ ID0uu_unlock(const char *basettyname)
|
|||||||
ID0setuser();
|
ID0setuser();
|
||||||
return ret;
|
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
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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 void ID0init(void);
|
||||||
extern uid_t ID0realuid(void);
|
extern uid_t ID0realuid(void);
|
||||||
extern int ID0ioctl(int, unsigned long, 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 ID0write(int, const void *, size_t);
|
||||||
extern int ID0uu_lock(const char *);
|
extern int ID0uu_lock(const char *);
|
||||||
extern int ID0uu_unlock(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
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: modem.c,v 1.77.2.21 1998/02/17 19:28:49 brian Exp $
|
* $Id: modem.c,v 1.77.2.22 1998/02/17 19:29:00 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -840,18 +840,11 @@ modem_LogicalClose(struct physical *modem)
|
|||||||
{
|
{
|
||||||
LogPrintf(LogDEBUG, "modem_LogicalClose\n");
|
LogPrintf(LogDEBUG, "modem_LogicalClose\n");
|
||||||
if (modem->fd >= 0) {
|
if (modem->fd >= 0) {
|
||||||
modem_PhysicalClose(modem);
|
|
||||||
if (Utmp) {
|
if (Utmp) {
|
||||||
struct utmp ut;
|
ID0logout(VarBaseDevice);
|
||||||
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, "modem_LogicalClose: No longer logged in on %s\n",
|
|
||||||
ut.ut_line);
|
|
||||||
Utmp = 0;
|
Utmp = 0;
|
||||||
}
|
}
|
||||||
|
modem_PhysicalClose(modem);
|
||||||
modem_Unlock(modem);
|
modem_Unlock(modem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
*
|
||||||
* $Id: pap.c,v 1.20.2.8 1998/02/09 19:21:05 brian Exp $
|
* $Id: pap.c,v 1.20.2.9 1998/02/16 00:00:54 brian Exp $
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
*/
|
*/
|
||||||
@ -57,6 +57,7 @@
|
|||||||
#include "descriptor.h"
|
#include "descriptor.h"
|
||||||
#include "physical.h"
|
#include "physical.h"
|
||||||
#include "bundle.h"
|
#include "bundle.h"
|
||||||
|
#include "id.h"
|
||||||
|
|
||||||
static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" };
|
static const char *papcodes[] = { "???", "REQUEST", "ACK", "NAK" };
|
||||||
|
|
||||||
@ -179,11 +180,9 @@ PapInput(struct bundle *bundle, struct mbuf *bp, struct physical *physical)
|
|||||||
struct utmp ut;
|
struct utmp ut;
|
||||||
memset(&ut, 0, sizeof ut);
|
memset(&ut, 0, sizeof ut);
|
||||||
time(&ut.ut_time);
|
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);
|
strncpy(ut.ut_line, VarBaseDevice, sizeof ut.ut_line - 1);
|
||||||
if (logout(ut.ut_line))
|
ID0login(&ut);
|
||||||
logwtmp(ut.ut_line, "", "");
|
|
||||||
login(&ut);
|
|
||||||
Utmp = 1;
|
Utmp = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user