diff options
Diffstat (limited to 'meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch')
-rw-r--r-- | meta/recipes-extended/pam/libpam/0001-Add-support-for-defining-missing-funcitonality.patch | 68 |
1 files changed, 68 insertions, 0 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 | |||