diff options
3 files changed, 131 insertions, 1 deletions
diff --git a/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch b/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch new file mode 100644 index 0000000000..c55b648139 --- /dev/null +++ b/meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | From 45d1ed58927593968faead7dbb295f3922f41a2f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 8 Aug 2015 14:16:43 -0700 | ||
| 4 | Subject: [PATCH] Add support for defining missing funcitonality | ||
| 5 | |||
| 6 | In order to support alternative libc on linux ( musl, bioninc ) etc we | ||
| 7 | need to check for glibc-only features and provide alternatives, in this | ||
| 8 | list strndupa is first one, when configure detects that its not included | ||
| 9 | in system C library then the altrnative implementation from missing.h is | ||
| 10 | used | ||
| 11 | |||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | Upstream-Status: Pending | ||
| 15 | |||
| 16 | configure.ac | 3 +++ | ||
| 17 | libpam/include/missing.h | 12 ++++++++++++ | ||
| 18 | modules/pam_exec/pam_exec.c | 1 + | ||
| 19 | 3 files changed, 16 insertions(+) | ||
| 20 | create mode 100644 libpam/include/missing.h | ||
| 21 | |||
| 22 | diff --git a/configure.ac b/configure.ac | ||
| 23 | index 9e1257f..cbed979 100644 | ||
| 24 | --- a/configure.ac | ||
| 25 | +++ b/configure.ac | ||
| 26 | @@ -599,6 +599,9 @@ dnl | ||
| 27 | AC_CHECK_DECL(__NR_keyctl, [have_key_syscalls=1],[have_key_syscalls=0],[#include <sys/syscall.h>]) | ||
| 28 | AC_CHECK_DECL(ENOKEY, [have_key_errors=1],[have_key_errors=0],[#include <errno.h>]) | ||
| 29 | |||
| 30 | +# musl and bionic don't have strndupa | ||
| 31 | +AC_CHECK_DECLS_ONCE([strndupa]) | ||
| 32 | + | ||
| 33 | HAVE_KEY_MANAGEMENT=0 | ||
| 34 | if test $have_key_syscalls$have_key_errors = 11 | ||
| 35 | then | ||
| 36 | diff --git a/libpam/include/missing.h b/libpam/include/missing.h | ||
| 37 | new file mode 100644 | ||
| 38 | index 0000000..3cf011c | ||
| 39 | --- /dev/null | ||
| 40 | +++ b/libpam/include/missing.h | ||
| 41 | @@ -0,0 +1,12 @@ | ||
| 42 | +#pragma once | ||
| 43 | + | ||
| 44 | +#if !HAVE_DECL_STRNDUPA | ||
| 45 | +#define strndupa(s, n) \ | ||
| 46 | + ({ \ | ||
| 47 | + const char *__old = (s); \ | ||
| 48 | + size_t __len = strnlen(__old, (n)); \ | ||
| 49 | + char *__new = alloca(__len + 1); \ | ||
| 50 | + __new[__len] = '\0'; \ | ||
| 51 | + memcpy(__new, __old, __len); \ | ||
| 52 | + }) | ||
| 53 | +#endif | ||
| 54 | diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c | ||
| 55 | index 17ba6ca..3aa2694 100644 | ||
| 56 | --- a/modules/pam_exec/pam_exec.c | ||
| 57 | +++ b/modules/pam_exec/pam_exec.c | ||
| 58 | @@ -59,6 +59,7 @@ | ||
| 59 | #include <security/pam_modutil.h> | ||
| 60 | #include <security/pam_ext.h> | ||
| 61 | #include <security/_pam_macros.h> | ||
| 62 | +#include <missing.h> | ||
| 63 | |||
| 64 | #define ENV_ITEM(n) { (n), #n } | ||
| 65 | static struct { | ||
| 66 | -- | ||
| 67 | 2.1.4 | ||
| 68 | |||
diff --git a/meta/recipes-extended/pam/libpam/include_paths_header.patch b/meta/recipes-extended/pam/libpam/include_paths_header.patch new file mode 100644 index 0000000000..e4eb95669b --- /dev/null +++ b/meta/recipes-extended/pam/libpam/include_paths_header.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | This patch adds missing include for paths.h which should provide | ||
| 2 | _PATH_LASTLOG definition | ||
| 3 | |||
| 4 | Upstream-Status: Pending | ||
| 5 | |||
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 7 | Index: 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) | ||
| 47 | Index: 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 \ | ||
diff --git a/meta/recipes-extended/pam/libpam_1.2.1.bb b/meta/recipes-extended/pam/libpam_1.2.1.bb index 0353356568..7e81e7221a 100644 --- a/meta/recipes-extended/pam/libpam_1.2.1.bb +++ b/meta/recipes-extended/pam/libpam_1.2.1.bb | |||
| @@ -31,7 +31,10 @@ SRC_URI[sha256sum] = "342b1211c0d3b203a7df2540a5b03a428a087bd8a48c17e49ae268f992 | |||
| 31 | SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch \ | 31 | SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch \ |
| 32 | file://use-utmpx.patch" | 32 | file://use-utmpx.patch" |
| 33 | 33 | ||
| 34 | SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch" | 34 | SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch \ |
| 35 | file://0001-Add-support-for-defining-missing-funcitonality.patch \ | ||
| 36 | file://include_paths_header.patch \ | ||
| 37 | " | ||
| 35 | 38 | ||
| 36 | DEPENDS = "bison flex flex-native cracklib" | 39 | DEPENDS = "bison flex flex-native cracklib" |
| 37 | 40 | ||
