All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-security][PATCH] trousers: fix musl compilation
@ 2016-11-25 16:29 André Draszik
  2016-11-28  9:31 ` [meta-security][PATCH v2] " André Draszik
  0 siblings, 1 reply; 4+ messages in thread
From: André Draszik @ 2016-11-25 16:29 UTC (permalink / raw)
  To: yocto

From: André Draszik <adraszik@tycoint.com>

Backport patches to fix compilation.

Signed-off-by: André Draszik <adraszik@tycoint.com>
---
 ...t-getpwent_r-is-available-before-using-it.patch | 85 ++++++++++++++++++++++
 ...si_param.c-Include-limits.h-for-POSIX_MAX.patch | 36 +++++++++
 recipes-tpm/trousers/trousers_0.3.13.bb            |  2 +
 3 files changed, 123 insertions(+)
 create mode 100644 recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch
 create mode 100644 recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch

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..3c57394
--- /dev/null
+++ b/recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch
@@ -0,0 +1,85 @@
+From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?No=C3=A9=20Rubinstein?= <nrubinstein@aldebaran.com>
+Date: Wed, 24 Aug 2016 18:55:25 +0200
+Subject: [PATCH] Check that getpwent_r is available before using it
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes building trousers with musl
+
+Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
+---
+Upstream-Status: Pending [https://git.busybox.net/buildroot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-using-it.patch]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+ configure.in        |  4 ++++
+ src/tspi/ps/tspps.c | 10 +++++-----
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index add23dc..cfdfcaa 100644
+--- a/configure.in
++++ b/configure.in
+@@ -144,6 +144,10 @@ else
+ 	AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported gui options for trousers])
+ fi
+ 
++# Look for getpwent_r. If it is not found, getpwent will be used instead, with
++# an additional mutex.
++AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)])
++
+ #
+ # The default port that the TCS daemon listens on
+ #
+diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c
+index c6f9c3d..9d00d2a 100644
+--- a/src/tspi/ps/tspps.c
++++ b/src/tspi/ps/tspps.c
+@@ -45,7 +45,7 @@
+ 
+ static int user_ps_fd = -1;
+ static MUTEX_DECLARE_INIT(user_ps_lock);
+-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
++#ifndef HAVE_GETPWENT_R
+ static MUTEX_DECLARE_INIT(user_ps_path);
+ #endif
+ static struct flock fl;
+@@ -60,7 +60,7 @@ get_user_ps_path(char **file)
+ 	TSS_RESULT result;
+ 	char *file_name = NULL, *home_dir = NULL;
+ 	struct passwd *pwp;
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
++#ifdef HAVE_GETPWENT_R
+ 	struct passwd pw;
+ #endif
+ 	struct stat stat_buf;
+@@ -72,7 +72,7 @@ get_user_ps_path(char **file)
+ 		*file = strdup(file_name);
+ 		return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
+ 	}
+-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
++#ifndef HAVE_GETPWENT_R
+ 	MUTEX_LOCK(user_ps_path);
+ #endif
+ 
+@@ -90,7 +90,7 @@ get_user_ps_path(char **file)
+ #else
+ 	setpwent();
+ 	while (1) {
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
++#ifdef HAVE_GETPWENT_R
+ 		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
+ 		if (rc) {
+ 			LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
+@@ -99,7 +99,7 @@ get_user_ps_path(char **file)
+ 			return TSPERR(TSS_E_INTERNAL_ERROR);
+ 		}
+ 
+-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
++#else
+ 		if ((pwp = getpwent()) == NULL) {
+ 			LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
+                                    strerror(rc));
+-- 
+2.10.2
+
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 @@
+From c1b5f33845c56dc7aef769c99758b4f77a041d43 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Wed, 31 Aug 2016 22:52:58 -0400
+Subject: [PATCH] tsp_tcsi_param.c: Include <limits.h> for POSIX_MAX
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Use POSIX instead of glibc-specific header.
+Fixes compilation with musl libc.
+
+Signed-off-by: Felix Janda <felix.janda@posteo.de>
+Reviewed-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
+
+---
+Upstream-Status: Backport [https://sourceforge.net/p/trousers/trousers/ci/59351a56cac1710e89d207dff07eb23bbc644c13/]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+ src/tspi/tsp_tcsi_param.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tspi/tsp_tcsi_param.c b/src/tspi/tsp_tcsi_param.c
+index 670f86f..8f2b4e4 100644
+--- a/src/tspi/tsp_tcsi_param.c
++++ b/src/tspi/tsp_tcsi_param.c
+@@ -11,7 +11,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include <bits/local_lim.h>
++#include <limits.h>
+ #include "trousers/tss.h"
+ #include "trousers/trousers.h"
+ #include "trousers_types.h"
+-- 
+2.10.2
+
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"
 DEPENDS = "openssl"
 
 SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
+    file://0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch \
+    file://0001-Check-that-getpwent_r-is-available-before-using-it.patch \
     file://07-read_data-not-inline.patch \
     file://trousers.init.sh \
     file://trousers-udev.rules \
-- 
2.10.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [meta-security][PATCH v2] trousers: fix musl compilation
  2016-11-25 16:29 [meta-security][PATCH] trousers: fix musl compilation André Draszik
@ 2016-11-28  9:31 ` André Draszik
  2016-11-28  9:32   ` André Draszik
  0 siblings, 1 reply; 4+ messages in thread
From: André Draszik @ 2016-11-28  9:31 UTC (permalink / raw)
  To: yocto

From: André Draszik <adraszik@tycoint.com>

Backport patches to fix compilation.

Signed-off-by: André Draszik <adraszik@tycoint.com>
---
 ...t-getpwent_r-is-available-before-using-it.patch | 85 ++++++++++++++++++++++
 ...si_param.c-Include-limits.h-for-POSIX_MAX.patch | 36 +++++++++
 recipes-tpm/trousers/trousers_0.3.13.bb            |  2 +
 3 files changed, 123 insertions(+)
 create mode 100644 recipes-tpm/trousers/files/0001-Check-that-getpwent_r-is-available-before-using-it.patch
 create mode 100644 recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch

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 @@
+From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?No=C3=A9=20Rubinstein?= <nrubinstein@aldebaran.com>
+Date: Wed, 24 Aug 2016 18:55:25 +0200
+Subject: [PATCH] Check that getpwent_r is available before using it
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes building trousers with musl
+
+Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
+---
+Upstream-Status: Inappropriate [not author https://git.busybox.net/buildroot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-using-it.patch]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+ configure.in        |  4 ++++
+ src/tspi/ps/tspps.c | 10 +++++-----
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index add23dc..cfdfcaa 100644
+--- a/configure.in
++++ b/configure.in
+@@ -144,6 +144,10 @@ else
+ 	AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported gui options for trousers])
+ fi
+ 
++# Look for getpwent_r. If it is not found, getpwent will be used instead, with
++# an additional mutex.
++AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)])
++
+ #
+ # The default port that the TCS daemon listens on
+ #
+diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c
+index c6f9c3d..9d00d2a 100644
+--- a/src/tspi/ps/tspps.c
++++ b/src/tspi/ps/tspps.c
+@@ -45,7 +45,7 @@
+ 
+ static int user_ps_fd = -1;
+ static MUTEX_DECLARE_INIT(user_ps_lock);
+-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
++#ifndef HAVE_GETPWENT_R
+ static MUTEX_DECLARE_INIT(user_ps_path);
+ #endif
+ static struct flock fl;
+@@ -60,7 +60,7 @@ get_user_ps_path(char **file)
+ 	TSS_RESULT result;
+ 	char *file_name = NULL, *home_dir = NULL;
+ 	struct passwd *pwp;
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
++#ifdef HAVE_GETPWENT_R
+ 	struct passwd pw;
+ #endif
+ 	struct stat stat_buf;
+@@ -72,7 +72,7 @@ get_user_ps_path(char **file)
+ 		*file = strdup(file_name);
+ 		return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
+ 	}
+-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
++#ifndef HAVE_GETPWENT_R
+ 	MUTEX_LOCK(user_ps_path);
+ #endif
+ 
+@@ -90,7 +90,7 @@ get_user_ps_path(char **file)
+ #else
+ 	setpwent();
+ 	while (1) {
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
++#ifdef HAVE_GETPWENT_R
+ 		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
+ 		if (rc) {
+ 			LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
+@@ -99,7 +99,7 @@ get_user_ps_path(char **file)
+ 			return TSPERR(TSS_E_INTERNAL_ERROR);
+ 		}
+ 
+-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
++#else
+ 		if ((pwp = getpwent()) == NULL) {
+ 			LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
+                                    strerror(rc));
+-- 
+2.10.2
+
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 @@
+From c1b5f33845c56dc7aef769c99758b4f77a041d43 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Wed, 31 Aug 2016 22:52:58 -0400
+Subject: [PATCH] tsp_tcsi_param.c: Include <limits.h> for POSIX_MAX
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Use POSIX instead of glibc-specific header.
+Fixes compilation with musl libc.
+
+Signed-off-by: Felix Janda <felix.janda@posteo.de>
+Reviewed-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
+
+---
+Upstream-Status: Backport [https://sourceforge.net/p/trousers/trousers/ci/59351a56cac1710e89d207dff07eb23bbc644c13/]
+Signed-off-by: André Draszik <adraszik@tycoint.com>
+ src/tspi/tsp_tcsi_param.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tspi/tsp_tcsi_param.c b/src/tspi/tsp_tcsi_param.c
+index 670f86f..8f2b4e4 100644
+--- a/src/tspi/tsp_tcsi_param.c
++++ b/src/tspi/tsp_tcsi_param.c
+@@ -11,7 +11,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+-#include <bits/local_lim.h>
++#include <limits.h>
+ #include "trousers/tss.h"
+ #include "trousers/trousers.h"
+ #include "trousers_types.h"
+-- 
+2.10.2
+
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"
 DEPENDS = "openssl"
 
 SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
+    file://0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch \
+    file://0001-Check-that-getpwent_r-is-available-before-using-it.patch \
     file://07-read_data-not-inline.patch \
     file://trousers.init.sh \
     file://trousers-udev.rules \
-- 
2.10.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [meta-security][PATCH v2] trousers: fix musl compilation
  2016-11-28  9:31 ` [meta-security][PATCH v2] " André Draszik
@ 2016-11-28  9:32   ` André Draszik
  2016-11-29  3:30     ` akuster808
  0 siblings, 1 reply; 4+ messages in thread
From: André Draszik @ 2016-11-28  9:32 UTC (permalink / raw)
  To: yocto

Changes from v1:
- Upstream-Status of 0001-Check-that-getpwent_r-is-available-before-using-
it.patch updated

On Mon, 2016-11-28 at 09:31 +0000, André Draszik wrote:
> From: André Draszik <adraszik@tycoint.com>
> 
> Backport patches to fix compilation.
> 
> Signed-off-by: André Draszik <adraszik@tycoint.com>
> ---
>  ...t-getpwent_r-is-available-before-using-it.patch | 85
> ++++++++++++++++++++++
>  ...si_param.c-Include-limits.h-for-POSIX_MAX.patch | 36 +++++++++
>  recipes-tpm/trousers/trousers_0.3.13.bb            |  2 +
>  3 files changed, 123 insertions(+)
>  create mode 100644 recipes-tpm/trousers/files/0001-Check-that-getpwent_r-
> is-available-before-using-it.patch
>  create mode 100644 recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-
> Include-limits.h-for-POSIX_MAX.patch
> 
> 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 @@
> +From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?No=C3=A9=20Rubinstein?= <nrubinstein@aldebaran.com>
> +Date: Wed, 24 Aug 2016 18:55:25 +0200
> +Subject: [PATCH] Check that getpwent_r is available before using it
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +This fixes building trousers with musl
> +
> +Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
> +---
> +Upstream-Status: Inappropriate [not author https://git.busybox.net/buildr
> oot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-
> using-it.patch]
> +Signed-off-by: André Draszik <adraszik@tycoint.com>
> + configure.in        |  4 ++++
> + src/tspi/ps/tspps.c | 10 +++++-----
> + 2 files changed, 9 insertions(+), 5 deletions(-)
> +
> +diff --git a/configure.in b/configure.in
> +index add23dc..cfdfcaa 100644
> +--- a/configure.in
> ++++ b/configure.in
> +@@ -144,6 +144,10 @@ else
> + 	AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported
> gui options for trousers])
> + fi
> + 
> ++# Look for getpwent_r. If it is not found, getpwent will be used
> instead, with
> ++# an additional mutex.
> ++AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)])
> ++
> + #
> + # The default port that the TCS daemon listens on
> + #
> +diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c
> +index c6f9c3d..9d00d2a 100644
> +--- a/src/tspi/ps/tspps.c
> ++++ b/src/tspi/ps/tspps.c
> +@@ -45,7 +45,7 @@
> + 
> + static int user_ps_fd = -1;
> + static MUTEX_DECLARE_INIT(user_ps_lock);
> +-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
> ++#ifndef HAVE_GETPWENT_R
> + static MUTEX_DECLARE_INIT(user_ps_path);
> + #endif
> + static struct flock fl;
> +@@ -60,7 +60,7 @@ get_user_ps_path(char **file)
> + 	TSS_RESULT result;
> + 	char *file_name = NULL, *home_dir = NULL;
> + 	struct passwd *pwp;
> +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
> ++#ifdef HAVE_GETPWENT_R
> + 	struct passwd pw;
> + #endif
> + 	struct stat stat_buf;
> +@@ -72,7 +72,7 @@ get_user_ps_path(char **file)
> + 		*file = strdup(file_name);
> + 		return (*file) ? TSS_SUCCESS :
> TSPERR(TSS_E_OUTOFMEMORY);
> + 	}
> +-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
> ++#ifndef HAVE_GETPWENT_R
> + 	MUTEX_LOCK(user_ps_path);
> + #endif
> + 
> +@@ -90,7 +90,7 @@ get_user_ps_path(char **file)
> + #else
> + 	setpwent();
> + 	while (1) {
> +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
> ++#ifdef HAVE_GETPWENT_R
> + 		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
> + 		if (rc) {
> + 			LogDebugFn("USER PS: Error getting path to home
> directory: getpwent_r: %s",
> +@@ -99,7 +99,7 @@ get_user_ps_path(char **file)
> + 			return TSPERR(TSS_E_INTERNAL_ERROR);
> + 		}
> + 
> +-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
> ++#else
> + 		if ((pwp = getpwent()) == NULL) {
> + 			LogDebugFn("USER PS: Error getting path to home
> directory: getpwent: %s",
> +                                    strerror(rc));
> +-- 
> +2.10.2
> +
> 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 @@
> +From c1b5f33845c56dc7aef769c99758b4f77a041d43 Mon Sep 17 00:00:00 2001
> +From: Felix Janda <felix.janda@posteo.de>
> +Date: Wed, 31 Aug 2016 22:52:58 -0400
> +Subject: [PATCH] tsp_tcsi_param.c: Include <limits.h> for POSIX_MAX
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Use POSIX instead of glibc-specific header.
> +Fixes compilation with musl libc.
> +
> +Signed-off-by: Felix Janda <felix.janda@posteo.de>
> +Reviewed-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> +
> +---
> +Upstream-Status: Backport [https://sourceforge.net/p/trousers/trousers/ci
> /59351a56cac1710e89d207dff07eb23bbc644c13/]
> +Signed-off-by: André Draszik <adraszik@tycoint.com>
> + src/tspi/tsp_tcsi_param.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/tspi/tsp_tcsi_param.c b/src/tspi/tsp_tcsi_param.c
> +index 670f86f..8f2b4e4 100644
> +--- a/src/tspi/tsp_tcsi_param.c
> ++++ b/src/tspi/tsp_tcsi_param.c
> +@@ -11,7 +11,7 @@
> + #include <stdlib.h>
> + #include <string.h>
> + #include <stdio.h>
> +-#include <bits/local_lim.h>
> ++#include <limits.h>
> + #include "trousers/tss.h"
> + #include "trousers/trousers.h"
> + #include "trousers_types.h"
> +-- 
> +2.10.2
> +
> 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"
>  DEPENDS = "openssl"
>  
>  SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${
> BPN}-${PV}.tar.gz \
> +    file://0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch \
> +    file://0001-Check-that-getpwent_r-is-available-before-using-it.patch
> \
>      file://07-read_data-not-inline.patch \
>      file://trousers.init.sh \
>      file://trousers-udev.rules \


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [meta-security][PATCH v2] trousers: fix musl compilation
  2016-11-28  9:32   ` André Draszik
@ 2016-11-29  3:30     ` akuster808
  0 siblings, 0 replies; 4+ messages in thread
From: akuster808 @ 2016-11-29  3:30 UTC (permalink / raw)
  To: André Draszik, yocto



On 11/28/2016 01:32 AM, André Draszik wrote:
> Changes from v1:
> - Upstream-Status of 0001-Check-that-getpwent_r-is-available-before-using-
> it.patch updated
thanks for the note.

merged

Thanks for the patch.
Armin
> On Mon, 2016-11-28 at 09:31 +0000, André Draszik wrote:
>> From: André Draszik <adraszik@tycoint.com>
>>
>> Backport patches to fix compilation.
>>
>> Signed-off-by: André Draszik <adraszik@tycoint.com>
>> ---
>>   ...t-getpwent_r-is-available-before-using-it.patch | 85
>> ++++++++++++++++++++++
>>   ...si_param.c-Include-limits.h-for-POSIX_MAX.patch | 36 +++++++++
>>   recipes-tpm/trousers/trousers_0.3.13.bb            |  2 +
>>   3 files changed, 123 insertions(+)
>>   create mode 100644 recipes-tpm/trousers/files/0001-Check-that-getpwent_r-
>> is-available-before-using-it.patch
>>   create mode 100644 recipes-tpm/trousers/files/0001-tsp_tcsi_param.c-
>> Include-limits.h-for-POSIX_MAX.patch
>>
>> 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 @@
>> +From bb721b0ae5882992037153e7257791101172556e Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?No=C3=A9=20Rubinstein?= <nrubinstein@aldebaran.com>
>> +Date: Wed, 24 Aug 2016 18:55:25 +0200
>> +Subject: [PATCH] Check that getpwent_r is available before using it
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +This fixes building trousers with musl
>> +
>> +Signed-off-by: Noé Rubinstein <nrubinstein@aldebaran.com>
>> +---
>> +Upstream-Status: Inappropriate [not author https://git.busybox.net/buildr
>> oot/plain/package/trousers/0004-Check-that-getpwent_r-is-available-before-
>> using-it.patch]
>> +Signed-off-by: André Draszik <adraszik@tycoint.com>
>> + configure.in        |  4 ++++
>> + src/tspi/ps/tspps.c | 10 +++++-----
>> + 2 files changed, 9 insertions(+), 5 deletions(-)
>> +
>> +diff --git a/configure.in b/configure.in
>> +index add23dc..cfdfcaa 100644
>> +--- a/configure.in
>> ++++ b/configure.in
>> +@@ -144,6 +144,10 @@ else
>> + 	AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported
>> gui options for trousers])
>> + fi
>> +
>> ++# Look for getpwent_r. If it is not found, getpwent will be used
>> instead, with
>> ++# an additional mutex.
>> ++AC_CHECK_FUNC(getpwent_r, [AC_DEFINE(HAVE_GETPWENT_R)])
>> ++
>> + #
>> + # The default port that the TCS daemon listens on
>> + #
>> +diff --git a/src/tspi/ps/tspps.c b/src/tspi/ps/tspps.c
>> +index c6f9c3d..9d00d2a 100644
>> +--- a/src/tspi/ps/tspps.c
>> ++++ b/src/tspi/ps/tspps.c
>> +@@ -45,7 +45,7 @@
>> +
>> + static int user_ps_fd = -1;
>> + static MUTEX_DECLARE_INIT(user_ps_lock);
>> +-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
>> ++#ifndef HAVE_GETPWENT_R
>> + static MUTEX_DECLARE_INIT(user_ps_path);
>> + #endif
>> + static struct flock fl;
>> +@@ -60,7 +60,7 @@ get_user_ps_path(char **file)
>> + 	TSS_RESULT result;
>> + 	char *file_name = NULL, *home_dir = NULL;
>> + 	struct passwd *pwp;
>> +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
>> ++#ifdef HAVE_GETPWENT_R
>> + 	struct passwd pw;
>> + #endif
>> + 	struct stat stat_buf;
>> +@@ -72,7 +72,7 @@ get_user_ps_path(char **file)
>> + 		*file = strdup(file_name);
>> + 		return (*file) ? TSS_SUCCESS :
>> TSPERR(TSS_E_OUTOFMEMORY);
>> + 	}
>> +-#if (defined (__FreeBSD__) || defined (__OpenBSD__))
>> ++#ifndef HAVE_GETPWENT_R
>> + 	MUTEX_LOCK(user_ps_path);
>> + #endif
>> +
>> +@@ -90,7 +90,7 @@ get_user_ps_path(char **file)
>> + #else
>> + 	setpwent();
>> + 	while (1) {
>> +-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
>> ++#ifdef HAVE_GETPWENT_R
>> + 		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
>> + 		if (rc) {
>> + 			LogDebugFn("USER PS: Error getting path to home
>> directory: getpwent_r: %s",
>> +@@ -99,7 +99,7 @@ get_user_ps_path(char **file)
>> + 			return TSPERR(TSS_E_INTERNAL_ERROR);
>> + 		}
>> +
>> +-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
>> ++#else
>> + 		if ((pwp = getpwent()) == NULL) {
>> + 			LogDebugFn("USER PS: Error getting path to home
>> directory: getpwent: %s",
>> +                                    strerror(rc));
>> +--
>> +2.10.2
>> +
>> 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 @@
>> +From c1b5f33845c56dc7aef769c99758b4f77a041d43 Mon Sep 17 00:00:00 2001
>> +From: Felix Janda <felix.janda@posteo.de>
>> +Date: Wed, 31 Aug 2016 22:52:58 -0400
>> +Subject: [PATCH] tsp_tcsi_param.c: Include <limits.h> for POSIX_MAX
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Use POSIX instead of glibc-specific header.
>> +Fixes compilation with musl libc.
>> +
>> +Signed-off-by: Felix Janda <felix.janda@posteo.de>
>> +Reviewed-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
>> +
>> +---
>> +Upstream-Status: Backport [https://sourceforge.net/p/trousers/trousers/ci
>> /59351a56cac1710e89d207dff07eb23bbc644c13/]
>> +Signed-off-by: André Draszik <adraszik@tycoint.com>
>> + src/tspi/tsp_tcsi_param.c | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/src/tspi/tsp_tcsi_param.c b/src/tspi/tsp_tcsi_param.c
>> +index 670f86f..8f2b4e4 100644
>> +--- a/src/tspi/tsp_tcsi_param.c
>> ++++ b/src/tspi/tsp_tcsi_param.c
>> +@@ -11,7 +11,7 @@
>> + #include <stdlib.h>
>> + #include <string.h>
>> + #include <stdio.h>
>> +-#include <bits/local_lim.h>
>> ++#include <limits.h>
>> + #include "trousers/tss.h"
>> + #include "trousers/trousers.h"
>> + #include "trousers_types.h"
>> +--
>> +2.10.2
>> +
>> 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"
>>   DEPENDS = "openssl"
>>   
>>   SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${
>> BPN}-${PV}.tar.gz \
>> +    file://0001-tsp_tcsi_param.c-Include-limits.h-for-POSIX_MAX.patch \
>> +    file://0001-Check-that-getpwent_r-is-available-before-using-it.patch
>> \
>>       file://07-read_data-not-inline.patch \
>>       file://trousers.init.sh \
>>       file://trousers-udev.rules \



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-29  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 16:29 [meta-security][PATCH] trousers: fix musl compilation André Draszik
2016-11-28  9:31 ` [meta-security][PATCH v2] " André Draszik
2016-11-28  9:32   ` André Draszik
2016-11-29  3:30     ` akuster808

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.