package/shadow: default to BR2_TARGET_GENERIC_PASSWD_ algo

Make shadow follow the the BR2_TARGET_GENERIC_PASSWD_* system configuration
option when changing password rather than DES.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/issues/134

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 39e6184419)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Peter Korsgaard
2026-02-04 14:56:36 +01:00
committed by Thomas Perale
parent 8571ada6d7
commit 5c76442776

View File

@@ -139,4 +139,19 @@ define SHADOW_PERMISSIONS
$(SHADOW_SUBORDINATE_IDS_PERMISSIONS)
endef
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA256),y)
SHADOW_ENCRYPT_METHOD = SHA256
else ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA512),y)
SHADOW_ENCRYPT_METHOD = SHA512
endif
ifneq ($(SHADOW_ENCRYPT_METHOD),)
define SHADOW_SET_ENCRYPT_METHOD
$(SED) 's/^[#]\?ENCRYPT_METHOD .*/ENCRYPT_METHOD $(SHADOW_ENCRYPT_METHOD)/' \
$(TARGET_DIR)/etc/login.defs
endef
SHADOW_POST_INSTALL_TARGET_HOOKS += SHADOW_SET_ENCRYPT_METHOD
endif
$(eval $(autotools-package))