summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2017-03-15 17:31:26 -0700
committerArmin Kuster <akuster808@gmail.com>2017-03-27 14:57:26 -0700
commitda2d6cd808696d0c71f2a702da6eea97167623bd (patch)
tree40d5be45bc68def53da72ec5028131e78f755694
parent6714e7672fe38e97f68e5ac613aa0a69589b3f97 (diff)
downloadmeta-security-da2d6cd808696d0c71f2a702da6eea97167623bd.tar.gz
trousers: Fix musl compile error
use POSIX getpwent instead of getpwent_r This was causing the libtspi to have the getpwent_r with when loaded via tpm-tools, it would fail. [ Yocto #11095] Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch49
-rw-r--r--recipes-tpm/trousers/trousers_git.bb1
2 files changed, 50 insertions, 0 deletions
diff --git a/recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch b/recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch
new file mode 100644
index 0000000..3f5a144
--- /dev/null
+++ b/recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch
@@ -0,0 +1,49 @@
1trousers: fix compiling with musl
2
3use POSIX getpwent instead of getpwent_r
4
5Upstream-Status: Submitted
6
7Signed-off-by: Armin Kuster <akuster@mvista.com>
8
9Index: git/src/tspi/ps/tspps.c
10===================================================================
11--- git.orig/src/tspi/ps/tspps.c
12+++ git/src/tspi/ps/tspps.c
13@@ -66,9 +66,6 @@ get_user_ps_path(char **file)
14 TSS_RESULT result;
15 char *file_name = NULL, *home_dir = NULL;
16 struct passwd *pwp;
17-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
18- struct passwd pw;
19-#endif
20 struct stat stat_buf;
21 char buf[PASSWD_BUFSIZE];
22 uid_t euid;
23@@ -96,24 +93,15 @@ get_user_ps_path(char **file)
24 #else
25 setpwent();
26 while (1) {
27-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
28- rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
29- if (rc) {
30- LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
31- strerror(rc));
32- endpwent();
33- return TSPERR(TSS_E_INTERNAL_ERROR);
34- }
35-
36-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
37 if ((pwp = getpwent()) == NULL) {
38 LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
39 strerror(rc));
40 endpwent();
41+#if (defined (__FreeBSD__) || defined (__OpenBSD__))
42 MUTEX_UNLOCK(user_ps_path);
43+#endif
44 return TSPERR(TSS_E_INTERNAL_ERROR);
45 }
46-#endif
47 if (euid == pwp->pw_uid) {
48 home_dir = strdup(pwp->pw_dir);
49 break;
diff --git a/recipes-tpm/trousers/trousers_git.bb b/recipes-tpm/trousers/trousers_git.bb
index 6671808..352374c 100644
--- a/recipes-tpm/trousers/trousers_git.bb
+++ b/recipes-tpm/trousers/trousers_git.bb
@@ -14,6 +14,7 @@ SRC_URI = " \
14 file://trousers.init.sh \ 14 file://trousers.init.sh \
15 file://trousers-udev.rules \ 15 file://trousers-udev.rules \
16 file://tcsd.service \ 16 file://tcsd.service \
17 file://get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch \
17 " 18 "
18 19
19S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"