mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
libpam: Fix build with musl
Define strndupa if not available in libc additionally fix headers to explicitly needed include files which glibc was including indirectly (From OE-Core rev: 24097d8bb481ed1312c45b2e93527a271f56e4be) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
This patch adds missing include for paths.h which should provide
|
||||
_PATH_LASTLOG definition
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Index: Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
|
||||
===================================================================
|
||||
--- Linux-PAM-1.1.6.orig/modules/pam_lastlog/pam_lastlog.c
|
||||
+++ Linux-PAM-1.1.6/modules/pam_lastlog/pam_lastlog.c
|
||||
@@ -23,9 +23,11 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
+#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
+#include <paths.h>
|
||||
|
||||
#if defined(hpux) || defined(sunos) || defined(solaris)
|
||||
# ifndef _PATH_LASTLOG
|
||||
@@ -332,6 +334,23 @@ last_login_read(pam_handle_t *pamh, int
|
||||
return retval;
|
||||
}
|
||||
|
||||
+#ifndef __GLIBC__
|
||||
+static void logwtmp(const char * line, const char * name, const char * host)
|
||||
+{
|
||||
+ struct utmp u;
|
||||
+ memset(&u, 0, sizeof(u));
|
||||
+
|
||||
+ u.ut_pid = getpid();
|
||||
+ u.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS;
|
||||
+ strncpy(u.ut_line, line, sizeof(u.ut_line));
|
||||
+ strncpy(u.ut_name, name, sizeof(u.ut_name));
|
||||
+ strncpy(u.ut_host, host, sizeof(u.ut_host));
|
||||
+ gettimeofday(&(u.ut_tv), NULL);
|
||||
+
|
||||
+ updwtmp(_PATH_WTMP, &u);
|
||||
+}
|
||||
+#endif /* __GLIBC__ */
|
||||
+
|
||||
static int
|
||||
last_login_write(pam_handle_t *pamh, int announce, int last_fd,
|
||||
uid_t uid, const char *user)
|
||||
Index: Linux-PAM-1.1.6/modules/Makefile.am
|
||||
===================================================================
|
||||
--- Linux-PAM-1.1.6.orig/modules/Makefile.am
|
||||
+++ Linux-PAM-1.1.6/modules/Makefile.am
|
||||
@@ -7,7 +7,7 @@ SUBDIRS = pam_access pam_cracklib pam_de
|
||||
pam_group pam_issue pam_keyinit pam_lastlog pam_limits \
|
||||
pam_listfile pam_localuser pam_loginuid pam_mail \
|
||||
pam_mkhomedir pam_motd pam_namespace pam_nologin \
|
||||
- pam_permit pam_pwhistory pam_rhosts pam_rootok pam_securetty \
|
||||
+ pam_permit pam_pwhistory pam_rootok pam_securetty \
|
||||
pam_selinux pam_sepermit pam_shells pam_stress \
|
||||
pam_succeed_if pam_tally pam_tally2 pam_time pam_timestamp \
|
||||
pam_tty_audit pam_umask \
|
||||
Reference in New Issue
Block a user