summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba_4.23.5.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-connectivity/samba/samba_4.23.5.bb')
-rw-r--r--meta-networking/recipes-connectivity/samba/samba_4.23.5.bb386
1 files changed, 386 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba_4.23.5.bb b/meta-networking/recipes-connectivity/samba/samba_4.23.5.bb
new file mode 100644
index 0000000000..ec3149562a
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba_4.23.5.bb
@@ -0,0 +1,386 @@
1HOMEPAGE = "https://www.samba.org/"
2SECTION = "console/network"
3
4LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later & GPL-2.0-or-later"
5LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
6 file://${COREBASE}/meta/files/common-licenses/LGPL-3.0-or-later;md5=c51d3eef3be114124d11349ca0d7e117 \
7 file://${COREBASE}/meta/files/common-licenses/GPL-2.0-or-later;md5=fed54355545ffd980b814dab4a3b312c"
8
9SAMBA_MIRROR = "http://samba.org/samba/ftp"
10MIRRORS += "\
11${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \
12${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \
13"
14
15export PYTHONHASHSEED = "1"
16
17# If XML_CATALOG_FILES env var is not defined, waf defaults
18# to build host folders looking for catalogs.
19export XML_CATALOG_FILES = ""
20
21SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
22 file://smb.conf \
23 file://volatiles.03_samba \
24 file://0001-Don-t-check-xsltproc-manpages.patch \
25 file://0002-do-not-import-target-module-while-cross-compile.patch \
26 file://0003-Add-config-option-without-valgrind.patch \
27 file://0004-Add-options-to-configure-the-use-of-libbsd.patch \
28 file://0005-Fix-pyext_PATTERN-for-cross-compilation.patch \
29 file://0006-smbtorture-skip-test-case-tfork_cmd_send.patch \
30 file://0007-Deleted-settiong-of-python-to-fix-the-install-confli.patch \
31 file://0001-lib-replace-Implement-memset_explicit.patch \
32 file://0002-lib-replace-Add-test-for-memset_explicit.patch \
33 file://0003-Replace-memset_s-with-memset_explicit.patch \
34 file://0004-lib-replace-Remove-memset_s.patch \
35 "
36
37SRC_URI:append:libc-musl = " \
38 file://samba-pam.patch \
39 file://samba-4.3.9-remove-getpwent_r.patch \
40 "
41
42SRC_URI[sha256sum] = "593a43ddd0d57902237dfa76888f7b02cb7fc7747111369cb31e126db4836b9f"
43
44UPSTREAM_CHECK_REGEX = "samba\-(?P<pver>4\.19(\.\d+)+).tar.gz"
45
46inherit systemd waf-samba cpan-base perlnative update-rc.d perl-version pkgconfig
47
48CVE_STATUS[CVE-2011-2411] = "not-applicable-platform: vulnerable only on HP NonStop Servers"
49
50# remove default added RDEPENDS on perl
51RDEPENDS:${PN}:remove = "perl"
52
53DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libaio libpam libtasn1 libtasn1-native jansson libparse-yapp-perl-native gnutls cmocka ngtcp2 bison-native"
54
55inherit features_check
56REQUIRED_DISTRO_FEATURES = "pam"
57
58DEPENDS:append:libc-musl = " libtirpc"
59CFLAGS:append:libc-musl = " -I${STAGING_INCDIR}/tirpc"
60LDFLAGS:append:libc-musl = " -ltirpc"
61
62COMPATIBLE_HOST:riscv32 = "null"
63
64INITSCRIPT_NAME = "samba"
65INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
66
67SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind ctdb"
68SYSTEMD_SERVICE:${PN}-base = "nmb.service smb.service samba-bgqd.service"
69SYSTEMD_SERVICE:${PN}-ad-dc = "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'samba.service', '', d)}"
70SYSTEMD_SERVICE:winbind = "winbind.service"
71SYSTEMD_SERVICE:ctdb = "ctdb.service"
72
73# There are prerequisite settings to enable ad-dc, so disable the service by default.
74# Reference:
75# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
76SYSTEMD_AUTO_ENABLE:${PN}-ad-dc = "disable"
77
78#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen
79#to cross Popen
80export WAF_NO_PREFORK = "yes"
81
82# Use krb5. Build active domain controller.
83#
84PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \
85 acl cups ldap mitkrb5 \
86"
87
88PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl"
89PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin"
90PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
91PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
92PACKAGECONFIG[sasl] = ",,cyrus-sasl"
93PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
94PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi"
95PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi"
96PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind"
97PACKAGECONFIG[lttng] = "--with-lttng,--without-lttng,lttng-ust"
98PACKAGECONFIG[archive] = "--with-libarchive,--without-libarchive,libarchive"
99PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind"
100PACKAGECONFIG[gpgme] = "--with-gpgme,--without-gpgme,gpgme"
101PACKAGECONFIG[lmdb] = ",--without-ldb-lmdb,lmdb"
102PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
103PACKAGECONFIG[ad-dc] = "--with-experimental-mit-ad-dc,--without-ad-dc,python3-markdown python3-dnspython,python3-markdown"
104PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc,,krb5,"
105
106SAMBA4_IDMAP_MODULES = "idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2"
107SAMBA4_PDB_MODULES = "pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"
108SAMBA4_AUTH_MODULES = "auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4"
109SAMBA4_MODULES = "${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}"
110
111# These libraries are supposed to replace others supplied by packages, but decorate the names of
112# .so files so there will not be a conflict. This is not done consistantly, so be very careful
113# when adding to this list.
114#
115SAMBA4_LIBS = "heimdal,libquic,NONE"
116
117EXTRA_OECONF += "--enable-fhs \
118 --with-piddir=/run \
119 --with-sockets-dir=/run/samba \
120 --with-modulesdir=${libdir}/samba \
121 --with-privatelibdir=${libdir}/samba \
122 --with-lockdir=${localstatedir}/lib/samba \
123 --with-cachedir=${localstatedir}/lib/samba \
124 --disable-rpath-install \
125 --disable-rpath \
126 --with-shared-modules=${SAMBA4_MODULES} \
127 --bundled-libraries=${SAMBA4_LIBS} \
128 ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
129 --with-cluster-support \
130 --with-profiling-data \
131 --with-libiconv=${STAGING_DIR_HOST}${prefix} \
132 --with-pam --with-pammodulesdir=${base_libdir}/security \
133 --pythondir=${PYTHON_SITEPACKAGES_DIR} \
134 "
135
136LDFLAGS += "-Wl,-z,relro,-z,now"
137
138do_configure:prepend() {
139 # The xsltproc tool is actually a wrapper script in OE, which exports its own XML_CATALOG_FILES env var
140 # However samba does that too. So here I'm trying to concatenate the variables.
141 # The original looks like this in the wrapper:
142 # export XML_CATALOG_FILES=oe-core-specific-thing
143 # and this sed prepends the value with $XML_CATALOG_FILES, and encloses it in quotes. So the end value is
144 # export XML_CATALOG_FILES="$XML_CATALOG FILES oe-core-specific-thing"
145 # The first grep just checks if it was already done, so it is not prepended multiple times.
146
147 grep \$XML_CATALOG_FILES ${STAGING_BINDIR_NATIVE}/xsltproc || \
148 sed -i 's,\(XML_CATALOG_FILES\)=\(.*\),\1="\$XML_CATALOG_FILES \2",' ${STAGING_BINDIR_NATIVE}/xsltproc
149}
150
151do_configure:append() {
152 cd ${S}/pidl/
153 perl Makefile.PL PREFIX=${prefix}
154 sed -e 's,VENDORPREFIX)/lib/perl,VENDORPREFIX)/${baselib}/perl,g' \
155 -e 's,PERLPREFIX)/lib/perl,PERLPREFIX)/${baselib}/perl,g' -i Makefile
156}
157
158do_compile:append() {
159 oe_runmake -C ${S}/pidl
160}
161
162do_install:append() {
163 for section in 1 5 7; do
164 install -d ${D}${mandir}/man$section
165 install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section
166 done
167 for section in 1 5 7 8; do
168 install -d ${D}${mandir}/man$section
169 install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section
170 done
171
172 install -d ${D}${systemd_system_unitdir}
173 install -m 0644 ${S}/bin/default/packaging/systemd/*.service ${D}${systemd_system_unitdir}/
174 sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \
175 -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
176 -i ${D}${systemd_system_unitdir}/*.service
177
178 if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then
179 rm -f ${D}${systemd_system_unitdir}/samba.service
180 fi
181
182 install -d ${D}${sysconfdir}/tmpfiles.d
183 install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf
184 echo "d ${localstatedir}/log/samba 0755 root root -" \
185 >> ${D}${sysconfdir}/tmpfiles.d/samba.conf
186 install -d ${D}${sysconfdir}/init.d
187 install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba
188 sed -e 's,/opt/samba/bin,${sbindir},g' \
189 -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \
190 -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \
191 -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \
192 -e 's,/usr/bin,${base_bindir},g' \
193 -i ${D}${sysconfdir}/init.d/samba
194
195 install -d ${D}${sysconfdir}/samba
196 echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts
197 install -m644 ${UNPACKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf
198 install -D -m 644 ${UNPACKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba
199
200 install -d ${D}${sysconfdir}/default
201 install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba
202
203 # the items are from ctdb/tests/run_tests.sh
204 for d in cunit eventd eventscripts onnode shellcheck takeover takeover_helper tool; do
205 testdir=${D}${datadir}/ctdb-tests/UNIT/$d
206 install -d $testdir
207 cp ${S}/ctdb/tests/UNIT/$d/*.sh $testdir
208 cp -r ${S}/ctdb/tests/UNIT/$d/scripts ${S}/ctdb/tests/UNIT/$d/stubs $testdir || true
209 done
210
211 # fix file-rdeps qa warning
212 if [ -f ${D}${bindir}/onnode ]; then
213 sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode
214 fi
215
216 chmod 0750 ${D}${sysconfdir}/sudoers.d || true
217 rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log
218
219 for f in samba-gpupdate samba_upgradedns samba_spnupdate samba_kcc samba_dnsupdate samba_downgrade_db; do
220 if [ -f "${D}${sbindir}/$f" ]; then
221 sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${sbindir}/$f
222 fi
223 done
224 if [ -f "${D}${bindir}/samba-tool" ]; then
225 sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${bindir}/samba-tool
226 fi
227
228 oe_runmake -C ${S}/pidl DESTDIR=${D} install_vendor
229 find ${D}${libdir}/perl5/ -type f -name "perllocal.pod" -delete
230 find ${D}${libdir}/perl5/ -type f -name ".packlist" -delete
231 sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${bindir}/pidl
232
233 sed -i 's,${UNPACKDIR},,g' ${S}/bin/default/libcli/wsp/wsp_aqs_lexer.c
234 sed -i 's,${UNPACKDIR},,g' ${S}/bin/default/libcli/wsp/wsp_aqs_lexer.h
235}
236
237PACKAGES =+ "${PN}-python3 ${PN}-pidl \
238 ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
239 winbind ctdb ctdb-tests \
240 ${PN}-common ${PN}-base ${PN}-ad-dc \
241 smbclient ${PN}-client ${PN}-server ${PN}-test"
242
243python samba_populate_packages() {
244 def module_hook(file, pkg, pattern, format, basename):
245 pn = d.getVar('PN')
246 d.appendVar('RRECOMMENDS:%s-base' % pn, ' %s' % pkg)
247
248 mlprefix = d.getVar('MLPREFIX') or ''
249 pam_libdir = d.expand('${base_libdir}/security')
250 pam_pkgname = mlprefix + 'pam-plugin%s'
251 do_split_packages(d, pam_libdir, r'^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True)
252
253 libdir = d.getVar('libdir')
254 do_split_packages(d, libdir, r'^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True)
255 pkglibdir = '%s/samba' % libdir
256 do_split_packages(d, pkglibdir, r'^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True)
257 moduledir = '%s/samba/auth' % libdir
258 do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True)
259 moduledir = '%s/samba/pdb' % libdir
260 do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True)
261}
262
263PACKAGESPLITFUNCS:prepend = "samba_populate_packages "
264PACKAGES_DYNAMIC = "samba-auth-.* samba-pdb-.*"
265
266RDEPENDS:${PN} += "${PN}-base ${PN}-python3 ${PN}-dsdb-modules python3"
267RDEPENDS:${PN}-python3 += "pytalloc python3-tdb"
268
269FILES:${PN}-base = "${sbindir}/nmbd \
270 ${sbindir}/smbd \
271 ${sysconfdir}/init.d \
272 ${systemd_system_unitdir}/nmb.service \
273 ${systemd_system_unitdir}/smb.service"
274
275FILES:${PN}-ad-dc = "${sbindir}/samba \
276 ${systemd_system_unitdir}/samba.service \
277 ${libdir}/krb5/plugins/kdb/samba.so \
278"
279
280RDEPENDS:${PN}-ad-dc = "krb5-kdc"
281
282FILES:ctdb = "${bindir}/ctdb \
283 ${bindir}/ctdb_diagnostics \
284 ${bindir}/ltdbtool \
285 ${bindir}/onnode \
286 ${bindir}/ping_pong \
287 ${sbindir}/ctdbd \
288 ${datadir}/ctdb \
289 ${libexecdir}/ctdb \
290 ${localstatedir}/lib/ctdb \
291 ${sysconfdir}/ctdb \
292 ${sysconfdir}/sudoers.d/ctdb \
293 ${systemd_system_unitdir}/ctdb.service \
294"
295
296FILES:ctdb-tests = "${bindir}/ctdb_run_tests \
297 ${bindir}/ctdb_run_cluster_tests \
298 ${datadir}/ctdb-tests \
299 ${datadir}/ctdb/tests \
300"
301
302RDEPENDS:ctdb-tests += "bash util-linux-getopt ctdb"
303
304FILES:${BPN}-common = "${sysconfdir}/default \
305 ${sysconfdir}/samba \
306 ${sysconfdir}/tmpfiles.d \
307 ${localstatedir}/lib/samba \
308 ${localstatedir}/spool/samba \
309"
310
311FILES:${PN} += "${libdir}/vfs/*.so \
312 ${libdir}/charset/*.so \
313 ${libdir}/*.dat \
314 ${libdir}/auth/*.so \
315"
316
317FILES:${PN}-dsdb-modules = "${libdir}/samba/ldb"
318
319FILES:${PN}-testsuite = "${bindir}/gentest \
320 ${bindir}/locktest \
321 ${bindir}/masktest \
322 ${bindir}/ndrdump \
323 ${bindir}/smbtorture"
324
325FILES:registry-tools = "${bindir}/regdiff \
326 ${bindir}/regpatch \
327 ${bindir}/regshell \
328 ${bindir}/regtree"
329
330FILES:winbind = "${sbindir}/winbindd \
331 ${bindir}/wbinfo \
332 ${bindir}/ntlm_auth \
333 ${libdir}/samba/idmap \
334 ${libdir}/samba/nss_info \
335 ${libdir}/winbind_krb5_locator.so \
336 ${libdir}/winbind-krb5-localauth.so \
337 ${sysconfdir}/init.d/winbind \
338 ${systemd_system_unitdir}/winbind.service"
339
340FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}"
341
342FILES:smbclient = "${bindir}/cifsdd \
343 ${bindir}/rpcclient \
344 ${bindir}/smbcacls \
345 ${bindir}/smbclient \
346 ${bindir}/smbcquotas \
347 ${bindir}/smbget \
348 ${bindir}/smbspool \
349 ${bindir}/smbtar \
350 ${bindir}/smbtree \
351 ${libexecdir}/samba/smbspool_krb5_wrapper"
352
353FILES:${PN}-pidl = "${bindir}/pidl \
354 ${libdir}/perl5 \
355 "
356RDEPENDS:${PN}-pidl += "perl perl-modules libparse-yapp-perl"
357
358RDEPENDS:${PN}-client = "\
359 smbclient \
360 winbind \
361 registry-tools \
362 ${PN}-pidl \
363 "
364
365ALLOW_EMPTY:${PN}-client = "1"
366
367RDEPENDS:${PN}-server = "\
368 ${PN} \
369 winbind \
370 registry-tools \
371 "
372
373ALLOW_EMPTY:${PN}-server = "1"
374
375RDEPENDS:${PN}-test = "\
376 ctdb-tests \
377 ${PN}-testsuite \
378 "
379
380pkg_postinst:${PN}-common() {
381 if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
382 ${sysconfdir}/init.d/populate-volatile.sh update
383 fi
384}
385
386ALLOW_EMPTY:${PN}-test = "1"