… | |
… | |
28 | * |
28 | * |
29 | * You should have received a copy of the GNU General Public License |
29 | * You should have received a copy of the GNU General Public License |
30 | * along with this program; if not, write to the Free Software |
30 | * along with this program; if not, write to the Free Software |
31 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | *----------------------------------------------------------------------*/ |
32 | *----------------------------------------------------------------------*/ |
33 | /*----------------------------------------------------------------------* |
|
|
34 | * Public: |
|
|
35 | * extern void cleanutent (void); |
|
|
36 | * extern void makeutent (const char * pty, const char * hostname); |
|
|
37 | * |
|
|
38 | * Private: |
|
|
39 | * rxvt_update_wtmp (); |
|
|
40 | *----------------------------------------------------------------------*/ |
|
|
41 | |
33 | |
42 | #include "../config.h" |
34 | #include "../config.h" |
43 | #include "rxvt.h" |
35 | #include "rxvt.h" |
44 | #include "logging.h" |
36 | #include "logging.h" |
45 | |
37 | |
… | |
… | |
63 | |
55 | |
64 | /* |
56 | /* |
65 | * make and write utmp and wtmp entries |
57 | * make and write utmp and wtmp entries |
66 | */ |
58 | */ |
67 | void |
59 | void |
68 | rxvt_term::makeutent (const char *pty, const char *hostname) |
60 | rxvt_session::login (const char *pty, int cmd_pid, bool login_shell, const char *hostname) |
69 | { |
61 | { |
|
|
62 | this->cmd_pid = cmd_pid; |
|
|
63 | this->login_shell = login_shell; |
|
|
64 | |
70 | #ifdef HAVE_STRUCT_UTMP |
65 | #ifdef HAVE_STRUCT_UTMP |
71 | struct utmp *ut = &this->ut; |
66 | struct utmp *ut = &this->ut; |
72 | #endif |
67 | #endif |
73 | #ifdef HAVE_STRUCT_UTMPX |
68 | #ifdef HAVE_STRUCT_UTMPX |
74 | struct utmpx *utx = &this->utx; |
69 | struct utmpx *utx = &this->utx; |
… | |
… | |
199 | } |
194 | } |
200 | #endif |
195 | #endif |
201 | |
196 | |
202 | #ifdef WTMP_SUPPORT |
197 | #ifdef WTMP_SUPPORT |
203 | # ifdef WTMP_ONLY_ON_LOGIN |
198 | # ifdef WTMP_ONLY_ON_LOGIN |
204 | if (OPTION (Opt_loginShell)) |
199 | if (login_shell) |
205 | # endif |
200 | # endif |
206 | { |
201 | { |
207 | # ifdef HAVE_STRUCT_UTMP |
202 | # ifdef HAVE_STRUCT_UTMP |
208 | # ifdef HAVE_UPDWTMP |
203 | # ifdef HAVE_UPDWTMP |
209 | updwtmp (RXVT_WTMP_FILE, ut); |
204 | updwtmp (RXVT_WTMP_FILE, ut); |
… | |
… | |
215 | updwtmpx (RXVT_WTMPX_FILE, utx); |
210 | updwtmpx (RXVT_WTMPX_FILE, utx); |
216 | # endif |
211 | # endif |
217 | } |
212 | } |
218 | #endif |
213 | #endif |
219 | #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) |
214 | #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) |
220 | if (OPTION (Opt_loginShell)) |
215 | if (login_shell) |
221 | rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname); |
216 | rxvt_update_lastlog (RXVT_LASTLOG_FILE, pty, hostname); |
222 | #endif |
217 | #endif |
223 | } |
218 | } |
224 | |
219 | |
225 | /* ------------------------------------------------------------------------- */ |
220 | /* ------------------------------------------------------------------------- */ |
226 | /* |
221 | /* |
227 | * remove utmp and wtmp entries |
222 | * remove utmp and wtmp entries |
228 | */ |
223 | */ |
229 | void |
224 | void |
230 | rxvt_term::cleanutent () |
225 | rxvt_session::logout () |
231 | { |
226 | { |
232 | #ifdef HAVE_STRUCT_UTMP |
227 | #ifdef HAVE_STRUCT_UTMP |
233 | struct utmp *ut = &this->ut; |
228 | struct utmp *ut = &this->ut; |
234 | #endif |
229 | #endif |
235 | #ifdef HAVE_STRUCT_UTMPX |
230 | #ifdef HAVE_STRUCT_UTMPX |
… | |
… | |
276 | /* |
271 | /* |
277 | * Write ending wtmp entry |
272 | * Write ending wtmp entry |
278 | */ |
273 | */ |
279 | #ifdef WTMP_SUPPORT |
274 | #ifdef WTMP_SUPPORT |
280 | # ifdef WTMP_ONLY_ON_LOGIN |
275 | # ifdef WTMP_ONLY_ON_LOGIN |
281 | if (OPTION (Opt_loginShell)) |
276 | if (login_shell) |
282 | # endif |
277 | # endif |
283 | { |
278 | { |
284 | # ifdef HAVE_STRUCT_UTMP |
279 | # ifdef HAVE_STRUCT_UTMP |
285 | # ifdef HAVE_UPDWTMP |
280 | # ifdef HAVE_UPDWTMP |
286 | updwtmp (RXVT_WTMP_FILE, ut); |
281 | updwtmp (RXVT_WTMP_FILE, ut); |