… | |
… | |
16 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
16 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
17 | * - extensive modifications |
17 | * - extensive modifications |
18 | * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> |
18 | * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> |
19 | * - lastlog support |
19 | * - lastlog support |
20 | * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> |
20 | * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> |
21 | * Copyright (c) 2006 Emanuele Giaquinta <e.giaquinta@glauco.it> |
21 | * Copyright (c) 2006 Emanuele Giaquinta <e.giaquinta@glauco.it> |
22 | * |
22 | * |
23 | * This program is free software; you can redistribute it and/or modify |
23 | * This program is free software; you can redistribute it and/or modify |
24 | * it under the terms of the GNU General Public License as published by |
24 | * it under the terms of the GNU General Public License as published by |
25 | * the Free Software Foundation; either version 2 of the License, or |
25 | * the Free Software Foundation; either version 2 of the License, or |
26 | * (at your option) any later version. |
26 | * (at your option) any later version. |
… | |
… | |
35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
35 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
36 | *----------------------------------------------------------------------*/ |
36 | *----------------------------------------------------------------------*/ |
37 | |
37 | |
38 | #include "../config.h" |
38 | #include "../config.h" |
39 | |
39 | |
|
|
40 | #include "ptytty.h" |
|
|
41 | |
|
|
42 | #if UTMP_SUPPORT |
|
|
43 | |
40 | #include <cstdio> |
44 | #include <cstdio> |
41 | |
45 | |
42 | #include <sys/types.h> |
46 | #include <sys/types.h> |
43 | #include <sys/stat.h> |
47 | #include <sys/stat.h> |
44 | #include <sys/fcntl.h> |
48 | #include <sys/fcntl.h> |
45 | #include <unistd.h> |
49 | #include <unistd.h> |
46 | #include <time.h> |
50 | #include <time.h> |
47 | |
|
|
48 | #include "ptytty.h" |
|
|
49 | |
|
|
50 | #if UTMP_SUPPORT |
|
|
51 | |
51 | |
52 | #if HAVE_STRUCT_UTMP |
52 | #if HAVE_STRUCT_UTMP |
53 | static int write_bsd_utmp (int utmp_pos, struct utmp *wu); |
53 | static int write_bsd_utmp (int utmp_pos, struct utmp *wu); |
54 | static void update_wtmp (const char *fname, const struct utmp *putmp); |
54 | static void update_wtmp (const char *fname, const struct utmp *putmp); |
55 | #endif |
55 | #endif |
… | |
… | |
426 | |
426 | |
427 | # ifdef HAVE_STRUCT_LASTLOG |
427 | # ifdef HAVE_STRUCT_LASTLOG |
428 | pwent = getpwuid (getuid ()); |
428 | pwent = getpwuid (getuid ()); |
429 | if (!pwent) |
429 | if (!pwent) |
430 | { |
430 | { |
431 | ptytty_warn ("no entry in password file, not updating lastlog.\n"); |
431 | ptytty_warn ("no entry in password file, not updating lastlog.\n", 0); |
432 | return; |
432 | return; |
433 | } |
433 | } |
434 | |
434 | |
435 | memset (&ll, 0, sizeof (ll)); |
435 | memset (&ll, 0, sizeof (ll)); |
436 | ll.ll_time = time (NULL); |
436 | ll.ll_time = time (NULL); |