diff options
author | Serhey Popovych <serhe.popovych@gmail.com> | 2019-01-12 11:22:47 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 16:35:33 +0000 |
commit | 842908cbf167b29f5f2aaa4a77eff4b28cbfb9cd (patch) | |
tree | d7bfb6496bd0645281a34a8e929b4e1a63fcf44a | |
parent | ae9160e099e9b23f1b756020d78db46052a1dca6 (diff) | |
download | poky-842908cbf167b29f5f2aaa4a77eff4b28cbfb9cd.tar.gz |
systemd: Correctly check ENABLE_GSHADOW with if/endif
Use commit 4f07ffa8f5ab ("Use #if instead of #ifdef for ENABLE_GSHADOW")
from upstream to check ENABLE_GSHADOW correctly that is defined as 0
in case of musl.
While there replace specific patch with one from upstream that does
exactly the same commit 66a5b5ce9b99 ("basic/user-util: properly protect
use of gshadow").
(From OE-Core rev: c9580ef0810196f6703567d9db458b73dbbfb35f)
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 68 insertions, 30 deletions
diff --git a/meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch b/meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch new file mode 100644 index 0000000000..518c05b73a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-basic-user-util-properly-protect-use-of-gshadow.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From 66a5b5ce9b991327d594f7b635de16999ca54093 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Yann E. MORIN" <yann.morin.1998@free.fr> | ||
3 | Date: Wed, 21 Nov 2018 18:09:04 +0100 | ||
4 | Subject: basic/user-util: properly protect use of gshadow | ||
5 | |||
6 | Commit 100d5f6ee6 (user-util: add new wrappers for [...] database | ||
7 | files), ammended by commit 4f07ffa8f5 (Use #if instead of #ifdef for | ||
8 | ENABLE_GSHADOW) moved code from sysuser to basic/user-util. | ||
9 | |||
10 | In doing so, the combination of both commits properly propagated the | ||
11 | ENABLE_GSHADOW conditions around the function manipulating gshadow, but | ||
12 | they forgot to protect the inclusion of the gshadow.h header. | ||
13 | |||
14 | Fix that to be able to build on C libraries that do not provide gshadow | ||
15 | (e.g. uClibc-ng, where it does not exist.) | ||
16 | |||
17 | Upstream-Status: Backport [https://github.com/systemd/systemd/commit/66a5b5ce9b991327d594f7b635de16999ca54093] | ||
18 | --- | ||
19 | src/basic/user-util.h | 2 ++ | ||
20 | 1 file changed, 2 insertions(+) | ||
21 | |||
22 | diff --git a/src/basic/user-util.h b/src/basic/user-util.h | ||
23 | index b6de0e423..cc899ee76 100644 | ||
24 | --- a/src/basic/user-util.h | ||
25 | +++ b/src/basic/user-util.h | ||
26 | @@ -2,7 +2,9 @@ | ||
27 | #pragma once | ||
28 | |||
29 | #include <grp.h> | ||
30 | +#if ENABLE_GSHADOW | ||
31 | #include <gshadow.h> | ||
32 | +#endif | ||
33 | #include <pwd.h> | ||
34 | #include <shadow.h> | ||
35 | #include <stdbool.h> | ||
36 | -- | ||
37 | 2.18.1 | ||
38 | |||
diff --git a/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch b/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch deleted file mode 100644 index 6d5faf5fed..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | From a2c4d46944892174930135672508389a04e191f0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Chen Qi <Qi.Chen@windriver.com> | ||
3 | Date: Fri, 29 Jun 2018 13:53:29 +0800 | ||
4 | Subject: [PATCH 05/19] include gshadow only if ENABLE_GSHADOW is 1 | ||
5 | |||
6 | Upstream-Status: Inappropriate [musl] | ||
7 | |||
8 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
9 | --- | ||
10 | src/basic/user-util.h | 2 ++ | ||
11 | 1 file changed, 2 insertions(+) | ||
12 | |||
13 | diff --git a/src/basic/user-util.h b/src/basic/user-util.h | ||
14 | index b74f16885..f9c1e29c4 100644 | ||
15 | --- a/src/basic/user-util.h | ||
16 | +++ b/src/basic/user-util.h | ||
17 | @@ -2,7 +2,9 @@ | ||
18 | #pragma once | ||
19 | |||
20 | #include <grp.h> | ||
21 | +#if ENABLE_GSHADOW | ||
22 | #include <gshadow.h> | ||
23 | +#endif | ||
24 | #include <pwd.h> | ||
25 | #include <shadow.h> | ||
26 | #include <stdbool.h> | ||
27 | -- | ||
28 | 2.11.0 | ||
29 | |||
diff --git a/meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch b/meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch new file mode 100644 index 0000000000..a9c1c9cfe5 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 4f07ffa8f5ab85011422bb7114f1cddf49d4923d Mon Sep 17 00:00:00 2001 | ||
2 | From: ChenQi1989 <40684930+ChenQi1989@users.noreply.github.com> | ||
3 | Date: Fri, 29 Jun 2018 06:54:07 +0000 | ||
4 | Subject: Use #if instead of #ifdef for ENABLE_GSHADOW | ||
5 | |||
6 | ENABLE_GSHADOW is defined to be 0 or 1. So #if should be used instead of #ifdef. | ||
7 | |||
8 | Upstream-Status: Backport [https://github.com/systemd/systemd/commit/4f07ffa8f5ab85011422bb7114f1cddf49d4923d] | ||
9 | --- | ||
10 | src/basic/user-util.h | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/src/basic/user-util.h b/src/basic/user-util.h | ||
14 | index b74f16885..b2f198c89 100644 | ||
15 | --- a/src/basic/user-util.h | ||
16 | +++ b/src/basic/user-util.h | ||
17 | @@ -102,7 +102,7 @@ int fgetgrent_sane(FILE *stream, struct group **gr); | ||
18 | int putpwent_sane(const struct passwd *pw, FILE *stream); | ||
19 | int putspent_sane(const struct spwd *sp, FILE *stream); | ||
20 | int putgrent_sane(const struct group *gr, FILE *stream); | ||
21 | -#ifdef ENABLE_GSHADOW | ||
22 | +#if ENABLE_GSHADOW | ||
23 | int fgetsgent_sane(FILE *stream, struct sgrp **sg); | ||
24 | int putsgent_sane(const struct sgrp *sg, FILE *stream); | ||
25 | #endif | ||
26 | -- | ||
27 | 2.18.1 | ||
28 | |||
diff --git a/meta/recipes-core/systemd/systemd_239.bb b/meta/recipes-core/systemd/systemd_239.bb index 922ba3b57d..7af297245a 100644 --- a/meta/recipes-core/systemd/systemd_239.bb +++ b/meta/recipes-core/systemd/systemd_239.bb | |||
@@ -51,7 +51,7 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa | |||
51 | file://0002-don-t-use-glibc-specific-qsort_r.patch \ | 51 | file://0002-don-t-use-glibc-specific-qsort_r.patch \ |
52 | file://0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ | 52 | file://0003-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ |
53 | file://0004-add-fallback-parse_printf_format-implementation.patch \ | 53 | file://0004-add-fallback-parse_printf_format-implementation.patch \ |
54 | file://0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch \ | 54 | file://0005-basic-user-util-properly-protect-use-of-gshadow.patch \ |
55 | file://0006-src-basic-missing.h-check-for-missing-strndupa.patch \ | 55 | file://0006-src-basic-missing.h-check-for-missing-strndupa.patch \ |
56 | file://0007-Include-netinet-if_ether.h.patch \ | 56 | file://0007-Include-netinet-if_ether.h.patch \ |
57 | file://0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ | 57 | file://0008-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ |
@@ -68,6 +68,7 @@ SRC_URI_MUSL = "file://0001-Use-getenv-when-secure-versions-are-not-available.pa | |||
68 | file://0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ | 68 | file://0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ |
69 | file://0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ | 69 | file://0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ |
70 | file://0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ | 70 | file://0021-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ |
71 | file://0022-Use-if-instead-of-ifdef-for-ENABLE_GSHADOW.patch \ | ||
71 | " | 72 | " |
72 | 73 | ||
73 | # Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl | 74 | # Workaround undefined reference to `__stack_chk_fail_local' on qemux86 and qemuppc for musl |