Brad Bishop | 7f28bc5 | 2017-12-03 23:42:40 -0500 | [diff] [blame^] | 1 | Musl does not have _r versions of getent() and getpwent() APIs |
| 2 | |
| 3 | Taken from gentoo |
| 4 | http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.3.9-remove-getpwent_r.patch |
| 5 | |
| 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 7 | |
| 8 | Index: samba-4.4.5/source4/torture/local/nss_tests.c |
| 9 | =================================================================== |
| 10 | --- samba-4.4.5.orig/source4/torture/local/nss_tests.c |
| 11 | +++ samba-4.4.5/source4/torture/local/nss_tests.c |
| 12 | @@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct tortu |
| 13 | return true; |
| 14 | } |
| 15 | |
| 16 | - |
| 17 | static bool test_getgrgid(struct torture_context *tctx, |
| 18 | gid_t gid, |
| 19 | struct group *grp_p) |
| 20 | @@ -333,6 +332,7 @@ static bool test_enum_passwd(struct tort |
| 21 | return true; |
| 22 | } |
| 23 | |
| 24 | +#if HAVE_GETPWENT_R |
| 25 | static bool test_enum_r_passwd(struct torture_context *tctx, |
| 26 | struct passwd **pwd_array_p, |
| 27 | size_t *num_pwd_p) |
| 28 | @@ -381,6 +381,7 @@ static bool test_enum_r_passwd(struct to |
| 29 | |
| 30 | return true; |
| 31 | } |
| 32 | +#endif |
| 33 | |
| 34 | static bool torture_assert_passwd_equal(struct torture_context *tctx, |
| 35 | const struct passwd *p1, |
| 36 | @@ -432,7 +433,7 @@ static bool test_passwd_r(struct torture |
| 37 | struct passwd *pwd, pwd1, pwd2; |
| 38 | size_t num_pwd; |
| 39 | |
| 40 | - torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd), |
| 41 | + torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd), |
| 42 | "failed to enumerate passwd"); |
| 43 | |
| 44 | for (i=0; i < num_pwd; i++) { |
| 45 | @@ -460,7 +461,7 @@ static bool test_passwd_r_cross(struct t |
| 46 | struct passwd *pwd, pwd1, pwd2, pwd3, pwd4; |
| 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 | @@ -531,6 +532,7 @@ static bool test_enum_group(struct tortu |
| 55 | return true; |
| 56 | } |
| 57 | |
| 58 | +#if HAVE_GETGRENT_R |
| 59 | static bool test_enum_r_group(struct torture_context *tctx, |
| 60 | struct group **grp_array_p, |
| 61 | size_t *num_grp_p) |
| 62 | @@ -579,6 +581,7 @@ static bool test_enum_r_group(struct tor |
| 63 | |
| 64 | return true; |
| 65 | } |
| 66 | +#endif |
| 67 | |
| 68 | static bool torture_assert_group_equal(struct torture_context *tctx, |
| 69 | const struct group *g1, |
| 70 | @@ -635,7 +638,7 @@ static bool test_group_r(struct torture_ |
| 71 | struct group *grp, grp1, grp2; |
| 72 | size_t num_grp; |
| 73 | |
| 74 | - torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp), |
| 75 | + torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp), |
| 76 | "failed to enumerate group"); |
| 77 | |
| 78 | for (i=0; i < num_grp; i++) { |
| 79 | @@ -663,7 +666,7 @@ static bool test_group_r_cross(struct to |
| 80 | struct group *grp, grp1, grp2, grp3, grp4; |
| 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++) { |