aboutsummaryrefslogtreecommitdiff
path: root/x11/kdebase11/files/patch-ao
blob: 62d11535357ec64d36452a017663df48f53061aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
*** kvt/utmp.c.orig	Wed Feb 17 19:54:08 1999
--- kvt/utmp.c	Wed Apr 21 18:37:34 1999
***************
*** 78,81 ****
--- 78,86 ----
  #endif
  
+ #define UTMP_SUPPORT 1
+ #define HAVE_UTIL 1
+ #define USE_LASTLOG 1
+ #define USE_TTYENT 1
+ 
  #ifdef HAVE_LASTLOG_H
  #include <lastlog.h>
***************
*** 95,98 ****
--- 100,115 ----
  #endif
  
+ #if USE_LASTLOG
+ # include <paths.h>
+ #endif /* USE_LASTLOG */
+ 
+ #if USE_TTYENT
+ # include <ttyent.h>
+ #endif /* USE_TTYENT */
+ 
+ #if HAVE_UTIL
+ #include <sys/param.h>
+ #endif /* HAVE_UTIL */
+ 
  void cleanutent(void);
  void makeutent(char *);
***************
*** 140,144 ****
  int utmp_pos; /* position of utmp-stamp */
  
- 
  /*
   * on Sparcs login/logouts are logged at /var/adm/wtmp
--- 157,160 ----
***************
*** 146,150 ****
   */
  #ifndef UTMP
! #define UTMP "/etc/utmp"
  #endif
  
--- 162,166 ----
   */
  #ifndef UTMP
! #define UTMP _PATH_UTMP
  #endif
  
***************
*** 165,168 ****
--- 181,186 ----
  #ifdef BSD
  
+ char global_ut_line[UT_LINESIZE];
+ 
  /**************************************************************************
   * get_tslot() - grabbed from xvt-1.0 - modified by David Perry
***************
*** 178,182 ****
    int i;
    
!   if ((fs = fopen(TTYTAB,"r")) == NULL)
      return(-1);
    i = 1;
--- 196,200 ----
    int i;
    
!   if ((fs = fopen(_PATH_TTYS,"r")) == NULL)
      return(-1);
    i = 1;
***************
*** 204,207 ****
--- 222,235 ----
  {
    FILE *utmp;
+ #if USE_LASTLOG
+     FILE *llfp;
+     struct lastlog ll;
+ #endif /* USE_LASTLOG */
+ #if HAVE_UTIL
+     extern char *display_name;
+     char *p;
+     char wthost[MAXHOSTNAMELEN];
+ #endif /* HAVE_UTIL */
+ 
    if((utmp = fopen(UTMP,"r+")) == NULL)
      return -1;
***************
*** 213,216 ****
--- 241,273 ----
    fclose(utmp);
    madeutent = 1;
+ 
+ #if USE_LASTLOG
+     /* make a lastlog entry */
+     ll.ll_time = (time_t) u->ut_time;
+     (void) strncpy(ll.ll_line, u->ut_line, sizeof ll.ll_line - 1);
+     ll.ll_line[sizeof ll.ll_line - 1] = '\0';
+     (void) strncpy(ll.ll_host, u->ut_host, sizeof ll.ll_host - 1);
+     ll.ll_host[sizeof ll.ll_host - 1] = '\0';
+     llfp = fopen(_PATH_LASTLOG, "a+");
+     if (llfp) {
+         (void) fseek(llfp, getuid(), 0);
+         (void) fwrite(&ll, sizeof ll, 1, llfp);
+         (void) fclose(llfp);
+     }
+ #endif /* USE_LASTLOG */
+ 
+ #if HAVE_UTIL
+     /* save ut_line for later */
+     (void) strncpy(global_ut_line, u->ut_line, sizeof global_ut_line);
+ 
+     /* finally, log the entry to wtmp */
+     (void) strncpy(wthost, display_name, sizeof wthost - 1);
+     wthost[sizeof wthost - 1] = '\0';
+     p = strchr(wthost, ':');
+     if (p)
+         *p = '\0';
+     logwtmp(global_ut_line, u->ut_name, wthost);
+ #endif /* HAVE_UTIL */
+ 
    return(utmp_pos);
  }
***************
*** 277,280 ****
--- 334,338 ----
    fwrite((char *)&u,sizeof(struct utmp),1,ut);
    fclose(ut);
+     logwtmp(global_ut_line, "", "");
  }