File shadow.spec of Package shadow

#
# spec file for package shadow
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%if ! %{defined _distconfdir}
  %define _distconfdir %{_sysconfdir}
%else
  %define no_config 1
%endif

Name:           shadow
Version:        4.8.1
Release:        0
Summary:        Utilities to Manage User and Group Accounts
License:        BSD-3-Clause AND GPL-2.0-or-later
Group:          System/Base
URL:            https://github.com/shadow-maint/shadow
Source:         https://github.com/shadow-maint/shadow/releases/download/%{version}/shadow-%{version}.tar.xz
Source1:        pamd.tar.bz2
Source42:       https://github.com/shadow-maint/shadow/releases/download/%{version}/shadow-%{version}.tar.xz.asc
Source43:       %{name}.keyring
# SOURCE-FEATURE-SUSE shadow-login_defs-check.sh sbrabec@suse.com -- Supplementary script that verifies coverage of variables in shadow-login_defs-unused-by-pam.patch and other patches.
Source44:       shadow-login_defs-check.sh
# PATCH-FIX-SUSE shadow-login_defs-unused-by-pam.patch kukuk@suse.com -- Remove variables that have no use with PAM.
Patch0:         shadow-login_defs-unused-by-pam.patch
# PATCH-FEATURE-SUSE userdel-script.patch kukuk@suse.com -- Add support for USERDEL_PRECMD and USERDEL_POSTCMD.
Patch1:         userdel-script.patch
# PATCH-FEATURE-SUSE useradd-script.patch kukuk@suse.com -- Add support for USERADD_CMD.
Patch2:         useradd-script.patch
# PATCH-FEATURE-SUSE chkname-regex.patch kukuk@suse.com -- Username restriction by regex.
Patch3:         chkname-regex.patch
# PATCH-FEATURE-SUSE useradd-default.patch kukuk@suse.com -- Change useradd defaults group to 1000.
Patch4:         useradd-default.patch
# PATCH-FEATURE-SUSE shadow-util-linux.patch sbrabec@suse.com -- Add support for util-linux specific variables, delete shadow login, su runuser specific.
Patch5:         shadow-util-linux.patch
# PATCH-FEATURE-FEDORA shadow-4.1.5.1-userdel-helpfix.patch christian.brauner@mailbox.org -- Give a hint about what happens when you force the removal of a user.
Patch6:         shadow-4.1.5.1-userdel-helpfix.patch
# PATCH-FIX-FEDORA shadow-4.1.5.1-logmsg.patch kukuk@suse.com -- Fix error message.
Patch7:         shadow-4.1.5.1-logmsg.patch
# PATCH-FEATURE-SUSE shadow-login_defs-comments.patch kukuk@suse.com -- Adjust login.defs comments.
Patch13:        shadow-login_defs-comments.patch
# PATCH-FEATURE-SUSE shadow-login_defs-suse.patch kukuk@suse.com -- Customize login.defs.
Patch14:        shadow-login_defs-suse.patch
# PATCH-FEATURE-SUSE Copy also skeleton files from /usr/etc/skel (boo#1173321)
Patch15:        useradd-userkeleton.patch
# PATCH-FIX-SUSE useradd audit event user id field cannot be interpreted  (boo#1205502)
Patch16:        shadow-4.8.1-AUDIT_NO_ID.patch
# PATCH-FIX-SUSE disable_new_audit_function.patch adam.majer@suse.de -- Disable newer libaudit functionality for older distributions.
Patch20:        disable_new_audit_function.patch
Patch21:        shadow-CVE-2023-29383.patch
# PATCH-FEATURE-UPSTREAM mvetter@suse.com -- Add --prefix support to passwd, chpasswd, chage (bsc#1206627)
Patch22:        shadow-4.8.1-add-prefix-passwd-chpasswd-chage.patch
# PATCH-FIX-UPSTREAM mvetter@suse.com -- Fix potential password leak (bsc#1214806)
Patch24:        shadow-CVE-2023-4641.patch
# PATCH-FIX-UPSTREAM mvetter@suse.com -- Fix chage date miscalculation (bsc#1176006)
Patch25:        shadow-bsc1176006-chage-date.patch
# PATCH-FIX-UPSTREAM mvetter@suse.com -- Fix passwd segfault (bsc#1188307)
Patch26:        shadow-bsc1188307-passwd-segfault.patch
BuildRequires:  audit-devel > 2.3
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libacl-devel
BuildRequires:  libattr-devel
BuildRequires:  libeconf-devel
BuildRequires:  libselinux-devel
BuildRequires:  libsemanage-devel
BuildRequires:  libtool
BuildRequires:  pam-devel
BuildRequires:  xz
Requires(pre):  group(root)
Requires(pre):  group(shadow)
Requires(pre):  permissions
Requires(pre):  user(root)
Provides:       pwdutils = 3.2.20
Obsoletes:      pwdutils <= 3.2.19
Requires:       login_defs >= %{version}
Provides:       useradd_or_adduser_dep

%description
This package includes the necessary programs for converting plain
password files to the shadow password format and to manage user and
group accounts.

%package -n grpconv
Summary:        Convert to and from shadow groups
Group:          System/Base
Requires:       shadow

%description -n grpconv
This package contains grpconv and grpunconv which are tools to
operate on the normal and shadow group files.

%prep
%setup -q -a 1
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch13
%patch14
%patch15
%patch16 -p1
%if 0%{?suse_version} < 1330
%patch20 -p1
%endif
%patch21 -p1
%patch22 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1

iconv -f ISO88591 -t utf-8  doc/HOWTO > doc/HOWTO.utf8
mv -v doc/HOWTO.utf8 doc/HOWTO

%build
export CFLAGS="%{optflags} -fpie"
export LDFLAGS="-pie"

autoreconf -fvi
%configure \
  --enable-shadowgrp \
  --enable-account-tools-setuid \
  --with-audit \
  --with-libpam \
  --with-sha-crypt \
  --with-acl \
  --with-attr \
  --with-nscd \
  --with-selinux \
  --without-libcrack \
  --disable-shared \
  --with-group-name-max-length=32 \
  --enable-vendordir=%{_distconfdir}
make %{?_smp_mflags} V=1

%install
%make_install gnulocaledir=%{buildroot}/%{_datadir}/locale MKINSTALLDIRS=`pwd`/mkinstalldirs

# Remove binaries we don't use.
rm -rf %{buildroot}%{_bindir}
rm -rf %{buildroot}%{_mandir}/man1
rm -rf %{buildroot}%{_mandir}/man3
rm -rf %{buildroot}%{_mandir}/man5
rm -rf %{buildroot}%{_mandir}/{??,??_??}
rm -rf %{buildroot}%{_sysconfdir}
rm -f %{buildroot}%{_sbindir}/vigr

find %{buildroot} ! -name 'grpconv' \
                  ! -name 'grpunconv' \
                  ! -name 'grpconv.8' \
                  ! -name 'grpunconv.8' \
                  -type f -exec rm -f {} +

%files -n grpconv
%{_sbindir}/grpconv
%{_sbindir}/grpunconv
%{_mandir}/man8/grpconv.8%{?ext_man}
%{_mandir}/man8/grpunconv.8%{?ext_man}

%changelog
openSUSE Build Service is sponsored by