blob: 22451a2d11757d9d91984b50a07837a0bcc10082 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From 08003ea30d86a8b983be89f6a161d3baacdaa038 Mon Sep 17 00:00:00 2001
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08002From: 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>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011---
12 source4/torture/local/nss_tests.c | 13 ++++++++-----
13 1 file changed, 8 insertions(+), 5 deletions(-)
14
15diff --git a/source4/torture/local/nss_tests.c b/source4/torture/local/nss_tests.c
Andrew Geissler517393d2023-01-13 08:55:19 -060016index 2943122..bc185ca 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080017--- 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 Bishop7f28bc52017-12-03 23:42:40 -050020 return true;
21 }
22
23-
24 static bool test_getgrgid(struct torture_context *tctx,
25 gid_t gid,
26 struct group *grp_p)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027@@ -333,6 +332,7 @@ static bool test_enum_passwd(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050028 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 Geissler517393d2023-01-13 08:55:19 -060035@@ -383,6 +383,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050036
37 return true;
38 }
39+#endif
40
41 static bool torture_assert_passwd_equal(struct torture_context *tctx,
42 const struct passwd *p1,
Andrew Geissler517393d2023-01-13 08:55:19 -060043@@ -434,7 +435,7 @@ static bool test_passwd_r(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050044 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 Geissler517393d2023-01-13 08:55:19 -060052@@ -462,7 +463,7 @@ static bool test_passwd_r_cross(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050053 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 Geissler517393d2023-01-13 08:55:19 -060061@@ -533,6 +534,7 @@ static bool test_enum_group(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050062 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 Geissler517393d2023-01-13 08:55:19 -060069@@ -583,6 +585,7 @@ static bool test_enum_r_group(struct torture_context *tctx,
Brad Bishop7f28bc52017-12-03 23:42:40 -050070
71 return true;
72 }
73+#endif
74
75 static bool torture_assert_group_equal(struct torture_context *tctx,
76 const struct group *g1,
Andrew Geissler517393d2023-01-13 08:55:19 -060077@@ -639,7 +642,7 @@ static bool test_group_r(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050078 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 Geissler517393d2023-01-13 08:55:19 -060086@@ -667,7 +670,7 @@ static bool test_group_r_cross(struct torture_context *tctx)
Brad Bishop7f28bc52017-12-03 23:42:40 -050087 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 Geissler517393d2023-01-13 08:55:19 -060095--
962.25.1
97