samba: Fix build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
Khem Raj
2016-11-06 23:40:54 -08:00
committed by Joe MacDonald
parent 961ed807da
commit ef1c823a3f
3 changed files with 130 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
Lifted from gentoo and ported to 4.4.5
http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.2.7-pam.patch
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Index: samba-4.4.5/source3/wscript
===================================================================
--- samba-4.4.5.orig/source3/wscript
+++ samba-4.4.5/source3/wscript
@@ -873,7 +873,7 @@ msg.msg_accrightslen = sizeof(fd);
if conf.env.with_iconv:
conf.DEFINE('HAVE_ICONV', 1)
- if Options.options.with_pam:
+ if Options.options.with_pam != False:
use_pam=True
conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
@@ -945,6 +945,15 @@ int i; i = PAM_RADIO_TYPE;
if use_pam:
conf.DEFINE('WITH_PAM', 1)
conf.DEFINE('WITH_PAM_MODULES', 1)
+ else:
+ Logs.warn("PAM disabled")
+ use_pam=False
+ conf.undefine('WITH_PAM')
+ conf.undefine('WITH_PAM_MODULES')
+ conf.undefine('HAVE_SECURITY_PAM_APPL_H')
+ conf.undefine('PAM_RHOST')
+ conf.undefine('PAM_TTY')
+ conf.undefine('HAVE_PAM_PAM_APPL_H')
seteuid = False

View File

@@ -0,0 +1,87 @@
Musl does not have _r versions of getent() and getpwent() APIs
Taken from gentoo
http://data.gpo.zugaina.org/musl/net-fs/samba/files/samba-4.3.9-remove-getpwent_r.patch
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Index: samba-4.4.5/source4/torture/local/nss_tests.c
===================================================================
--- samba-4.4.5.orig/source4/torture/local/nss_tests.c
+++ samba-4.4.5/source4/torture/local/nss_tests.c
@@ -247,7 +247,6 @@ static bool test_getgrnam_r(struct tortu
return true;
}
-
static bool test_getgrgid(struct torture_context *tctx,
gid_t gid,
struct group *grp_p)
@@ -333,6 +332,7 @@ static bool test_enum_passwd(struct tort
return true;
}
+#if HAVE_GETPWENT_R
static bool test_enum_r_passwd(struct torture_context *tctx,
struct passwd **pwd_array_p,
size_t *num_pwd_p)
@@ -381,6 +381,7 @@ static bool test_enum_r_passwd(struct to
return true;
}
+#endif
static bool torture_assert_passwd_equal(struct torture_context *tctx,
const struct passwd *p1,
@@ -432,7 +433,7 @@ static bool test_passwd_r(struct torture
struct passwd *pwd, pwd1, pwd2;
size_t num_pwd;
- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
+ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
"failed to enumerate passwd");
for (i=0; i < num_pwd; i++) {
@@ -460,7 +461,7 @@ static bool test_passwd_r_cross(struct t
struct passwd *pwd, pwd1, pwd2, pwd3, pwd4;
size_t num_pwd;
- torture_assert(tctx, test_enum_r_passwd(tctx, &pwd, &num_pwd),
+ torture_assert(tctx, test_enum_passwd(tctx, &pwd, &num_pwd),
"failed to enumerate passwd");
for (i=0; i < num_pwd; i++) {
@@ -531,6 +532,7 @@ static bool test_enum_group(struct tortu
return true;
}
+#if HAVE_GETGRENT_R
static bool test_enum_r_group(struct torture_context *tctx,
struct group **grp_array_p,
size_t *num_grp_p)
@@ -579,6 +581,7 @@ static bool test_enum_r_group(struct tor
return true;
}
+#endif
static bool torture_assert_group_equal(struct torture_context *tctx,
const struct group *g1,
@@ -635,7 +638,7 @@ static bool test_group_r(struct torture_
struct group *grp, grp1, grp2;
size_t num_grp;
- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
+ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
"failed to enumerate group");
for (i=0; i < num_grp; i++) {
@@ -663,7 +666,7 @@ static bool test_group_r_cross(struct to
struct group *grp, grp1, grp2, grp3, grp4;
size_t num_grp;
- torture_assert(tctx, test_enum_r_group(tctx, &grp, &num_grp),
+ torture_assert(tctx, test_enum_group(tctx, &grp, &num_grp),
"failed to enumerate group");
for (i=0; i < num_grp; i++) {

View File

@@ -20,6 +20,10 @@ SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
file://0006-avoid-using-colon-in-the-checking-msg.patch \
file://volatiles.03_samba \
"
SRC_URI_append_libc-musl = " \
file://samba-4.2.7-pam.patch \
file://samba-4.3.9-remove-getpwent_r.patch \
"
SRC_URI[md5sum] = "6950c5e9f7bdeb8a610c2ca957a15be4"
SRC_URI[sha256sum] = "b876ef2e63f66265490e80a122e66ef2d7616112b839df68f56ac2e1ce17a7bd"
@@ -29,6 +33,9 @@ inherit systemd waf-samba cpan-base perlnative update-rc.d
RDEPENDS_${PN}_remove = "perl"
DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb krb5 libbsd libaio libpam"
DEPENDS_append_libc-musl = " libtirpc"
CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
LDFLAGS_append_libc-musl = " -ltirpc"
SYSVINITTYPE_linuxstdbase = "lsb"
SYSVINITTYPE = "sysv"