summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Draszik <adraszik@tycoint.com>2016-11-28 09:31:30 +0000
committerArmin Kuster <akuster@mvista.com>2016-12-15 13:26:19 -0800
commit27420dbbd20809381b154ebc237d4e8dbcf4d1d4 (patch)
tree346e9bd55e5d1ec3bb73deeb4bb81e82985b8c49
parenta962fb5d6814c23c9cb6eebddaf7551c1d15e39d (diff)
downloadmeta-security-27420dbbd20809381b154ebc237d4e8dbcf4d1d4.tar.gz
trousers: fix musl compilation
Backport patches to fix compilation. Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Armin Kuster <akuster@mvista.com>
-rw-r--r--recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch85
-rw-r--r--recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch36
-rw-r--r--recipes-tpm/trousers/trousers_0.3.13.bb2
3 files changed, 123 insertions, 0 deletions
diff --git a/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch b/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch
new file mode 100644
index 0000000..e7ba2eb
--- /dev/null
+++ b/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch
@@ -0,0 +1,85 @@
1From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?No=C3=A9=20Rubinstein?= <nrubinstein@aldebaran.com>
3Date: Wed, 24 Aug 2016 18:55:25 +0200
4Subject: [PATCH] Check that getpwent_r is available before using it
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9This fixes building trousers with musl
10
11Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
12---
13Upstream-Status: Inappropriate [not author https://git.busybox.net/buildroot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-using-it.patch]
14Signed-off-by: André Draszik <adraszik@tycoint.com>
15 configure.in | 4 ++++
16 src/tspi/ps/tspps.c | 10 +++++-----
17 2 files changed, 9 insertions(+), 5 deletions(-)
18
19diff --git a/configure.in b/configure.in
20index add23dc..cfdfcaa 100644
21--- a/configure.in
22+++ b/configure.in
23@@ -144,6 +144,10 @@ else
24 AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported gui options for trousers])
25 fi
26
27+# Look for getpwent_r. If it is not found, getpwent will be used instead, with
28+# an additional mutex.
29+AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)])
30+
31 #
32 # The default port that the TCS daemon listens on
33 #
34diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c
35index c6f9c3d..9d00d2a 100644
36--- a/src/tspi/ps/tspps.c
37+++ b/src/tspi/ps/tspps.c
38@@ -45,7 +45,7 @@
39
40 static int user_ps_fd = -1;
41 static MUTEX_DECLARE_INIT(user_ps_lock);
42-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
43+#ifndef HAVE_GETPWENT_R
44 static MUTEX_DECLARE_INIT(user_ps_path);
45 #endif
46 static struct flock fl;
47@@ -60,7 +60,7 @@ get_user_ps_path(char **file)
48 TSS_RESULT result;
49 char *file_name = NULL, *home_dir = NULL;
50 struct passwd *pwp;
51-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
52+#ifdef HAVE_GETPWENT_R
53 struct passwd pw;
54 #endif
55 struct stat stat_buf;
56@@ -72,7 +72,7 @@ get_user_ps_path(char **file)
57 *file = strdup(file_name);
58 return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
59 }
60-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
61+#ifndef HAVE_GETPWENT_R
62 MUTEX_LOCK(user_ps_path);
63 #endif
64
65@@ -90,7 +90,7 @@ get_user_ps_path(char **file)
66 #else
67 setpwent();
68 while (1) {
69-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
70+#ifdef HAVE_GETPWENT_R
71 rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
72 if (rc) {
73 LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
74@@ -99,7 +99,7 @@ get_user_ps_path(char **file)
75 return TSPERR(TSS_E_INTERNAL_ERROR);
76 }
77
78-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
79+#else
80 if ((pwp = getpwent()) == NULL) {
81 LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
82 strerror(rc));
83--
842.10.2
85
diff --git a/recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch b/recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch
new file mode 100644
index 0000000..c01040d
--- /dev/null
+++ b/recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch
@@ -0,0 +1,36 @@
1From c1b5f33845c56dc7aef769c99758b4f77a041d43 Mon Sep 17 00:00:00 2001
2From: Felix Janda <felix.janda@posteo.de>
3Date: Wed, 31 Aug 2016 22:52:58 -0400
4Subject: [PATCH] tsp_tcsi_param.c: Include <limits.h> for POSIX_MAX
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Use POSIX instead of glibc-specific header.
10Fixes compilation with musl libc.
11
12Signed-off-by: Felix Janda <felix.janda@posteo.de>
13Reviewed-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
14
15---
16Upstream-Status: Backport [https://sourceforge.net/p/trousers/trousers/ci/59351a56cac1710e89d207dff07eb23bbc644c13/]
17Signed-off-by: André Draszik <adraszik@tycoint.com>
18 src/tspi/tsp_tcsi_param.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/src/tspi/tsp_tcsi_param.c b/src/tspi/tsp_tcsi_param.c
22index 670f86f..8f2b4e4 100644
23--- a/src/tspi/tsp_tcsi_param.c
24+++ b/src/tspi/tsp_tcsi_param.c
25@@ -11,7 +11,7 @@
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdio.h>
29-#include <bits/local_lim.h>
30+#include <limits.h>
31 #include "trousers/tss.h"
32 #include "trousers/trousers.h"
33 #include "trousers_types.h"
34--
352.10.2
36
diff --git a/recipes-tpm/trousers/trousers_0.3.13.bb b/recipes-tpm/trousers/trousers_0.3.13.bb
index 6853f18..a69f763 100644
--- a/recipes-tpm/trousers/trousers_0.3.13.bb
+++ b/recipes-tpm/trousers/trousers_0.3.13.bb
@@ -7,6 +7,8 @@ SECTION = "security/tpm"
7DEPENDS = "openssl" 7DEPENDS = "openssl"
8 8
9SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \ 9SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
10 file://0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch \
11 file://0001-Check-that-getpwent_r-is-available-before-using-it.patch \
10 file://07-read_data-not-inline.patch \ 12 file://07-read_data-not-inline.patch \
11 file://trousers.init.sh \ 13 file://trousers.init.sh \
12 file://trousers-udev.rules \ 14 file://trousers-udev.rules \