diff options
Diffstat (limited to 'usr.sbin/ppp/physical.c')
-rw-r--r-- | usr.sbin/ppp/physical.c | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c index 8be8c09..fee584a 100644 --- a/usr.sbin/ppp/physical.c +++ b/usr.sbin/ppp/physical.c @@ -313,45 +313,11 @@ physical_Close(struct physical *p) physical_StopDeviceTimer(p); if (p->Utmp) { if (p->handler && (p->handler->type == TCP_DEVICE || - p->handler->type == UDP_DEVICE)) { - /* - * We've got to do more than logout() does here... we need to identify - * the entry that we made at login time.... - */ - struct utmp ut, want; - char *colon; - int fd; - - strncpy(want.ut_line, PPPOTCPLINE, sizeof want.ut_line); - strncpy(want.ut_host, p->name.base, sizeof want.ut_host); - colon = memchr(want.ut_host, ':', sizeof want.ut_host); - if (colon) - *colon = '\0'; - - if ((fd = ID0open(_PATH_WTMP, O_RDWR, 0)) >= 0) { - lseek(fd, -(off_t)sizeof(struct utmp), L_XTND); - while (read(fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) { - if (*ut.ut_name && - !memcmp(ut.ut_line, want.ut_line, sizeof ut.ut_line) && - !memcmp(ut.ut_host, want.ut_host, sizeof ut.ut_host) && - p->Utmp == ut.ut_time) { - memset(ut.ut_name, '\0', sizeof ut.ut_name); - memset(ut.ut_host, '\0', sizeof ut.ut_name); - time(&ut.ut_time); - lseek(fd, 0, L_XTND); - write(fd, &ut, sizeof ut); - *want.ut_line = '\0'; - break; - } - lseek(fd, -((off_t)sizeof(struct utmp) << 1), L_INCR); - } - close(fd); - if (*want.ut_line) - log_Printf(LogWARN, "Cannot locate %s/%.*s in %s\n", PPPOTCPLINE, - (int)(sizeof want.ut_host), want.ut_host, _PATH_WTMP); - } - } else - ID0logout(p->name.base); + p->handler->type == UDP_DEVICE)) + /* Careful - we logged in on line ``ppp'' with IP as our host */ + ID0logout(PPPOTCPLINE, 1); + else + ID0logout(p->name.base, 0); p->Utmp = 0; } newsid = tcgetpgrp(p->fd) == getpgrp(); |