# The naming scheme in non-Mandriva-based distros %if 0%{?mklibname:1} %define libname %{mklibname smb2 _%{major}} %define devname %{mklibname smb2 -d} %define rpc_libname %{mklibname dcerpc %{dcerpc_major}} %define rpc_devname %{mklibname dcerpc -d} %else %define devname %{name}-devel %define rpc_libname libdcerpc %define rpc_devname libdcerpc-devel %endif %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif %global major 7 %global dcerpc_major 1 %global dcerpc_version 1.0.0 %bcond cmake %["%{_vendor}" != "openEuler" && 0%{!?suse_version:1}] %bcond dcerpc %[%{?with_cmake}] Name: libsmb2 Summary: SMB2/3 client library Version: 7.0.0 Release: %mkrel 1 URL: http://www.github.com/sahlberg/libsmb2 Source: https://github.com/sahlberg/libsmb2/archive/refs/tags/%lib{oname}-%{version}.tar.gz#/%{name}-%{name}-%{version}.tar.gz #Patch0: libsmb2-update-cmake.diff %if "%{_vendor}" != "redhat" && 0%{!?fedora:1} BuildRequires: ccache %endif BuildRequires: gcc BuildRequires: pkgconfig(pkg-config) BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(krb5-gssapi) %if 0%{?mklibname:1} Requires: %{libname} = %{version}-%{release} %endif %if %{with cmake} License: LGPL-2.1-or-later Group: System/Libraries BuildRequires: cmake %else Epoch: 0 License: GNU LGPL version 2.1 Group: System Environment/Libraries Provides: lib = %{version} BuildRequires: automake BuildRequires: autoconf >= 2.71 BuildRequires: make BuildRequires: libtool Vendor: Ronnie Sahlberg Packager: ronniesahlberg@gmail.com Prefix: /usr BuildRoot: %{_tmppath}/%{name}-%{version}-root %endif %if %{with dcerpc} BuildRequires: (python3 or python >= 3) %endif %description Libsmb2 is a SMB2/3 client library ####################################################################### %prep %if %{with cmake} %autosetup -p1 -n %{name}-%{name}-%{version} %else %setup -q -n %{name}-%{name}-%{version} # setup the init script and sysconfig file %setup -T -D -n %{name}-%{name}-%{version} -q %endif %build %if %{with cmake} %cmake %cmake_build %else ## always run autogen.sh aclocal autoheader autoconf libtoolize -c -f -i automake --add-missing ## check for ccache if ccache -h >/dev/null 2>&1 ; then CC="ccache gcc" else CC="gcc" fi export CC CFLAGS="$RPM_OPT_FLAGS $EXTRA -O2 -Wno-discarded-qualifiers -D_GNU_SOURCE" %configure --disable-libdcerpc make %{?_smp_mflags} %endif %install %if %{with cmake} %cmake_install %else # Clean up in case there is trash left from a previous build rm -rf $RPM_BUILD_ROOT # Create the target build directory hierarchy make DESTDIR=$RPM_BUILD_ROOT install # Remove "*.old" files find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; # Do not ship libtool archives find $RPM_BUILD_ROOT -name "*.la" -exec rm -f {} \; %endif %if ! %{with cmake} %clean rm -rf $RPM_BUILD_ROOT %endif ####################################################################### ## Files section ## ####################################################################### %files %defattr(-,root,root) %{_bindir}/smb2-cp %{_bindir}/smb2-ls %if 0%{?mklibname:1} %package -n %{libname} Summary: SMB2/3 client library Group: System/Libraries %description -n %{libname} Libsmb2 is a SMB2/3 client library %files -n %{libname} %endif %license COPYING LICENCE-LGPL-2.1.txt %{_libdir}/libsmb2.so %{_libdir}/libsmb2.so.%{major}* %package -n %{devname} Summary: Development libraries for LibSMB2 %if %{with cmake} Group: Development/Libraries %else Group: Development %endif Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} %description -n %{devname} development libraries for LibSMB2 %files -n %{devname} %defattr(-,root,root) %doc README %license COPYING LICENCE-LGPL-2.1.txt %{_includedir}/smb2/*.h %if ! %{with cmake} %{_libdir}/libsmb2.a %else %{_libdir}/cmake/%{name}/*.cmake %endif %{_libdir}/pkgconfig/libsmb2.pc %if %{with dcerpc} %package -n libdcerpc Summary: RPC support for %{name} Version: %{dcerpc_version} %if 0%{?mklibname:1} Requires: %{rpc_libname} = %{dcerpc_version} %endif %description -n libdcerpc %{summary}. %files -n libdcerpc %{_bindir}/dcerpc %{_bindir}/epm-enum %{_bindir}/winreg-tui %if 0%{?mklibname:1} %package -n %{rpc_libname} Summary: RPC library for %{name} Version: %{dcerpc_version} Release: %mkrel 1 %description -n %{rpc_libname} %{summary}. %files -n %{rpc_libname} %endif %{_libdir}/libdcerpc.so %{_libdir}/libdcerpc.so.%{dcerpc_major} %{_libdir}/libdcerpc.so.%{dcerpc_version} %{_mandir}/man1/dcerpc.1* %package -n %{rpc_devname} Summary: Development files for %{rpc_libname} Version: %{dcerpc_version} Release: %mkrel 1 Requires: %{rpc_libname} = %{dcerpc_version} %description -n %{rpc_devname} %{summary}. %files -n %{rpc_devname} %{_includedir}/dcerpc/*.h %{_libdir}/pkgconfig/libdcerpc.pc %endif %changelog * Thu Oct 22 2026 : Version 6.3.0 - Security fixes for malformed or hostile server replies: bounds checks on lengths and offsets in the PDU, NTLMSSP and SPNEGO decoders, the FILE_ALL_INFORMATION name, header-only replies, QUERY_INFO replies without data and the DCE/RPC array and string counts used by share enumeration. * Mon Dec 16 2024 : Version 6.1.0 - Fix return code for smb2-ls on failure - Fix memory errors in smb2_opendir() - Add a macro te test for the version of the share-enum api * Wed Dec 11 2024 : Version 6.0.0 - Major rewrites to DCE-RPC - Initial support for building servers * Mon Jan 17 2022 : Version 4.0.0 - Add support for SMB3 encryption - Add support for Anonymous NTLMSSP logins - Add support for readlink. - Add API to notify application of changes to which filehandles are used by libsmb2. - Add support for Big Endian DCERPC and allow it to be controlled from the URL. - Add support for 3.1.1 signing - Add support for PS2(EE) and PS3 - Fixes to UCS2 when compose characters are used. - Various MacOS fixes - Fix a few NULL dereferences * Mon Jun 10 2019 : Version 3.0.0 - ESP32 support - Support specifying the port number in an SMB URL. - Add creation time to smb_stat - Abort all commands when the context is destroyed. - Free all file and directory handles when the context is destroyed. - Fix handling of O_TRUNC - Add more error codes. - Add support for SMB2_IOCTL - Handle DCE/RPC fragment reassembly for IOCTL(). * Sat Jul 7 2018 : Version 2.0.0 - SMB2/3 signing - Kerberos authentication - Builtin NTLMSSP authentication for when libkrb5 is not available - Share enumeration - CMake support - Various bugfixes * Sun Mar 5 2017 : Version 1.0.0 - Initial version