blob: e4eb95669bee983560bb865c8e870332a2e298df [file] [log] [blame]
Andrew Geissler706d5aa2021-02-12 15:55:30 -06001This patch adds missing include for paths.h which should provide
2_PATH_LASTLOG definition
3
4Upstream-Status: Pending
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Index: Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
8===================================================================
9--- Linux-PAM-1.1.6.orig/modules/pam_lastlog/pam_lastlog.c
10+++ Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
11@@ -23,9 +23,11 @@
12 #include <stdarg.h>
13 #include <stdio.h>
14 #include <string.h>
15+#include <sys/file.h>
16 #include <sys/types.h>
17 #include <syslog.h>
18 #include <unistd.h>
19+#include <paths.h>
20
21 #if defined(hpux) || defined(sunos) || defined(solaris)
22 # ifndef _PATH_LASTLOG
23@@ -332,6 +334,23 @@ last_login_read(pam_handle_t *pamh, int
24 return retval;
25 }
26
27+#ifndef __GLIBC__
28+static void logwtmp(const char * line, const char * name, const char * host)
29+{
30+ struct utmp u;
31+ memset(&u, 0, sizeof(u));
32+
33+ u.ut_pid = getpid();
34+ u.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
35+ strncpy(u.ut_line, line, sizeof(u.ut_line));
36+ strncpy(u.ut_name, name, sizeof(u.ut_name));
37+ strncpy(u.ut_host, host, sizeof(u.ut_host));
38+ gettimeofday(&(u.ut_tv), NULL);
39+
40+ updwtmp(_PATH_WTMP, &u);
41+}
42+#endif /* __GLIBC__ */
43+
44 static int
45 last_login_write(pam_handle_t *pamh, int announce, int last_fd,
46 uid_t uid, const char *user)
47Index: Linux-PAM-1.1.6/modules/Makefile.am
48===================================================================
49--- Linux-PAM-1.1.6.orig/modules/Makefile.am
50+++ Linux-PAM-1.1.6/modules/Makefile.am
51@@ -7,7 +7,7 @@ SUBDIRS = pam_access pam_cracklib pam_de
52 pam_group pam_issue pam_keyinit pam_lastlog pam_limits \
53 pam_listfile pam_localuser pam_loginuid pam_mail \
54 pam_mkhomedir pam_motd pam_namespace pam_nologin \
55- pam_permit pam_pwhistory pam_rhosts pam_rootok pam_securetty \
56+ pam_permit pam_pwhistory pam_rootok pam_securetty \
57 pam_selinux pam_sepermit pam_shells pam_stress \
58 pam_succeed_if pam_tally pam_tally2 pam_time pam_timestamp \
59 pam_tty_audit pam_umask \