From 7174834b1480e333abb9d5fe00158d558d958488 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 22 2019 23:15:44 +0000 Subject: import python-smbc-1.0.13-8.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebb94e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/pysmbc-1.0.13.tar.bz2 diff --git a/.python-smbc.metadata b/.python-smbc.metadata new file mode 100644 index 0000000..17fec6b --- /dev/null +++ b/.python-smbc.metadata @@ -0,0 +1 @@ +bf37346af4a6b543f7f91c46d0d1d0cc6020db32 SOURCES/pysmbc-1.0.13.tar.bz2 diff --git a/SOURCES/fix-memory-leak-in-auth_fn-callback.patch b/SOURCES/fix-memory-leak-in-auth_fn-callback.patch new file mode 100644 index 0000000..3400250 --- /dev/null +++ b/SOURCES/fix-memory-leak-in-auth_fn-callback.patch @@ -0,0 +1,20 @@ +diff --git a/context.c b/context.c +index b41c440..fc2befa 100644 +--- a/context.c ++++ b/context.c +@@ -78,6 +78,7 @@ auth_fn (SMBCCTX *ctx, + &use_username, + &use_password)) + { ++ Py_DECREF (result); + debugprintf ("<- auth_fn(), incorrect callback result\n"); + return; + } +@@ -85,6 +86,7 @@ auth_fn (SMBCCTX *ctx, + strncpy (workgroup, use_workgroup, wgmaxlen); + strncpy (username, use_username, unmaxlen); + strncpy (password, use_password, pwmaxlen); ++ Py_DECREF (result); + debugprintf ("<- auth_fn(), got callback result\n"); + } + diff --git a/SOURCES/make-sure-auto-info-is-NULL-terminated.patch b/SOURCES/make-sure-auto-info-is-NULL-terminated.patch new file mode 100644 index 0000000..03863ef --- /dev/null +++ b/SOURCES/make-sure-auto-info-is-NULL-terminated.patch @@ -0,0 +1,20 @@ +diff --git a/context.c b/context.c +index 8b3754b..9128a82 100644 +--- a/context.c ++++ b/context.c +@@ -83,9 +83,12 @@ auth_fn (SMBCCTX *ctx, + return; + } + +- strncpy (workgroup, use_workgroup, wgmaxlen); +- strncpy (username, use_username, unmaxlen); +- strncpy (password, use_password, pwmaxlen); ++ strncpy (workgroup, use_workgroup, wgmaxlen - 1); ++ workgroup[wgmaxlen - 1] = '\0'; ++ strncpy (username, use_username, unmaxlen - 1); ++ username[unmaxlen - 1] = '\0'; ++ strncpy (password, use_password, pwmaxlen - 1); ++ password[pwmaxlen - 1] = '\0'; + Py_DECREF (result); + debugprintf ("<- auth_fn(), got callback result\n"); + } diff --git a/SOURCES/python-smbc-pkg-config.patch b/SOURCES/python-smbc-pkg-config.patch new file mode 100644 index 0000000..9586b86 --- /dev/null +++ b/SOURCES/python-smbc-pkg-config.patch @@ -0,0 +1,58 @@ +diff -up pysmbc-1.0.13/Makefile.pkg-config pysmbc-1.0.13/Makefile +--- pysmbc-1.0.13/Makefile.pkg-config 2010-08-22 15:59:36.000000000 +0100 ++++ pysmbc-1.0.13/Makefile 2012-11-21 12:44:29.051173967 +0000 +@@ -4,7 +4,7 @@ SDIST_ARGS=--formats=bztar -d. + + smbc.so: force + python setup.py build +- mv build/lib*/$@ . ++ mv build/lib*/smbc*.so . + + doc: smbc.so + rm -rf html +@@ -14,7 +14,7 @@ doczip: doc + cd html && zip ../smbc-html.zip * + + clean: +- -rm -rf build smbc.so *.pyc tests/*.pyc *~ tests/*~ ++ -rm -rf build smbc*.so *.pyc tests/*.pyc *~ tests/*~ + + dist: + python setup.py sdist $(SDIST_ARGS) +diff -up pysmbc-1.0.13/setup.py.pkg-config pysmbc-1.0.13/setup.py +--- pysmbc-1.0.13/setup.py.pkg-config 2012-02-15 16:12:44.000000000 +0000 ++++ pysmbc-1.0.13/setup.py 2012-11-21 12:45:05.362285519 +0000 +@@ -1,6 +1,6 @@ + #!/usr/bin/env python + +-## Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2011 Red Hat, Inc ++## Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Red Hat, Inc + ## Copyright (C) 2010 Open Source Solution Technology Corporation + ## Authors: + ## Tim Waugh +@@ -51,6 +51,18 @@ hello + """ + + from distutils.core import setup, Extension ++import subprocess ++ ++def pkgconfig_I (pkg): ++ dirs = [] ++ c = subprocess.Popen (["pkg-config", "--cflags", pkg], ++ stdout=subprocess.PIPE) ++ (stdout, stderr) = c.communicate () ++ for p in stdout.decode (encoding='ascii').split (): ++ if p.startswith ("-I"): ++ dirs.append (p[2:]) ++ return dirs ++ + setup (name="pysmbc", + version="1.0.13", + description="Python bindings for libsmbclient", +@@ -74,4 +86,5 @@ setup (name="pysmbc", + "dir.c", + "file.c", + "smbcdirent.c"], +- libraries=["smbclient"])]) ++ libraries=["smbclient"], ++ include_dirs=pkgconfig_I("smbclient"))]) diff --git a/SPECS/python-smbc.spec b/SPECS/python-smbc.spec new file mode 100644 index 0000000..8bb842a --- /dev/null +++ b/SPECS/python-smbc.spec @@ -0,0 +1,160 @@ +%if 0%{?fedora} > 12 +%global with_python3 1 +%endif + +%{?filter_setup: +%filter_provides_in %{python_sitearch}/.*\.so$ +%filter_setup +} + +Summary: Python bindings for libsmbclient API from Samba +Name: python-smbc +Version: 1.0.13 +Release: 8%{?dist} +URL: https://github.com/hamano/pysmbc +Source: http://pypi.python.org/packages/source/p/pysmbc/pysmbc-%{version}.tar.bz2 +Patch1: python-smbc-pkg-config.patch + +# Fix memory leak in the auth_fn callback. +# Fixed upstream: https://github.com/hamano/pysmbc/commit/8fa966e780d62f9bbc603c15a42432a7fe1cc568 +Patch2: fix-memory-leak-in-auth_fn-callback.patch + +# Make sure auth info is NUL-terminated. +# Fixed upstream: https://github.com/hamano/pysmbc/commit/94a8572b78f9734e0f37e5ffc8a61926101a3d77 +# Resolves: rhbz#1248519 +Patch3: make-sure-auto-info-is-NULL-terminated.patch + +License: GPLv2+ +Group: Development/Languages +BuildRequires: python2-devel +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif +BuildRequires: libsmbclient-devel >= 3.2 +BuildRequires: epydoc + +%description +This package provides Python bindings for the libsmbclient API +from Samba, known as pysmbc. It was written for use with +system-config-printer, but can be put to other uses as well. + +%if 0%{?with_python3} +%package -n python3-smbc +Summary: Python3 bindings for libsmbclient API from Samba +Group: Development/Languages + +%description -n python3-smbc +This package provides Python bindings for the libsmbclient API +from Samba, known as pysmbc. It was written for use with +system-config-printer, but can be put to other uses as well. + +This is a ported release for python 3 +%endif + +%package doc +Summary: Documentation for python-smbc +Group: Documentation + +%description doc +Documentation for python-smbc. + +%prep +%setup -q -n pysmbc-%{version} +%patch1 -p1 -b .pkg-config +%patch2 -p1 +%patch3 -p1 + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif + + +%build +CFLAGS="%{optflags}" %{__python} setup.py build +rm -rf html +epydoc -o html --html build/lib*/smbc.so + +%if 0%{?with_python3} +pushd %{py3dir} +CFLAGS="%{optflags}" %{__python3} setup.py build +popd +%endif + + +%install +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install -O1 --skip-build --root %{buildroot} +chmod 755 %{buildroot}%{python3_sitearch}/smbc*.so +popd +%endif + +%{__python} setup.py install -O1 --skip-build --root %{buildroot} +chmod 755 %{buildroot}%{python_sitearch}/smbc.so + + +%files +%defattr(-,root,root,-) +%doc COPYING README NEWS +%{python_sitearch}/smbc.so +%{python_sitearch}/pysmbc*.egg-info + +%files doc +%defattr(-,root,root,-) +%doc html + +%if 0%{?with_python3} +%files -n python3-smbc +%defattr(-,root,root,-) +%doc COPYING README NEWS +%{python3_sitearch}/smbc.cpython-3*.so +%{python3_sitearch}/pysmbc*.egg-info +%endif + + +%changelog +* Wed Oct 11 2017 Charalampos Stratakis - 1.0.13-8 +- Fix memory leak in the auth_fn callback. +- Make sure auth info is NUL-terminated. +Resolves: rhbz#1248519 + +* Thu Feb 14 2013 Fedora Release Engineering - 1.0.13-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Nov 21 2012 Tim Waugh - 1.0.13-6 +- Use pkg-config for smbclient include_dirs, fixing rebuild failure. + +* Sat Aug 04 2012 David Malcolm - 1.0.13-5 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + +* Fri Aug 3 2012 David Malcolm - 1.0.13-4 +- add with_python3 conditionals + +* Thu Jul 26 2012 David Malcolm - 1.0.13-3 +- generalize file globbing to ease transition to Python 3.3 + +* Sat Jul 21 2012 Fedora Release Engineering - 1.0.13-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Feb 15 2012 Tim Waugh - 1.0.13-1 +- 1.0.13. + +* Sat Jan 14 2012 Fedora Release Engineering - 1.0.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri May 20 2011 Tim Waugh - 1.0.11-1 +- 1.0.11. + +* Wed Feb 09 2011 Fedora Release Engineering - 1.0.10-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Dec 29 2010 David Malcolm - 1.0.10-3 +- rework python3 DSO name for PEP 3149, and rebuild for newer python3 + +* Wed Nov 17 2010 Jiri Popelka - 1.0.10-2 +- Fixed rpmlint errors/warnings (#648987) +- doc subpackage + +* Mon Nov 01 2010 Jiri Popelka - 1.0.10-1 +- Initial RPM spec file