blob: 0353356568791f548b6477a51818994ee021f3a6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Linux-PAM (Pluggable Authentication Modules)"
2DESCRIPTION = "Linux-PAM (Pluggable Authentication Modules for Linux), a flexible mechanism for authenticating users"
3HOMEPAGE = "https://fedorahosted.org/linux-pam/"
4BUGTRACKER = "https://fedorahosted.org/linux-pam/newticket"
5SECTION = "base"
6# PAM is dual licensed under GPL and BSD.
7# /etc/pam.d comes from Debian libpam-runtime in 2009-11 (at that time
8# libpam-runtime-1.0.1 is GPLv2+), by openembedded
9LICENSE = "GPLv2+ | BSD"
10LIC_FILES_CHKSUM = "file://COPYING;md5=7eb5c1bf854e8881005d673599ee74d3"
11
12SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \
13 file://99_pam \
14 file://pam.d/common-account \
15 file://pam.d/common-auth \
16 file://pam.d/common-password \
17 file://pam.d/common-session \
18 file://pam.d/common-session-noninteractive \
19 file://pam.d/other \
20 file://libpam-xtests.patch \
21 file://fixsepbuild.patch \
22 file://pam-security-abstract-securetty-handling.patch \
23 file://pam-unix-nullok-secure.patch \
24 file://libpam-xtests-remove-bash-dependency.patch \
25 file://crypt_configure.patch \
26 "
27
28SRC_URI[md5sum] = "9dc53067556d2dd567808fd509519dd6"
29SRC_URI[sha256sum] = "342b1211c0d3b203a7df2540a5b03a428a087bd8a48c17e49ae268f992b334d9"
30
Patrick Williamsf1e5d692016-03-30 15:21:19 -050031SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch \
32 file://use-utmpx.patch"
33
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch"
35
36DEPENDS = "bison flex flex-native cracklib"
37
38EXTRA_OECONF = "--with-db-uniquename=_pam \
39 --includedir=${includedir}/security \
40 --libdir=${base_libdir} \
41 --disable-nis \
42 --disable-regenerate-docu \
43 --disable-prelude"
44
45CFLAGS_append = " -fPIC "
46
47PR = "r5"
48
49S = "${WORKDIR}/Linux-PAM-${PV}"
50
51inherit autotools gettext pkgconfig
52
53PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
54
55PACKAGES += "${PN}-runtime ${PN}-xtests"
56FILES_${PN} = "${base_libdir}/lib*${SOLIBS}"
57FILES_${PN}-dbg += "${base_libdir}/security/.debug \
58 ${base_libdir}/security/pam_filter/.debug \
59 ${datadir}/Linux-PAM/xtests/.debug"
60
61FILES_${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
62FILES_${PN}-runtime = "${sysconfdir}"
63FILES_${PN}-xtests = "${datadir}/Linux-PAM/xtests"
64
65PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
66
67def get_multilib_bit(d):
68 baselib = d.getVar('baselib', True) or ''
69 return baselib.replace('lib', '')
70
71libpam_suffix = "suffix${@get_multilib_bit(d)}"
72
73RPROVIDES_${PN} += "${PN}-${libpam_suffix}"
74RPROVIDES_${PN}-runtime += "${PN}-runtime-${libpam_suffix}"
75
76RDEPENDS_${PN}-runtime = "${PN}-${libpam_suffix} \
77 ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \
78 ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \
79 ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \
80 ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \
81 "
82RDEPENDS_${PN}-xtests = "${PN}-${libpam_suffix} \
83 ${MLPREFIX}pam-plugin-access-${libpam_suffix} \
84 ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \
85 ${MLPREFIX}pam-plugin-cracklib-${libpam_suffix} \
86 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
87 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
88 ${MLPREFIX}pam-plugin-time-${libpam_suffix} \
89 coreutils"
90
91# FIXME: Native suffix breaks here, disable it for now
92RRECOMMENDS_${PN} = "${PN}-runtime-${libpam_suffix}"
93RRECOMMENDS_${PN}_class-native = ""
94
95python populate_packages_prepend () {
96 def pam_plugin_append_file(pn, dir, file):
97 nf = os.path.join(dir, file)
98 of = d.getVar('FILES_' + pn, True)
99 if of:
100 nf = of + " " + nf
101 d.setVar('FILES_' + pn, nf)
102
103 def pam_plugin_hook(file, pkg, pattern, format, basename):
104 pn = d.getVar('PN', True)
105 libpam_suffix = d.getVar('libpam_suffix', True)
106
107 rdeps = d.getVar('RDEPENDS_' + pkg, True)
108 if rdeps:
109 rdeps = rdeps + " " + pn + "-" + libpam_suffix
110 else:
111 rdeps = pn + "-" + libpam_suffix
112 d.setVar('RDEPENDS_' + pkg, rdeps)
113
114 provides = d.getVar('RPROVIDES_' + pkg, True)
115 if provides:
116 provides = provides + " " + pkg + "-" + libpam_suffix
117 else:
118 provides = pkg + "-" + libpam_suffix
119 d.setVar('RPROVIDES_' + pkg, provides)
120
121 mlprefix = d.getVar('MLPREFIX', True) or ''
122 dvar = bb.data.expand('${WORKDIR}/package', d, True)
123 pam_libdir = d.expand('${base_libdir}/security')
124 pam_sbindir = d.expand('${sbindir}')
125 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
126 pam_pkgname = mlprefix + 'pam-plugin%s'
127
128 do_split_packages(d, pam_libdir, '^pam(.*)\.so$', pam_pkgname,
129 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='')
130 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd')
131 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update')
132 pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally')
133 pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2')
134 pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check')
135 pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper')
136 pam_plugin_append_file('%spam-plugin-console' % mlprefix, pam_sbindir, 'pam_console_apply')
137 do_split_packages(d, pam_filterdir, '^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
138}
139
140do_install() {
141 autotools_do_install
142
143 # don't install /var/run when populating rootfs. Do it through volatile
144 rm -rf ${D}${localstatedir}
145 install -d ${D}${sysconfdir}/default/volatiles
146 install -m 0644 ${WORKDIR}/99_pam ${D}${sysconfdir}/default/volatiles
147
148 install -d ${D}${sysconfdir}/pam.d/
149 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
150
151 # The lsb requires unix_chkpwd has setuid permission
152 chmod 4755 ${D}${sbindir}/unix_chkpwd
153
154 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
155 echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session
156 fi
157}
158
159python do_pam_sanity () {
160 if not bb.utils.contains('DISTRO_FEATURES', 'pam', True, False, d):
161 bb.warn("Building libpam but 'pam' isn't in DISTRO_FEATURES, PAM won't work correctly")
162}
163addtask pam_sanity before do_configure
164
165BBCLASSEXTEND = "nativesdk native"
166
167CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session"
168CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-auth"
169CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-password"
170CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive"
171CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-account"