blob: d57b0eab15bb869652438eef58ba686f79d1b909 [file] [log] [blame]
kasunath951f1aa2022-08-10 11:08:14 -07001# Remove cracklib from PAM, to avoid breaking PAM and further dependencies
2# This allows cracklib to be neatly severed from the system.
3
4EXTRA_OECONF:append:gbmc = " --disable-cracklib"
5
6DEPENDS:remove:gbmc = "cracklib"
7
8RDEPENDS:${PN}-runtime:remove:gbmc = "pam-plugin-cracklib-suffix"
9
10RDEPENDS:${PN}-xtests:remove:gbmc = "${MLPREFIX}pam-plugin-cracklib-${libpam_suffix}"
11
12do_install:append:gbmc() {
13 # Remove reference to cracklib library from PAM config file
14 sed -i '/pam_cracklib.so/d' ${D}${sysconfdir}/pam.d/common-password
Oskar Senft6cc57fe2022-10-05 08:27:03 -040015
16 # Remove the first occurrence of "use_authtok" in the first line starting
17 # with "password". This makes sure that if pam_cracklib.so was the first
18 # entry, we didn't invalidate the next entry in the stack. If the first
19 # entry has the "use_authtok" set, this "forces the module to not prompt
20 # the user for a new password but use the one provided by the previously
21 # stacked password module". Since there is no "previous" entry, it never
22 # asks for a password which causes the process to fail.
23 awk '/^password/ && !f{sub(/ use_authtok/, ""); f=1} 1' \
24 ${D}${sysconfdir}/pam.d/common-password \
25 > ${D}${sysconfdir}/pam.d/common-password.new
26 mv ${D}${sysconfdir}/pam.d/common-password.new \
27 ${D}${sysconfdir}/pam.d/common-password
kasunath951f1aa2022-08-10 11:08:14 -070028}