Name:           sleuthkit
Version:        4.12.1
Release:        2
Summary:        Tools for file system and volume forensic analysis
License:        CPL-1.0 and IPL-1.0 and GPL-2.0-or-later
URL:            http://www.sleuthkit.org
Source0:        https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-%{version}/sleuthkit-%{version}.tar.gz

Patch0001:      0006-Add-attributes-file-nodesize-check.patch
Patch0002:      0008-left-shift.patch

BuildRequires:  gcc-c++ afflib-devel >= 3.3.4 libewf-devel perl-generators sqlite-devel libtool autoconf

%{?_with_java:
BuildRequires:  java-devel >= 1:1.6.0 jpackage-utils
Requires:       java >= 1:1.6.0 jpackage-utils
}

Requires:       file

Provides:  %{name}-libs = %{version}-%{release}
Obsoletes: %{name}-libs < %{version}-%{release}

%description
The Sleuth Kit (previously known as TASK) is a collection of UNIX-based command
line file system forensic tools that allow an investigator to examine NTFS,
FAT, FFS, EXT2FS, EXT3FS and ExFAT file systems of a suspect computer in a
non-intrusive fashion. The  tools have a layer-based design and can extract
data from internal file system structures. Because the tools do not rely on the
operating system to process the file systems, deleted and hidden content is
shown.

%package        devel
Summary:    Provides development files for %{name}
Requires:   %{name} = %{version}-%{release}
Requires:   sqlite-devel

%description    devel
This package provides the development files for %{name}.

%package        help
Summary:Help Document for %{name}

%description    help
The help package contains manual pages and other related files for %{name}.

%prep
%autosetup -n %{name}-%{version} -p1
autoreconf -vif

%build
%configure --disable-static  %{!?_with_java:--disable-java}

sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%make_build

%install
%make_install
%delete_la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%doc ChangeLog.txt NEWS.txt licenses/*
%{_bindir}/{blkcalc,blkcat,blkls,blkstat}
%exclude %{_bindir}/fcat
%{_bindir}/{ffind,fiwalk,fls,fsstat,hfind,icat}
%{_bindir}/{ifind,ils,img_cat,img_stat,istat,jcat,sorter}
%{_bindir}/{jpeg_extract,jls,mactime,mmcat,mmls,mmstat,pstat,sigfind}
%{_bindir}/{srch_strings,tsk_comparedir,tsk_gettimes,tsk_imageinfo,tsk_loaddb,tsk_recover,usnjls}
%exclude %{_mandir}/man1/fcat.1*
%dir %{_datadir}/tsk
%{_datadir}/tsk/sorter/
%{_libdir}/*.so.*

%files devel
%{_includedir}/tsk/
%{_libdir}/*.so
%{_libdir}/pkgconfig/tsk.pc

%files help
%{_mandir}/man1/*

%changelog
* Fri Jul 19 2024 yaoxin <yao_xin001@hoperun.com> - 4.12.1-2
- License compliance rectification

* Mon Oct 16 2023 wulei <wu_lei@hoperun.com> - 4.12.1-1
- Update to 4.12.1

* Thu Mar 10 2022 xuping <xuping33@huawei.com> - 4.6.7-11
- Fixed OOB read in hfs_dir_open_meta_cb

* Thu Aug 26 2021 lingsheng <lingsheng@huawei.com> - 4.6.7-10
- Fixed OOB reads in hfs_cat_traverse

* Thu Aug 26 2021 sunguoshuai <sunguoshuai@huawei.com> - 4.6.7-9
- Fix memleak in ntfs

* Thu Jun 3 2021 caodongxia <caodongxia@huawei.com> - 4.6.7-8
- Fixed left shift

* Wed May 19 2021 lingsheng <lingsheng@huawei.com> - 4.6.7-7
- Fixed OOB reads in hfs_cat_traverse

* Thu Jan 28 2021 maminjie <maminjie1@huawei.com> - 4.6.7-6
- remove the requires mac-robber that is deprecated

* Fri Dec 18 2020 lingsheng <lingsheng@huawei.com> - 4.6.7-5
- Add attributes file nodesize check to fix heap overflow

* Tue Dec 15 2020 Jiachen Fan <fanjiachen3@huawei.com> - 4.6.7-4
- fix oss-fuzz heap over flow

* Wed Dec 9 2020 Jiachen Fan <fanjiachen3@huawei.com> - 4.6.7-3
- fix oss-fuzz memory leak

* Fri Feb 21 2020 wangzhishun <wangzhishun1@huawei.com> - 4.6.7-2
- Package init

