blob: a75ac2bbaef7a40e69f888c5838cef09e1b72d46 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 02e0b14d8fa025a5db410d60a7c0dfebd536aaeb 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
Brad Bishop7f28bc52017-12-03 23:42:40 -05006
7Taken from gentoo
8http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.3.9-remove-getpwent_r.patch
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080012---
13 source4/torture/local/nss_tests.c | 13 ++++++++-----
14 1 file changed, 8 insertions(+), 5 deletions(-)
15
16diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c
17index 2cd6122..04f13c6 100644
18--- a/source4/torture/local/nss_tests.c
19+++ b/source4/torture/local/nss_tests.c
20@@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050021 return true;
22 }
23
24-
25 static bool test_getgrgid(struct torture_context *tctx,
26 gid_t gid,
27 struct group *grp_p)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028@@ -333,6 +332,7 @@ static bool test_enum_passwd(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050029 return true;
30 }
31
32+#if HAVE_GETPWENT_R
33 static bool test_enum_r_passwd(struct torture_context *tctx,
34 struct passwd **pwd_array_p,
35 size_t *num_pwd_p)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036@@ -381,6 +381,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050037
38 return true;
39 }
40+#endif
41
42 static bool torture_assert_passwd_equal(struct torture_context *tctx,
43 const struct passwd *p1,
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044@@ -432,7 +433,7 @@ static bool test_passwd_r(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050045 struct passwd *pwd, pwd1, pwd2;
46 size_t num_pwd;
47
48- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
49+ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
50 "failed to enumerate passwd");
51
52 for (i=0; i < num_pwd; i++) {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053@@ -460,7 +461,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050054 struct passwd *pwd, pwd1, pwd2, pwd3, pwd4;
55 size_t num_pwd;
56
57- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
58+ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
59 "failed to enumerate passwd");
60
61 for (i=0; i < num_pwd; i++) {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062@@ -531,6 +532,7 @@ static bool test_enum_group(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050063 return true;
64 }
65
66+#if HAVE_GETGRENT_R
67 static bool test_enum_r_group(struct torture_context *tctx,
68 struct group **grp_array_p,
69 size_t *num_grp_p)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080070@@ -579,6 +581,7 @@ static bool test_enum_r_group(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050071
72 return true;
73 }
74+#endif
75
76 static bool torture_assert_group_equal(struct torture_context *tctx,
77 const struct group *g1,
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078@@ -635,7 +638,7 @@ static bool test_group_r(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050079 struct group *grp, grp1, grp2;
80 size_t num_grp;
81
82- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
83+ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
84 "failed to enumerate group");
85
86 for (i=0; i < num_grp; i++) {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080087@@ -663,7 +666,7 @@ static bool test_group_r_cross(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050088 struct group *grp, grp1, grp2, grp3, grp4;
89 size_t num_grp;
90
91- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
92+ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
93 "failed to enumerate group");
94
95 for (i=0; i < num_grp; i++) {