swt2c pushed to concordance (master). "Merged libconcord package into concordance package"
notifications at fedoraproject.org
notifications at fedoraproject.org
Sun Apr 19 01:36:27 UTC 2015
>From 62af1b0b89af3d7b9bf92a02d84e168cbe8212a8 Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt at techie.net>
Date: Sat, 18 Apr 2015 21:36:00 -0400
Subject: Merged libconcord package into concordance package
diff --git a/concordance-1.1-fix-buffer-overrun.patch b/concordance-1.1-fix-buffer-overrun.patch
new file mode 100644
index 0000000..7b487e9
--- /dev/null
+++ b/concordance-1.1-fix-buffer-overrun.patch
@@ -0,0 +1,113 @@
+From 8d02c60a3ecfffffd7075129ce0bcbaca5558e96 Mon Sep 17 00:00:00 2001
+From: Scott Talbert <swt at techie.net>
+Date: Sat, 22 Nov 2014 12:11:39 -0500
+Subject: [PATCH] Fix buffer overrun crash in website communications
+
+Add a new format_string() function that automatically calculates buffer sizes
+and use it where appropriate instead of sprintf().
+
+Signed-off-by: Scott Talbert <swt at techie.net>
+Signed-off-by: Phil Dibowitz <phil at ipom.com>
+---
+ libconcord/web.cpp | 56 ++++++++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 40 insertions(+), 16 deletions(-)
+
+diff --git a/libconcord/web.cpp b/libconcord/web.cpp
+index 0a67a71..7910563 100644
+--- a/libconcord/web.cpp
++++ b/libconcord/web.cpp
+@@ -19,6 +19,7 @@
+ * (C) Copyright Phil Dibowitz 2008
+ */
+
++#include <stdarg.h>
+ #include <string.h>
+ #include "libconcord.h"
+ #include "lc_internal.h"
+@@ -62,6 +63,28 @@ static const uint8_t urlencodemap[32]={
+ 0xFF, 0xFF, 0xFF, 0xFF
+ };
+
++/*
++ * This function does C-style string formatting, but uses a C++ string and
++ * automatically handles buffer sizing. It is intended to be used in place of
++ * sprintf()/snprintf() where we don't necessarily know the required buffer
++ * size in advance. The formatted string is appended to the supplied C++
++ * string.
++ */
++void format_string(string *str, const char *format, ...)
++{
++ va_list args;
++ va_start(args, format);
++ int size = vsnprintf(NULL, 0, format, args);
++ va_end(args);
++ size++; // Add room for \0
++ char *buffer = new char[size];
++ va_start(args, format);
++ vsnprintf(buffer, size, format, args);
++ va_end(args);
++ *str += buffer;
++ delete[] buffer;
++}
++
+ static void UrlEncode(const char *in, string &out)
+ {
+ out = "";
+@@ -351,25 +374,26 @@ int Post(uint8_t *xml, uint32_t xml_size, const char *root, TRemoteInfo &ri,
+
+ string post;
+ if (learn_seq == NULL) {
+- char serial[144];
+- sprintf(serial, "%s%s%s", ri.serial1, ri.serial2, ri.serial3);
+- char post_data[4000]; // large enough for extra usbnet headers
++ string serial;
++ format_string(&serial, "%s%s%s", ri.serial1, ri.serial2, ri.serial3);
++ string post_data;
+ if (z_post) {
+- sprintf(post_data, z_post_xml, ri.hw_ver_major, ri.hw_ver_minor,
+- ri.flash_mfg, ri.flash_id, ri.fw_ver_major,
++ format_string(&post_data, z_post_xml, ri.hw_ver_major,
++ ri.hw_ver_minor, ri.flash_mfg, ri.flash_id, ri.fw_ver_major,
+ ri.fw_ver_minor);
+ } else {
+- sprintf(post_data, post_xml, ri.fw_ver_major, ri.fw_ver_minor,
+- ri.fw_type, serial, ri.hw_ver_major, ri.hw_ver_minor,
+- ri.hw_ver_micro, ri.flash_mfg, ri.flash_id, ri.protocol,
+- ri.architecture, ri.skin);
+- sprintf(post_data+strlen(post_data), "%s", post_xml_trailer);
++ format_string(&post_data, post_xml, ri.fw_ver_major,
++ ri.fw_ver_minor, ri.fw_type, serial.c_str(),
++ ri.hw_ver_major, ri.hw_ver_minor, ri.hw_ver_micro,
++ ri.flash_mfg, ri.flash_id, ri.protocol, ri.architecture,
++ ri.skin);
++ format_string(&post_data, "%s", post_xml_trailer);
+ }
+
+- debug("post data: %s",post_data);
++ debug("post data: %s", post_data.c_str());
+
+ string post_data_encoded;
+- UrlEncode(post_data, post_data_encoded);
++ UrlEncode(post_data.c_str(), post_data_encoded);
+
+ post = "Data=" + post_data_encoded;
+ } else {
+@@ -382,11 +406,11 @@ int Post(uint8_t *xml, uint32_t xml_size, const char *root, TRemoteInfo &ri,
+
+ debug("%s", post.c_str());
+
+- char http_header[1000];
+- sprintf(http_header, post_header, path.c_str(), server.c_str(),
++ string http_header;
++ format_string(&http_header, post_header, path.c_str(), server.c_str(),
+ cookie.c_str(), post.length());
+
+- debug("%s", http_header);
++ debug("%s", http_header.c_str());
+
+- return Zap(server, http_header,post.c_str());
++ return Zap(server, http_header.c_str(), post.c_str());
+ }
+--
+2.1.0
+
diff --git a/concordance.spec b/concordance.spec
index 903ec7d..50db2bc 100644
--- a/concordance.spec
+++ b/concordance.spec
@@ -1,35 +1,150 @@
+%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
+%define libpkg libconcord
+
Name: concordance
Version: 1.1
-Release: 3%{?dist}
+Release: 7%{?dist}
Summary: Software to program the Logitech Harmony remote control
Group: Applications/Communications
License: GPLv3+
URL: http://www.phildev.net/concordance/
Source0: http://downloads.sourceforge.net/sourceforge/concordance/%{name}-%{version}.tar.bz2
-
-BuildRequires: libconcord-devel >= %{version}
+# Fixes crash during website communications due to buffer overrun
+# http://sourceforge.net/p/concordance/bugs/40/
+Patch0: concordance-1.1-fix-buffer-overrun.patch
+
+BuildRequires: hidapi-devel
+BuildRequires: swig
+BuildRequires: perl(ExtUtils::MakeMaker)
+BuildRequires: python-devel
+BuildRequires: python-setuptools
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: libzip-devel
%description
This software will allow you to program your Logitech Harmony universal
remote control.
+%package -n %{libpkg}
+Summary: Library to talk to Logitech Harmony universal remote controls
+Group: Development/Libraries
+Requires: udev
+# For usbnet-based remotes: 900, 1000, 1100
+Requires: dnsmasq
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description -n %{libpkg}
+Library to talk to Logitech Harmony universal remote controls
+
+
+%package -n %{libpkg}-devel
+Summary: Development libraries for libconcord
+Group: Development/Libraries
+Requires: %{libpkg} = %{version}-%{release}
+
+%description -n %{libpkg}-devel
+Development libraries for libconcord
+
+
+%package -n %{libpkg}-perl
+Summary: Perl bindings for libconcord
+Group: Development/Libraries
+Requires: %{libpkg} = %{version}-%{release}
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+
+%description -n %{libpkg}-perl
+Perl bindings for libconcord
+
+
+%package -n %{libpkg}-python
+Summary: Python bindings for libconcord
+Group: Development/Libraries
+Requires: %{libpkg} = %{version}-%{release}
+
+%description -n %{libpkg}-python
+Python bindings for libconcord
+
+
%prep
%setup -q
+%patch0 -p1 -b .fix-buffer-overrun
%build
+cd %{libpkg}
+
+%configure --disable-static --disable-mime-update
+make %{_smp_mflags}
+cd -
+
+# perl bindings
+cd %{libpkg}/bindings/perl
+swig -perl5 concord.i
+%{__perl} Makefile.PL INSTALLDIRS=vendor INC=-I../../
+#sed -i -e 's|LDFLAGS =|LDFLAGS = -L../../|' Makefile
+make %{_smp_mflags}
+cd -
+
+# python bindings
+cd %{libpkg}/bindings/python
+CFLAGS="%{optflags}" %{__python} setup.py build
+cd -
+
cd %{name}
+export CFLAGS="%{optflags} -I../libconcord"
+export LDFLAGS="-L../libconcord/.libs"
%configure --enable-shared
make %{_smp_mflags}
%install
+cd %{libpkg}
+make DESTDIR=%{buildroot} install
+make DESTDIR=%{buildroot} install_udev
+
+find %{buildroot} -type f -name \*.a -exec %{__rm} -f {} \;
+find %{buildroot} -type f -name \*.la -exec %{__rm} -f {} \;
+cd -
+
+# perl bindings
+cd %{libpkg}/bindings/perl
+make pure_install PERL_INSTALL_ROOT=%{buildroot}
+find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
+find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
+find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null ';'
+%{__chmod} 755 %{buildroot}%{perl_vendorarch}/auto/concord/concord.so
+cd -
+
+# python bindings
+cd %{libpkg}/bindings/python
+%{__python} setup.py install -O1 --skip-build --root %{buildroot} --install-purelib %{python_sitearch}
+cd -
+
cd %{name}
make DESTDIR=%{buildroot} install
+%post -n %{libpkg}
+/sbin/ldconfig
+/sbin/udevadm control --reload-rules
+touch --no-create %{_datadir}/mime/packages &> /dev/null || :
+
+%postun -n %{libpkg}
+/sbin/ldconfig
+/sbin/udevadm control --reload-rules
+if [ $1 -eq 0 ] ; then
+touch --no-create %{_datadir}/mime/packages &> /dev/null || :
+update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
+fi
+
+%posttrans -n %{libpkg}
+update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
+
%files
%defattr(0644, root, root, 0755)
%doc Changelog CodingStyle LICENSE SubmittingPatches TODO
@@ -37,8 +152,37 @@ make DESTDIR=%{buildroot} install
%attr(0755, root, root) %{_bindir}/*
%{_mandir}/man1/*
+%files -n %{libpkg}
+%defattr(-, root, root, -)
+%doc Changelog CodingStyle LICENSE SubmittingPatches
+%doc %{libpkg}/README %{libpkg}/INSTALL.linux
+/lib/udev/rules.d/*.rules
+/lib/udev/*.sh
+%{_datadir}/mime/packages/%{libpkg}.xml
+%{_libdir}/*.so.*
+
+%files -n %{libpkg}-devel
+%defattr(-, root, root)
+%doc TODO
+%{_includedir}/*.h
+%{_libdir}/*.so
+
+%files -n %{libpkg}-perl
+%defattr(-, root, root)
+%doc %{libpkg}/bindings/perl/README
+%{perl_vendorarch}/auto/*
+%{perl_vendorarch}/concord.pm
+
+%files -n %{libpkg}-python
+%doc %{libpkg}/bindings/python/README
+%defattr(-, root, root)
+%{python_sitearch}/*
+
%changelog
+* Sat Apr 04 2015 Scott Talbert <swt at techie.net> - 1.1-7
+- Merged libconcord package into concordance package
+
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/concordance.git/commit/?h=master&id=62af1b0b89af3d7b9bf92a02d84e168cbe8212a8
More information about the scm-commits
mailing list