1 |
glibc provides logwtmp in libutil, so we'll use that instead. |
2 |
|
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 |
5 |
@@ -2151,81 +2151,6 @@ |
6 |
|
7 |
/******************************************************************** |
8 |
* |
9 |
- * Update the wtmp file with the appropriate user name and tty device. |
10 |
- */ |
11 |
- |
12 |
-void logwtmp (const char *line, const char *name, const char *host) |
13 |
-{ |
14 |
- struct utmp ut, *utp; |
15 |
- pid_t mypid = getpid(); |
16 |
-#if __GLIBC__ < 2 |
17 |
- int wtmp; |
18 |
-#endif |
19 |
- |
20 |
-/* |
21 |
- * Update the signon database for users. |
22 |
- * Christoph Lameter: Copied from poeigl-1.36 Jan 3, 1996 |
23 |
- */ |
24 |
- utmpname(_PATH_UTMP); |
25 |
- setutent(); |
26 |
- while ((utp = getutent()) && (utp->ut_pid != mypid)) |
27 |
- /* nothing */; |
28 |
- |
29 |
- if (utp) |
30 |
- memcpy(&ut, utp, sizeof(ut)); |
31 |
- else |
32 |
- /* some gettys/telnetds don't initialize utmp... */ |
33 |
- memset(&ut, 0, sizeof(ut)); |
34 |
- |
35 |
- if (ut.ut_id[0] == 0) |
36 |
- strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id)); |
37 |
- |
38 |
- strncpy(ut.ut_user, name, sizeof(ut.ut_user)); |
39 |
- strncpy(ut.ut_line, line, sizeof(ut.ut_line)); |
40 |
- |
41 |
- time(&ut.ut_time); |
42 |
- |
43 |
- ut.ut_type = USER_PROCESS; |
44 |
- ut.ut_pid = mypid; |
45 |
- |
46 |
- /* Insert the host name if one is supplied */ |
47 |
- if (*host) |
48 |
- strncpy (ut.ut_host, host, sizeof(ut.ut_host)); |
49 |
- |
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)); |
54 |
- |
55 |
- /* CL: Makes sure that the logout works */ |
56 |
- if (*host == 0 && *name==0) |
57 |
- ut.ut_host[0]=0; |
58 |
- |
59 |
- pututline(&ut); |
60 |
- endutent(); |
61 |
-/* |
62 |
- * Update the wtmp file. |
63 |
- */ |
64 |
-#if __GLIBC__ >= 2 |
65 |
- updwtmp(_PATH_WTMP, &ut); |
66 |
-#else |
67 |
- wtmp = open(_PATH_WTMP, O_APPEND|O_WRONLY); |
68 |
- if (wtmp >= 0) { |
69 |
- flock(wtmp, LOCK_EX); |
70 |
- |
71 |
- if (write (wtmp, (char *)&ut, sizeof(ut)) != sizeof(ut)) |
72 |
- warn("error writing %s: %m", _PATH_WTMP); |
73 |
- |
74 |
- flock(wtmp, LOCK_UN); |
75 |
- |
76 |
- close (wtmp); |
77 |
- } |
78 |
-#endif |
79 |
-} |
80 |
- |
81 |
- |
82 |
-/******************************************************************** |
83 |
- * |
84 |
* sifvjcomp - config tcp header compression |
85 |
*/ |
86 |
|