Name: sssd
Version: 2.6.1
Release: 12
Summary: System Security Services Daemon
License: GPLv3+ and LGPLv3+
URL: https://pagure.io/SSSD/sssd/
Source0: https://github.com/SSSD/sssd/releases/download/%{version}/%{name}-%{version}.tar.gz

Patch6000: backport-UTILS-fixes-CWE-394.patch
Patch6001: pam_sss_gss-KRB5CCNAME-may-be-NULL.patch
Patch6002: SDAP-sdap_get_generic_send-fix-mem-leak.patch
Patch6003: sssctl-free-one-malloc-allocated-variable.patch
Patch6004: PAM-P11-fixed-minor-mem-leak.patch
Patch6005: SSS_CLIENT-mem-cache-fixed-missing-error-code.patch
Patch6006: fix-coredump-during-ifp-reconnect.patch
Patch6007: backport-MONITOR-fix-socket_activated-flag-initialization.patch
Patch6008: backport-SUDO-fix-mistype.patch
Patch6009: backport-KCM-Switch-default-caches-only-when-there-is-no-curr.patch
Patch6010: backport-Fixed-pid-wrapping-in-sss_cli_check_socket.patch
Patch6011: backport-Fixed-the-problem-of-calling-getpid-and-lstat-twice-.patch
Patch6012: backport-AD-Do-not-use-the-shortcut-when-filter_groups-is-set.patch
Patch6013: backport-ad-skip-filtering-if-ad_enabled_domains-is-set.patch
Patch6014: backport-fail_over-protect-against-a-segmentation-fault.patch
Patch6015: backport-ipa-correctly-remove-missing-attributes-on-netgroup-.patch
Patch6016: backport-ad-use-sAMAccountName-to-lookup-hosts.patch
Patch6017: backport-KRB5-avoid-FORWARD_NULL.patch
Patch6018: backport-KRB5-fix-memory-leak-1.patch
Patch6019: backport-KRB5-fix-memory-leak-2.patch
Patch6020: backport-KRB5-avoid-RESOURCE_LEAK.patch
Patch6021: backport-KRB5-fixed-RESOURCE_LEAK.patch
Patch6022: backport-LDAP-fixed-RESOURCE_LEAK.patch
Patch6023: backport-LDAP-fixed-leak-of-kprinc.patch
Patch6024: backport-watchdog-add-arm_watchdog-and-disarm_watchdog-calls.patch
Patch6025: backport-sbus-arm-watchdog-for-sbus_connect_init_send.patch
Patch6026: backport-SYSDB-in-case-ignore_group_members-true-group-is-act.patch
Patch6027: backport-KRB5-avoid-another-attempt-to-free-cc-in-done-sectio.patch
Patch6028: backport-CONFDB-check-the-return-values.patch
Patch6029: backport-UTILS-swap-order-of-seteuid-setegid.patch
Patch6030: backport-sss_iface-do-not-add-cli_id-to-chain-key.patch
Patch6031: backport-KCM-Remove-the-oldest-expired-credential-if-no-more-.patch
Patch6032: backport-Proxy-Avoid-ldb_modify-failed-error.patch
Patch6033: backport-cli-caculate-the-wait_time-in-milliseconds.patch
Patch6034: backport-dyndns-PTR-record-updates-separately.patch
Patch6035: backport-ipa-do-not-go-offline-if-group-does-not-have-SID.patch
Patch6036: backport-KCM-Display-in-the-log-the-limit-as-set-by-the-user.patch

Requires: python3-sssd = %{version}-%{release}
Requires: libldb
Requires: cyrus-sasl-gssapi%{?_isa}
%{?systemd_requires}
Recommends: bind-utils
Recommends: bind-utils
Recommends: adcli

Provides: libsss_sudo-devel = %{version}-%{release}
Provides: sssd-common = %{version}-%{release}
Provides: sssd-ldap = %{version}-%{release}
Provides: sssd-krb5 = %{version}-%{release}
Provides: sssd-krb5-common = %{version}-%{release}
Provides: sssd-ipa = %{version}-%{release}
Provides: sssd-ad = %{version}-%{release}
Provides: sssd-client = %{version}-%{release}
Provides: sssd-common-pac = %{version}-%{release}
Provides: sssd-kcm = %{version}-%{release}
Provides: sssd-dbus = %{version}-%{release}
Provides: libsss_sudo = %{version}-%{release}
Provides: sssd-proxy = %{version}-%{release}
Provides: libsss_idmap = %{version}-%{release}
Provides: libipa_hbac = %{version}-%{release}
Provides: libsss_autofs = %{version}-%{release}
Provides: libsss_nss_idmap = %{version}-%{release}
Provides: libsss_simpleifp = %{version}-%{release}
Provides: libsss_certmap = %{version}-%{release}
Provides: sssd-libwbclient = %{version}-%{release}
Provides: sssd-nfs-idmap = %{version}-%{release}
Provides: sssd-winbind-idmap = %{version}-%{release}
Provides: sssd-tools = %{version}-%{release}

Obsoletes: libsss_sudo-devel <= 1.10.0-7%{?dist}.beta1
Obsoletes: sssd-common < %{version}-%{release}
Obsoletes: sssd-ldap < %{version}-%{release}
Obsoletes: sssd-krb5 < %{version}-%{release}
Obsoletes: sssd-krb5-common < %{version}-%{release}
Obsoletes: sssd-ipa < %{version}-%{release}
Obsoletes: sssd-ad < %{version}-%{release}
Obsoletes: sssd-client < %{version}-%{release}
Obsoletes: sssd-common-pac < %{version}-%{release}
Obsoletes: sssd-kcm < %{version}-%{release}
Obsoletes: sssd-dbus < %{version}-%{release}
Obsoletes: libsss_sudo < %{version}-%{release}
Obsoletes: sssd-proxy < %{version}-%{release}
Obsoletes: libsss_idmap < %{version}-%{release}
Obsoletes: libipa_hbac < %{version}-%{release}
Obsoletes: libsss_autofs < %{version}-%{release}
Obsoletes: libsss_nss_idmap < %{version}-%{release}
Obsoletes: libsss_simpleifp < %{version}-%{release}
Obsoletes: libsss_certmap < %{version}-%{release}
Obsoletes: sssd-libwbclient < %{version}-%{release}
Obsoletes: sssd-nfs-idmap < %{version}-%{release}
Obsoletes: sssd-winbind-idmap < %{version}-%{release}
Obsoletes: sssd-tools < %{version}-%{release}

Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires(post):  /usr/sbin/alternatives
Requires(preun): /usr/sbin/alternatives

%global ldb_modulesdir %(pkg-config --variable=modulesdir ldb)

BuildRequires: autoconf automake libtool m4 gcc popt-devel libtalloc-devel libtevent-devel
BuildRequires: libtdb-devel libldb-devel libdhash-devel  libcollection-devel
BuildRequires: libini_config-devel dbus-devel dbus-libs openldap-devel pam-devel
BuildRequires: nss-devel nspr-devel pcre2-devel libxslt libxml2 docbook-style-xsl
BuildRequires: krb5-devel c-ares-devel python3-devel check-devel
BuildRequires: doxygen libselinux-devel libsemanage-devel bind-utils keyutils-libs-devel
BuildRequires: gettext-devel pkgconfig diffstat findutils glib2-devel selinux-policy-targeted
BuildRequires: libcmocka-devel  uid_wrapper nss_wrapper libnl3-devel systemd-devel systemd
BuildRequires: cifs-utils-devel libnfsidmap-devel samba4-devel libsmbclient-devel samba-winbind
BuildRequires: systemtap-sdt-devel http-parser-devel libuuid-devel jansson-devel libcurl-devel
BuildRequires: gdm-pam-extensions-devel p11-kit-devel openssl-devel gnutls-utils softhsm 
BuildRequires: openssl openssh nss-tools chrpath ding-libs-devel
BuildRequires: libunistring libunistring-devel

%description
SSSD provides a set of daemons to manage access to remote directories
and authentication mechanisms such as LDAP, Kerberos or FreeIPA. It
provides an NSS and PAM interface toward the system and a pluggable
backend system to connect to multiple different account sources.

%package devel
Summary: Development libraries for the SSSD
License: GPLv3+ and LGPLv3+
Requires: dbus-devel
Requires: sssd = %{version}-%{release}

Provides: libsss_idmap-devel = %{version}-%{release}
Provides: libipa_hbac-devel = %{version}-%{release}
Provides: libsss_nss_idmap-devel = %{version}-%{release}
Provides: libsss_simpleifp-devel = %{version}-%{release}
Provides: libsss_certmap-devel = %{version}-%{release}
Provides: sssd-libwbclient-devel = %{version}-%{release}

Obsoletes: libsss_idmap-devel < %{version}-%{release}
Obsoletes: libipa_hbac-devel < %{version}-%{release}
Obsoletes: libsss_nss_idmap-devel < %{version}-%{release}
Obsoletes: libsss_simpleifp-devel < %{version}-%{release}
Obsoletes: libsss_certmap-devel < %{version}-%{release}
Obsoletes: sssd-libwbclient-devel < %{version}-%{release}

%description devel
Development libraries for the SSSD

%package -n python3-sssd
Summary: Python3 bindings for sssd
License: LGPLv3+
Requires: sssd = %{version}-%{release}
Provides: python3-sss = %{version}-%{release}
Provides: python3-sssdconfig = %{version}-%{release}
Provides: python3-sss-murmur = %{version}-%{release}
provides: python3-libsss_nss_idmap = %{version}-%{release}
Provides: python3-libipa_hbac = %{version}-%{release}
Obsoletes: python3-sss < %{version}-%{release}
Obsoletes: python3-sssdconfig < %{version}-%{release}
Obsoletes: python3-sss-murmur < %{version}-%{release}
Obsoletes: python3-libipa_hbac < %{version}-%{release}
Obsoletes: python3-libsss_nss_idmap < %{version}-%{release}
%{?python_provide:%python_provide python3-sssd}
%{?python_provide:%python_provide python3-sss}
%{?python_provide:%python_provide python3-sssdconfig}
%{?python_provide:%python_provide python3-sss-murmur}
%{?python_provide:%python_provide python3-libipa_hbac}
%{?python_provide:%python_provide python3-libsss_nss_idmap}

%description -n python3-sssd
Python3 bindings for sssd

%package_help

%prep
%autosetup -p1

%build
autoreconf -ivf

%configure \
    --with-test-dir=/dev/shm \
    --with-db-path=%{_localstatedir}/lib/sss/db \
    --with-mcache-path=%{_localstatedir}/lib/sss/mc \
    --with-pipe-path=%{_localstatedir}/lib/sss/pipes \
    --with-pubconf-path=%{_localstatedir}/lib/sss/pubconf \
    --with-gpo-cache-path=%{_localstatedir}/lib/sss/gpo_cache \
    --with-init-dir=%{_initrddir} \
    --with-krb5-rcache-dir=%{_localstatedir}/cache/krb5rcache \
    --enable-nsslibdir=%{_libdir} \
    --enable-pammoddir=%{_libdir}/security \
    --enable-nfsidmaplibdir=%{_libdir}/libnfsidmap \
    --disable-static \
    --disable-rpath \
    --with-initscript=systemd \
    --with-syslog=journald \
    --with-crypto=libcrypto \
    --without-python2-bindings \
    --enable-sss-default-nss-plugin \
    --enable-files-domain \
    %{?with_cifs_utils_plugin_option} \
    --enable-systemtap

%make_build  all docs

%check
export CK_TIMEOUT_MULTIPLIER=10
make %{?_smp_mflags} check VERBOSE=yes
unset CK_TIMEOUT_MULTIPLIER

%install

sed -i -e 's:/usr/bin/python:/usr/bin/python3:' src/tools/sss_obfuscate

%make_install
/usr/lib/rpm/find-lang.sh $RPM_BUILD_ROOT sssd

# install default sssd.conf file
install -m600 src/examples/sssd-example.conf $RPM_BUILD_ROOT%{_sysconfdir}/sssd/sssd.conf
install -m644 src/examples/sssd-example.conf $RPM_BUILD_ROOT%{_pkgdocdir}

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
install -m644 src/examples/logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/sssd

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d
install -m644 src/examples/rwtab $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/sssd

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/krb5.conf.d
cp $RPM_BUILD_ROOT/%{_datadir}/sssd-kcm/kcm_default_ccache \
   $RPM_BUILD_ROOT/%{_sysconfdir}/krb5.conf.d/kcm_default_ccache

mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cifs-utils

%delete_la

for file in `ls $RPM_BUILD_ROOT/%{python3_sitelib}/*.egg-info 2> /dev/null`
do
    echo %{python3_sitelib}/`basename $file` >> python3_sssd.lang
done

touch sssd.lang

chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/ldap_child
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/krb5_child

chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_pac

chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_krb5.so

chrpath -d $RPM_BUILD_ROOT%{ldb_modulesdir}/memberof.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_files.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_simple.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_child.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_semanage.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_krb5_common.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libifp_iface_sync.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_iface.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_cert.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_iface_sync.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_util.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libifp_iface.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_crypt.so
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_ldap_common.so
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_check_socket_activated_responders
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sss_signal
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_pam
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_sudo
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_autofs
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/p11_child
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_nss
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_be
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_ssh
chrpath -d $RPM_BUILD_ROOT%{_bindir}/sss_ssh_authorizedkeys
chrpath -d $RPM_BUILD_ROOT%{_bindir}/sss_ssh_knownhostsproxy
chrpath -d $RPM_BUILD_ROOT%{_sbindir}/sss_cache
chrpath -d $RPM_BUILD_ROOT%{_sbindir}/sssd
chrpath -d $RPM_BUILD_ROOT%{_sbindir}/sssctl
chrpath -d $RPM_BUILD_ROOT%{_sbindir}/sss_override
chrpath -d $RPM_BUILD_ROOT%{_sbindir}/sss_seed
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_ifp

chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_ipa.so
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/selinux_child

chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/sssd_kcm

chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_ldap.so

chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_ad.so
chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/gpo_child

chrpath -d $RPM_BUILD_ROOT%{_libexecdir}/sssd/proxy_child
chrpath -d $RPM_BUILD_ROOT%{_libdir}/%{name}/libsss_proxy.so
chrpath -d $RPM_BUILD_ROOT%{python3_sitearch}/pysss.so
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "/usr/lib64/sssd" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf

for man in `find $RPM_BUILD_ROOT/%{_mandir}/??/man?/ -type f | sed -e "s#$RPM_BUILD_ROOT/%{_mandir}/##"`
do
    lang=`echo $man | cut -c 1-2`
    case `basename $man` in
        *)
            echo \%lang\(${lang}\) \%{_mandir}/${man}\* >> sssd.lang
            ;;
    esac
done

%files -f sssd.lang
%license COPYING
%license src/sss_client/COPYING.LESSER
%{_sbindir}/sssd
%{_unitdir}/sssd.service
%{_unitdir}/sssd-autofs.socket
%{_unitdir}/sssd-autofs.service
%{_unitdir}/sssd-nss.socket
%{_unitdir}/sssd-nss.service
%{_unitdir}/sssd-pac.socket
%{_unitdir}/sssd-pac.service
%{_unitdir}/sssd-pam.socket
%{_unitdir}/sssd-pam-priv.socket
%{_unitdir}/sssd-pam.service
%{_unitdir}/sssd-ssh.socket
%{_unitdir}/sssd-ssh.service
%{_unitdir}/sssd-sudo.socket
%{_unitdir}/sssd-sudo.service

%dir %{_libexecdir}/sssd
%{_libexecdir}/sssd/sssd_be
%{_libexecdir}/sssd/sssd_nss
%{_libexecdir}/sssd/sssd_pam
%{_libexecdir}/sssd/sssd_autofs
%{_libexecdir}/sssd/sssd_ssh
%{_libexecdir}/sssd/sssd_sudo
%{_libexecdir}/sssd/p11_child
%{_libexecdir}/sssd/sssd_check_socket_activated_responders

%dir %{_libdir}/%{name}
%{_libdir}/%{name}/libsss_files.so
%{_libdir}/%{name}/libsss_simple.so

%{_libdir}/%{name}/libsss_child.so
%{_libdir}/%{name}/libsss_crypt.so
%{_libdir}/%{name}/libsss_cert.so
%{_libdir}/%{name}/libsss_debug.so
%{_libdir}/%{name}/libsss_krb5_common.so
%{_libdir}/%{name}/libsss_ldap_common.so
%{_libdir}/%{name}/libsss_util.so
%{_libdir}/%{name}/libsss_semanage.so
%{_libdir}/%{name}/libifp_iface.so
%{_libdir}/%{name}/libifp_iface_sync.so
%{_libdir}/%{name}/libsss_iface.so
%{_libdir}/%{name}/libsss_iface_sync.so
%{_libdir}/%{name}/libsss_sbus.so
%{_libdir}/%{name}/libsss_sbus_sync.so

%{ldb_modulesdir}/memberof.so
%{_bindir}/sss_ssh_authorizedkeys
%{_bindir}/sss_ssh_knownhostsproxy
%{_sbindir}/sss_cache
%{_libexecdir}/sssd/sss_signal

%dir %{_localstatedir}/lib/sss
%dir %{_localstatedir}/cache/krb5rcache
%attr(700,root,root) %dir %{_localstatedir}/lib/sss/db
%attr(755,root,root) %dir %{_localstatedir}/lib/sss/mc
%attr(700,root,root) %dir %{_localstatedir}/lib/sss/secrets
%attr(751,root,root) %dir %{_localstatedir}/lib/sss/deskprofile
%ghost %attr(0644,root,root) %verify(not md5 size mtime) %{_localstatedir}/lib/sss/mc/passwd
%ghost %attr(0644,root,root) %verify(not md5 size mtime) %{_localstatedir}/lib/sss/mc/group
%ghost %attr(0644,root,root) %verify(not md5 size mtime) %{_localstatedir}/lib/sss/mc/initgroups
%attr(755,root,root) %dir %{_localstatedir}/lib/sss/pipes
%attr(700,root,root) %dir %{_localstatedir}/lib/sss/pipes/private
%attr(755,root,root) %dir %{_localstatedir}/lib/sss/pubconf
%attr(755,root,root) %dir %{_localstatedir}/lib/sss/gpo_cache
%attr(750,root,root) %dir %{_var}/log/%{name}
%attr(700,root,root) %dir %{_sysconfdir}/sssd
%attr(711,root,root) %dir %{_sysconfdir}/sssd/conf.d
%attr(711,root,root) %dir %{_sysconfdir}/sssd/pki
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf
%dir %{_sysconfdir}/logrotate.d
%config(noreplace) %{_sysconfdir}/logrotate.d/sssd
%config(noreplace) /etc/ld.so.conf.d/*
%dir %{_sysconfdir}/rwtab.d
%config(noreplace) %{_sysconfdir}/rwtab.d/sssd
%dir %{_datadir}/sssd
%{_sysconfdir}/pam.d/sssd-shadowutils
%dir %{_libdir}/%{name}/conf
%{_libdir}/%{name}/conf/sssd.conf

%{_datadir}/sssd/cfg_rules.ini
%{_datadir}/sssd/sssd.api.conf
%{_datadir}/sssd/sssd.api.d
%dir %{_datadir}/sssd/systemtap
%{_datadir}/sssd/systemtap/id_perf.stp
%{_datadir}/sssd/systemtap/nested_group_perf.stp
%{_datadir}/sssd/systemtap/dp_request.stp
%{_datadir}/sssd/systemtap/ldap_perf.stp
%dir %{_datadir}/systemtap
%dir %{_datadir}/systemtap/tapset
%{_datadir}/systemtap/tapset/sssd.stp
%{_datadir}/systemtap/tapset/sssd_functions.stp

%{_sbindir}/sss_obfuscate
%{_sbindir}/sss_override
%{_sbindir}/sss_debuglevel
%{_sbindir}/sss_seed
%{_sbindir}/sssctl

%attr(755,root,root) %dir %{_localstatedir}/lib/sss/pubconf/krb5.include.d
%{_libexecdir}/sssd/ldap_child
%{_libexecdir}/sssd/krb5_child
%{_libdir}/%{name}/libsss_krb5.so
%{_libdir}/%{name}/libsss_ldap.so

%attr(700,root,root) %dir %{_localstatedir}/lib/sss/keytabs
%{_libdir}/%{name}/libsss_ipa.so
%{_libexecdir}/sssd/selinux_child
%{_libdir}/%{name}/libsss_ad.so
%{_libexecdir}/sssd/gpo_child
%{_libexecdir}/sssd/sssd_pac

%{_libdir}/libnss_sss.so.2
%{_libdir}/security/pam_sss.so
%{_libdir}/krb5/plugins/libkrb5/sssd_krb5_locator_plugin.so
%{_libdir}/krb5/plugins/authdata/sssd_pac_plugin.so
%dir %{_libdir}/cifs-utils
%{_libdir}/cifs-utils/cifs_idmap_sss.so
%dir %{_sysconfdir}/cifs-utils
%ghost %{_sysconfdir}/cifs-utils/idmap-plugin
%dir %{_libdir}/%{name}/modules
%{_libdir}/%{name}/modules/sssd_krb5_localauth_plugin.so

%{_libexecdir}/sssd/sssd_kcm
%config(noreplace) %{_sysconfdir}/krb5.conf.d/kcm_default_ccache
%dir %{_datadir}/sssd-kcm
%{_datadir}/sssd-kcm/kcm_default_ccache
%{_unitdir}/sssd-kcm.socket
%{_unitdir}/sssd-kcm.service

%{_libexecdir}/sssd/sssd_ifp
%{_unitdir}/sssd-ifp.service
%{_sysconfdir}/dbus-1/system.d/org.freedesktop.sssd.infopipe.conf
%{_datadir}/dbus-1/system-services/org.freedesktop.sssd.infopipe.service

%{_libdir}/libsss_sudo.so*
%{_libexecdir}/sssd/proxy_child
%{_libdir}/%{name}/libsss_proxy.so
%{_libdir}/libsss_idmap.so.*
%{_libdir}/libipa_hbac.so.*
%{_libdir}/%{name}/modules/libsss_autofs.so
%{_libdir}/libsss_nss_idmap.so.*
%{_libdir}/libsss_simpleifp.so.*
%{_libdir}/libsss_certmap.so.*
%{_libdir}/libnfsidmap/sss.so
%dir %{_libdir}/samba/idmap
%{_libdir}/samba/idmap/sss.so
%{_libdir}/security/pam_sss_gss.so

%files devel
%{_includedir}/sss_idmap.h
%{_libdir}/libsss_idmap.so
%{_libdir}/pkgconfig/sss_idmap.pc
%{_includedir}/ipa_hbac.h
%{_libdir}/libipa_hbac.so
%{_libdir}/pkgconfig/ipa_hbac.pc
%{_includedir}/sss_nss_idmap.h
%{_libdir}/libsss_nss_idmap.so
%{_libdir}/pkgconfig/sss_nss_idmap.pc
%{_includedir}/sss_sifp.h
%{_includedir}/sss_sifp_dbus.h
%{_libdir}/libsss_simpleifp.so
%{_libdir}/pkgconfig/sss_simpleifp.pc
%{_includedir}/sss_certmap.h
%{_libdir}/libsss_certmap.so
%{_libdir}/pkgconfig/sss_certmap.pc

%files -n python3-sssd -f python3_sssd.lang
%dir %{python3_sitelib}/SSSDConfig
%{python3_sitelib}/SSSDConfig/*.py*
%dir %{python3_sitelib}/SSSDConfig/__pycache__
%{python3_sitelib}/SSSDConfig/__pycache__/*.py*
%{python3_sitelib}/sssd
%{python3_sitearch}/pysss.so
%{python3_sitearch}/pysss_murmur.so
%{python3_sitearch}/pysss_nss_idmap.so
%{python3_sitearch}/pyhbac.so

%files help
%doc %{_pkgdocdir}
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*

%post
%systemd_post sssd.service
%systemd_post sssd-autofs.socket
%systemd_post sssd-nss.socket
%systemd_post sssd-pac.socket
%systemd_post sssd-pam.socket
%systemd_post sssd-pam-priv.socket
%systemd_post sssd-ssh.socket
%systemd_post sssd-sudo.socket
%systemd_post sssd-kcm.socket
%systemd_post sssd-ifp.service
/sbin/ldconfig
/usr/sbin/alternatives --install /etc/cifs-utils/idmap-plugin cifs-idmap-plugin %{_libdir}/cifs-utils/cifs_idmap_sss.so 20

%preun
%systemd_preun sssd.service
%systemd_preun sssd-autofs.socket
%systemd_preun sssd-nss.socket
%systemd_preun sssd-pac.socket
%systemd_preun sssd-pam.socket
%systemd_preun sssd-pam-priv.socket
%systemd_preun sssd-ssh.socket
%systemd_preun sssd-sudo.socket
%systemd_preun sssd-kcm.socket
%systemd_preun sssd-ifp.service
if [ $1 -eq 0 ] ; then
        /usr/sbin/alternatives --remove cifs-idmap-plugin %{_libdir}/cifs-utils/cifs_idmap_sss.so
fi

%postun
%systemd_postun_with_restart sssd-autofs.socket
%systemd_postun_with_restart sssd-nss.socket
%systemd_postun_with_restart sssd-pac.socket
%systemd_postun_with_restart sssd-pam.socket
%systemd_postun_with_restart sssd-pam-priv.socket
%systemd_postun_with_restart sssd-ssh.socket
%systemd_postun_with_restart sssd-sudo.socket
%systemd_postun_with_restart sssd-kcm.socket
%systemd_postun_with_restart sssd-kcm.service
%systemd_postun_with_restart sssd-ifp.service

# Services have RefuseManualStart=true, therefore we can't request restart.
%systemd_postun sssd-autofs.service
%systemd_postun sssd-nss.service
%systemd_postun sssd-pac.service
%systemd_postun sssd-pam.service
%systemd_postun sssd-ssh.service
%systemd_postun sssd-sudo.service

/sbin/ldconfig

%posttrans
%systemd_postun_with_restart sssd.service

%changelog
* Tue Nov 28 2023 wangcheng <wangcheng156@huawei.com> - 2.6.1-12
- backport upstream patches

* Fri Sep 22 2023 fuanan <fuanan3@h-partners.com> - 2.6.1-11
- backport upstream patches

* Wed Aug  2 2023 xuraoqing<xuraoqing@huawei.com> - 2.6.1-10
- backport upstream patch

* Thu Mar 23 2023 yixiangzhike<yixiangzhike007@163.com> - 2.6.1-9
- backport upstream patch

* Sat Dec 24 2022 huangzq6 <huangzhenqiang2@huawei.com> -2.6.1-8
- fix coredump during ifp reconnect

* Wed Dec 21 2022 zhouchenchen<zhouchenchen@huawei.com> - 2.6.1-7
- backport some patch

* Wed Dec 21 2022 zhouchenchen<zhouchenchen@huawei.com> - 2.6.1-6
- backport some patch

* Tue Dec 20 2022 zhouchenchen <zhouchenchen@huawei.com> - 2.6.1-5
- fix CWE-394

* Tue Nov 22 2022 zhouchenchen <zhouchenchen@huawei.com> - 2.6.1-4
- delete duplicate file sssd-example.conf

* Mon Sep 26 2022 zhujianwei001 <zhujianwei7@huawei.com> - 2.6.1-3
- delete broken link

* Tue Sep 20 2022 zhouchenchen <zhouchenchen@huawei.com> - 2.6.1-2
- add version check in Obsoletes to avoid warning messages

* Tue Dec 21 2021 panxiaohe <panxiaohe@huawei.com> - 2.6.1-1
- update version to 2.6.1

* Tue Jul 6 2021 zoulin <zoulin13@huawei.com> - 2.5.1-1
- update version to 2.5.1;
- do not use systemd to restart services with RefuseManualStart=true

* Thu Oct 29 2020 panxiaohe <panxiaohe@huawei.com> - 2.2.3-4
- remove subpackage python2-sssd

* Sat Sep 19 2020 Liquor <lirui130@huawei.com> - 2.2.3-3
- install default sssd.conf file

* Sat Aug 1 2020 Liquor <lirui130@huawei.com> - 2.2.3-2
- Fix build failure against samba 4.12.5 

* Sat Jul 25 2020 yang_zhuang_zhuang <yangzhuangzhuang1@huawei.com> - 2.2.3-1
- update version to 2.2.3

* Tue May 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.2.2-4
- accept krb5 1.18 for building the PAC plugin

* Thu Feb 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.2.2-3
- rebuild for libldb

* Thu Oct 10 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.2.2-2
- add LGPLv3+ and COPYING for main mackage

* Tue Aug 27 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.2.2-1
- Package init
