blob: ac3097ef7c35e74c770b3d5b0219f7849a838f45 [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
31SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch"
32SRC_URI_append_libc-musl = " file://pam-no-innetgr.patch"
33
34DEPENDS = "bison flex flex-native cracklib"
35
36EXTRA_OECONF = "--with-db-uniquename=_pam \
37 --includedir=${includedir}/security \
38 --libdir=${base_libdir} \
39 --disable-nis \
40 --disable-regenerate-docu \
41 --disable-prelude"
42
43CFLAGS_append = " -fPIC "
44
45PR = "r5"
46
47S = "${WORKDIR}/Linux-PAM-${PV}"
48
49inherit autotools gettext pkgconfig
50
51PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
52
53PACKAGES += "${PN}-runtime ${PN}-xtests"
54FILES_${PN} = "${base_libdir}/lib*${SOLIBS}"
55FILES_${PN}-dbg += "${base_libdir}/security/.debug \
56 ${base_libdir}/security/pam_filter/.debug \
57 ${datadir}/Linux-PAM/xtests/.debug"
58
59FILES_${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
60FILES_${PN}-runtime = "${sysconfdir}"
61FILES_${PN}-xtests = "${datadir}/Linux-PAM/xtests"
62
63PACKAGES_DYNAMIC += "^${MLPREFIX}pam-plugin-.*"
64
65def get_multilib_bit(d):
66 baselib = d.getVar('baselib', True) or ''
67 return baselib.replace('lib', '')
68
69libpam_suffix = "suffix${@get_multilib_bit(d)}"
70
71RPROVIDES_${PN} += "${PN}-${libpam_suffix}"
72RPROVIDES_${PN}-runtime += "${PN}-runtime-${libpam_suffix}"
73
74RDEPENDS_${PN}-runtime = "${PN}-${libpam_suffix} \
75 ${MLPREFIX}pam-plugin-deny-${libpam_suffix} \
76 ${MLPREFIX}pam-plugin-permit-${libpam_suffix} \
77 ${MLPREFIX}pam-plugin-warn-${libpam_suffix} \
78 ${MLPREFIX}pam-plugin-unix-${libpam_suffix} \
79 "
80RDEPENDS_${PN}-xtests = "${PN}-${libpam_suffix} \
81 ${MLPREFIX}pam-plugin-access-${libpam_suffix} \
82 ${MLPREFIX}pam-plugin-debug-${libpam_suffix} \
83 ${MLPREFIX}pam-plugin-cracklib-${libpam_suffix} \
84 ${MLPREFIX}pam-plugin-pwhistory-${libpam_suffix} \
85 ${MLPREFIX}pam-plugin-succeed-if-${libpam_suffix} \
86 ${MLPREFIX}pam-plugin-time-${libpam_suffix} \
87 coreutils"
88
89# FIXME: Native suffix breaks here, disable it for now
90RRECOMMENDS_${PN} = "${PN}-runtime-${libpam_suffix}"
91RRECOMMENDS_${PN}_class-native = ""
92
93python populate_packages_prepend () {
94 def pam_plugin_append_file(pn, dir, file):
95 nf = os.path.join(dir, file)
96 of = d.getVar('FILES_' + pn, True)
97 if of:
98 nf = of + " " + nf
99 d.setVar('FILES_' + pn, nf)
100
101 def pam_plugin_hook(file, pkg, pattern, format, basename):
102 pn = d.getVar('PN', True)
103 libpam_suffix = d.getVar('libpam_suffix', True)
104
105 rdeps = d.getVar('RDEPENDS_' + pkg, True)
106 if rdeps:
107 rdeps = rdeps + " " + pn + "-" + libpam_suffix
108 else:
109 rdeps = pn + "-" + libpam_suffix
110 d.setVar('RDEPENDS_' + pkg, rdeps)
111
112 provides = d.getVar('RPROVIDES_' + pkg, True)
113 if provides:
114 provides = provides + " " + pkg + "-" + libpam_suffix
115 else:
116 provides = pkg + "-" + libpam_suffix
117 d.setVar('RPROVIDES_' + pkg, provides)
118
119 mlprefix = d.getVar('MLPREFIX', True) or ''
120 dvar = bb.data.expand('${WORKDIR}/package', d, True)
121 pam_libdir = d.expand('${base_libdir}/security')
122 pam_sbindir = d.expand('${sbindir}')
123 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
124 pam_pkgname = mlprefix + 'pam-plugin%s'
125
126 do_split_packages(d, pam_libdir, '^pam(.*)\.so$', pam_pkgname,
127 'PAM plugin for %s', hook=pam_plugin_hook, extra_depends='')
128 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd')
129 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update')
130 pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally')
131 pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2')
132 pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check')
133 pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper')
134 pam_plugin_append_file('%spam-plugin-console' % mlprefix, pam_sbindir, 'pam_console_apply')
135 do_split_packages(d, pam_filterdir, '^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
136}
137
138do_install() {
139 autotools_do_install
140
141 # don't install /var/run when populating rootfs. Do it through volatile
142 rm -rf ${D}${localstatedir}
143 install -d ${D}${sysconfdir}/default/volatiles
144 install -m 0644 ${WORKDIR}/99_pam ${D}${sysconfdir}/default/volatiles
145
146 install -d ${D}${sysconfdir}/pam.d/
147 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
148
149 # The lsb requires unix_chkpwd has setuid permission
150 chmod 4755 ${D}${sbindir}/unix_chkpwd
151
152 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
153 echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session
154 fi
155}
156
157python do_pam_sanity () {
158 if not bb.utils.contains('DISTRO_FEATURES', 'pam', True, False, d):
159 bb.warn("Building libpam but 'pam' isn't in DISTRO_FEATURES, PAM won't work correctly")
160}
161addtask pam_sanity before do_configure
162
163BBCLASSEXTEND = "nativesdk native"
164
165CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session"
166CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-auth"
167CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-password"
168CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-session-noninteractive"
169CONFFILES_${PN}-runtime += "${sysconfdir}/pam.d/common-account"