1################################################################################
2#
3# shadow
4#
5################################################################################
6
7SHADOW_VERSION = 4.14.5
8SHADOW_SITE = https://github.com/shadow-maint/shadow/releases/download/$(SHADOW_VERSION)
9SHADOW_SOURCE = shadow-$(SHADOW_VERSION).tar.xz
10SHADOW_LICENSE = BSD-3-Clause
11SHADOW_LICENSE_FILES = COPYING
12SHADOW_CPE_ID_VENDOR = debian
13SHADOW_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
14SHADOW_CONF_ENV = LIBS=$(TARGET_NLS_LIBS)
15
16SHADOW_CONF_OPTS = \
17	--disable-man \
18	--without-btrfs \
19	--without-nscd \
20	--without-skey \
21	--without-sssd \
22	--without-su \
23	--without-tcb
24
25ifeq ($(BR2_PACKAGE_SHADOW_SHADOWGRP),y)
26SHADOW_CONF_OPTS += --enable-shadowgrp
27else
28SHADOW_CONF_OPTS += --disable-shadowgrp
29endif
30
31ifeq ($(BR2_PACKAGE_SHADOW_ACCOUNT_TOOLS_SETUID),y)
32SHADOW_CONF_OPTS += --enable-account-tools-setuid
33define SHADOW_ACCOUNT_TOOLS_SETUID_PERMISSIONS
34	/usr/sbin/chgpasswd f 4755 0 0 - - - - -
35	/usr/sbin/chpasswd f 4755 0 0 - - - - -
36	/usr/sbin/groupadd f 4755 0 0 - - - - -
37	/usr/sbin/groupdel f 4755 0 0 - - - - -
38	/usr/sbin/groupmod f 4755 0 0 - - - - -
39	/usr/sbin/newusers f 4755 0 0 - - - - -
40	/usr/sbin/useradd f 4755 0 0 - - - - -
41	/usr/sbin/userdel f 4755 0 0 - - - - -
42	/usr/sbin/usermod f 4755 0 0 - - - - -
43endef
44else
45SHADOW_CONF_OPTS += --disable-account-tools-setuid
46endif
47
48ifeq ($(BR2_PACKAGE_SHADOW_SUBORDINATE_IDS),y)
49SHADOW_CONF_OPTS += --enable-subordinate-ids
50define SHADOW_SUBORDINATE_IDS_PERMISSIONS
51	/usr/bin/newuidmap f 4755 0 0 - - - - -
52	/usr/bin/newgidmap f 4755 0 0 - - - - -
53endef
54else
55SHADOW_CONF_OPTS += --disable-subordinate-ids
56endif
57
58ifeq ($(BR2_PACKAGE_ACL),y)
59SHADOW_CONF_OPTS += --with-acl
60SHADOW_DEPENDENCIES += acl
61else
62SHADOW_CONF_OPTS += --without-acl
63endif
64
65ifeq ($(BR2_PACKAGE_ATTR),y)
66SHADOW_CONF_OPTS += --with-attr
67SHADOW_DEPENDENCIES += attr
68else
69SHADOW_CONF_OPTS += --without-attr
70endif
71
72ifeq ($(BR2_PACKAGE_AUDIT),y)
73SHADOW_CONF_OPTS += --with-audit
74SHADOW_DEPENDENCIES += audit
75else
76SHADOW_CONF_OPTS += --without-audit
77endif
78
79ifeq ($(BR2_PACKAGE_CRACKLIB),y)
80SHADOW_CONF_OPTS += --with-libcrack
81SHADOW_DEPENDENCIES += cracklib
82else
83SHADOW_CONF_OPTS += --without-libcrack
84endif
85
86ifeq ($(BR2_PACKAGE_LIBSELINUX)$(BR2_PACKAGE_LIBSEMANAGE),yy)
87SHADOW_CONF_OPTS += --with-selinux
88SHADOW_DEPENDENCIES += libselinux libsemanage
89else
90SHADOW_CONF_OPTS += --without-selinux
91endif
92
93ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
94SHADOW_DEPENDENCIES += libxcrypt
95endif
96
97# linux-pam is also used without account-tools-setuid enabled
98ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
99SHADOW_CONF_OPTS += --with-libpam
100SHADOW_DEPENDENCIES += linux-pam
101else
102SHADOW_CONF_OPTS += --without-libpam
103endif
104
105ifeq ($(BR2_PACKAGE_SHADOW_SHA_CRYPT),y)
106SHADOW_CONF_OPTS += --with-sha-crypt
107else
108SHADOW_CONF_OPTS += --without-sha-crypt
109endif
110
111ifeq ($(BR2_PACKAGE_SHADOW_BCRYPT),y)
112SHADOW_CONF_OPTS += --with-bcrypt
113else
114SHADOW_CONF_OPTS += --without-bcrypt
115endif
116
117ifeq ($(BR2_PACKAGE_SHADOW_YESCRYPT),y)
118SHADOW_CONF_OPTS += --with-yescrypt
119else
120SHADOW_CONF_OPTS += --without-yescrypt
121endif
122
123ifeq ($(BR2_PACKAGE_LIBBSD),y)
124SHADOW_CONF_OPTS += --with-libbsd
125SHADOW_DEPENDENCIES += libbsd
126else
127SHADOW_CONF_OPTS += --without-libbsd
128endif
129
130define SHADOW_PERMISSIONS
131	/usr/bin/chage f 4755 0 0 - - - - -
132	/usr/bin/chfn f 4755 0 0 - - - - -
133	/usr/bin/chsh f 4755 0 0 - - - - -
134	/usr/bin/expiry f 4755 0 0 - - - - -
135	/usr/bin/gpasswd f 4755 0 0 - - - - -
136	/usr/bin/newgrp f 4755 0 0 - - - - -
137	/usr/bin/passwd f 4755 0 0 - - - - -
138	$(SHADOW_ACCOUNT_TOOLS_SETUID_PERMISSIONS)
139	$(SHADOW_SUBORDINATE_IDS_PERMISSIONS)
140endef
141
142$(eval $(autotools-package))
143