1 glibc provides logwtmp in libutil, so we'll use that instead.
3 --- ppp-2.4.2/pppd/sys-linux.c 2004-03-10 18:26:53.000000000 -0500
4 +++ ppp-2.4.2/pppd/sys-linux.c 2004-03-10 18:26:40.000000000 -0500
7 /********************************************************************
9 - * Update the wtmp file with the appropriate user name and tty device.
12 -void logwtmp (const char *line, const char *name, const char *host)
14 - struct utmp ut, *utp;
15 - pid_t mypid = getpid();
21 - * Update the signon database for users.
22 - * Christoph Lameter: Copied from poeigl-1.36 Jan 3, 1996
24 - utmpname(_PATH_UTMP);
26 - while ((utp = getutent()) && (utp->ut_pid != mypid))
30 - memcpy(&ut, utp, sizeof(ut));
32 - /* some gettys/telnetds don't initialize utmp... */
33 - memset(&ut, 0, sizeof(ut));
35 - if (ut.ut_id[0] == 0)
36 - strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id));
38 - strncpy(ut.ut_user, name, sizeof(ut.ut_user));
39 - strncpy(ut.ut_line, line, sizeof(ut.ut_line));
43 - ut.ut_type = USER_PROCESS;
46 - /* Insert the host name if one is supplied */
48 - strncpy (ut.ut_host, host, sizeof(ut.ut_host));
50 - /* Insert the IP address of the remote system if IP is enabled */
51 - if (ipcp_protent.enabled_flag && ipcp_hisoptions[0].neg_addr)
52 - memcpy(&ut.ut_addr, (char *) &ipcp_hisoptions[0].hisaddr,
53 - sizeof(ut.ut_addr));
55 - /* CL: Makes sure that the logout works */
56 - if (*host == 0 && *name==0)
62 - * Update the wtmp file.
65 - updwtmp(_PATH_WTMP, &ut);
67 - wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY);
69 - flock(wtmp, LOCK_EX);
71 - if (write (wtmp, (char *)&ut, sizeof(ut)) != sizeof(ut))
72 - warn("error writing %s: %m", _PATH_WTMP);
74 - flock(wtmp, LOCK_UN);
82 -/********************************************************************
84 * sifvjcomp - config tcp header compression