87 lines
2.1 KiB
Diff
87 lines
2.1 KiB
Diff
|
glibc provides logwtmp in libutil, so we'll use that instead.
|
||
|
|
||
|
--- ppp-2.4.2/pppd/sys-linux.c 2004-03-10 18:26:53.000000000 -0500
|
||
|
+++ ppp-2.4.2/pppd/sys-linux.c 2004-03-10 18:26:40.000000000 -0500
|
||
|
@@ -2151,81 +2151,6 @@
|
||
|
|
||
|
/********************************************************************
|
||
|
*
|
||
|
- * Update the wtmp file with the appropriate user name and tty device.
|
||
|
- */
|
||
|
-
|
||
|
-void logwtmp (const char *line, const char *name, const char *host)
|
||
|
-{
|
||
|
- struct utmp ut, *utp;
|
||
|
- pid_t mypid = getpid();
|
||
|
-#if __GLIBC__ < 2
|
||
|
- int wtmp;
|
||
|
-#endif
|
||
|
-
|
||
|
-/*
|
||
|
- * Update the signon database for users.
|
||
|
- * Christoph Lameter: Copied from poeigl-1.36 Jan 3, 1996
|
||
|
- */
|
||
|
- utmpname(_PATH_UTMP);
|
||
|
- setutent();
|
||
|
- while ((utp = getutent()) && (utp->ut_pid != mypid))
|
||
|
- /* nothing */;
|
||
|
-
|
||
|
- if (utp)
|
||
|
- memcpy(&ut, utp, sizeof(ut));
|
||
|
- else
|
||
|
- /* some gettys/telnetds don't initialize utmp... */
|
||
|
- memset(&ut, 0, sizeof(ut));
|
||
|
-
|
||
|
- if (ut.ut_id[0] == 0)
|
||
|
- strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id));
|
||
|
-
|
||
|
- strncpy(ut.ut_user, name, sizeof(ut.ut_user));
|
||
|
- strncpy(ut.ut_line, line, sizeof(ut.ut_line));
|
||
|
-
|
||
|
- time(&ut.ut_time);
|
||
|
-
|
||
|
- ut.ut_type = USER_PROCESS;
|
||
|
- ut.ut_pid = mypid;
|
||
|
-
|
||
|
- /* Insert the host name if one is supplied */
|
||
|
- if (*host)
|
||
|
- strncpy (ut.ut_host, host, sizeof(ut.ut_host));
|
||
|
-
|
||
|
- /* Insert the IP address of the remote system if IP is enabled */
|
||
|
- if (ipcp_protent.enabled_flag && ipcp_hisoptions[0].neg_addr)
|
||
|
- memcpy(&ut.ut_addr, (char *) &ipcp_hisoptions[0].hisaddr,
|
||
|
- sizeof(ut.ut_addr));
|
||
|
-
|
||
|
- /* CL: Makes sure that the logout works */
|
||
|
- if (*host == 0 && *name==0)
|
||
|
- ut.ut_host[0]=0;
|
||
|
-
|
||
|
- pututline(&ut);
|
||
|
- endutent();
|
||
|
-/*
|
||
|
- * Update the wtmp file.
|
||
|
- */
|
||
|
-#if __GLIBC__ >= 2
|
||
|
- updwtmp(_PATH_WTMP, &ut);
|
||
|
-#else
|
||
|
- wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY);
|
||
|
- if (wtmp >= 0) {
|
||
|
- flock(wtmp, LOCK_EX);
|
||
|
-
|
||
|
- if (write (wtmp, (char *)&ut, sizeof(ut)) != sizeof(ut))
|
||
|
- warn("error writing %s: %m", _PATH_WTMP);
|
||
|
-
|
||
|
- flock(wtmp, LOCK_UN);
|
||
|
-
|
||
|
- close (wtmp);
|
||
|
- }
|
||
|
-#endif
|
||
|
-}
|
||
|
-
|
||
|
-
|
||
|
-/********************************************************************
|
||
|
- *
|
||
|
* sifvjcomp - config tcp header compression
|
||
|
*/
|
||
|
|