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