Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 1 | From 08003ea30d86a8b983be89f6a161d3baacdaa038 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 6 Nov 2016 23:40:54 -0800 |
| 4 | Subject: [PATCH] Musl does not have _r versions of getent() and getpwent() |
| 5 | APIs |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 6 | |
| 7 | Taken from gentoo |
| 8 | http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.3.9-remove-getpwent_r.patch |
| 9 | |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 11 | --- |
| 12 | source4/torture/local/nss_tests.c | 13 ++++++++----- |
| 13 | 1 file changed, 8 insertions(+), 5 deletions(-) |
| 14 | |
| 15 | diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 16 | index 2943122..bc185ca 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 17 | --- a/source4/torture/local/nss_tests.c |
| 18 | +++ b/source4/torture/local/nss_tests.c |
| 19 | @@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct torture_context *tctx, |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 20 | return true; |
| 21 | } |
| 22 | |
| 23 | - |
| 24 | static bool test_getgrgid(struct torture_context *tctx, |
| 25 | gid_t gid, |
| 26 | struct group *grp_p) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 27 | @@ -333,6 +332,7 @@ static bool test_enum_passwd(struct torture_context *tctx, |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 28 | return true; |
| 29 | } |
| 30 | |
| 31 | +#if HAVE_GETPWENT_R |
| 32 | static bool test_enum_r_passwd(struct torture_context *tctx, |
| 33 | struct passwd **pwd_array_p, |
| 34 | size_t *num_pwd_p) |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 35 | @@ -383,6 +383,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx, |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 36 | |
| 37 | return true; |
| 38 | } |
| 39 | +#endif |
| 40 | |
| 41 | static bool torture_assert_passwd_equal(struct torture_context *tctx, |
| 42 | const struct passwd *p1, |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 43 | @@ -434,7 +435,7 @@ static bool test_passwd_r(struct torture_context *tctx) |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 44 | struct passwd *pwd, pwd1, pwd2; |
| 45 | size_t num_pwd; |
| 46 | |
| 47 | - torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd), |
| 48 | + torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd), |
| 49 | "failed to enumerate passwd"); |
| 50 | |
| 51 | for (i=0; i < num_pwd; i++) { |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 52 | @@ -462,7 +463,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx) |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 53 | struct passwd *pwd, pwd1, pwd2, pwd3, pwd4; |
| 54 | size_t num_pwd; |
| 55 | |
| 56 | - torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd), |
| 57 | + torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd), |
| 58 | "failed to enumerate passwd"); |
| 59 | |
| 60 | for (i=0; i < num_pwd; i++) { |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 61 | @@ -533,6 +534,7 @@ static bool test_enum_group(struct torture_context *tctx, |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 62 | return true; |
| 63 | } |
| 64 | |
| 65 | +#if HAVE_GETGRENT_R |
| 66 | static bool test_enum_r_group(struct torture_context *tctx, |
| 67 | struct group **grp_array_p, |
| 68 | size_t *num_grp_p) |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 69 | @@ -583,6 +585,7 @@ static bool test_enum_r_group(struct torture_context *tctx, |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 70 | |
| 71 | return true; |
| 72 | } |
| 73 | +#endif |
| 74 | |
| 75 | static bool torture_assert_group_equal(struct torture_context *tctx, |
| 76 | const struct group *g1, |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 77 | @@ -639,7 +642,7 @@ static bool test_group_r(struct torture_context *tctx) |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 78 | struct group *grp, grp1, grp2; |
| 79 | size_t num_grp; |
| 80 | |
| 81 | - torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp), |
| 82 | + torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp), |
| 83 | "failed to enumerate group"); |
| 84 | |
| 85 | for (i=0; i < num_grp; i++) { |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 86 | @@ -667,7 +670,7 @@ static bool test_group_r_cross(struct torture_context *tctx) |
Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame] | 87 | struct group *grp, grp1, grp2, grp3, grp4; |
| 88 | size_t num_grp; |
| 89 | |
| 90 | - torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp), |
| 91 | + torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp), |
| 92 | "failed to enumerate group"); |
| 93 | |
| 94 | for (i=0; i < num_grp; i++) { |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 95 | -- |
| 96 | 2.25.1 |
| 97 | |