rpms/comix/F-8 comix-3.6.4-command-argument-closure.patch, NONE, 1.1 comix.spec, 1.9, 1.10
Mamoru Tasaka (mtasaka)
fedora-extras-commits at redhat.com
Wed Apr 2 12:26:48 UTC 2008
Author: mtasaka
Update of /cvs/extras/rpms/comix/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10412/F-8
Modified Files:
comix.spec
Added Files:
comix-3.6.4-command-argument-closure.patch
Log Message:
* Wed Apr 2 2008 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 3.6.4-4
- First patch for bug 430635
Replace os.popen() with subprocess.Popen() to handle hostile filename
properly (CVE-2008-1568)
comix-3.6.4-command-argument-closure.patch:
--- NEW FILE comix-3.6.4-command-argument-closure.patch ---
--- comix-3.6.4/comix.debug 2007-05-27 01:30:16.000000000 +0900
+++ comix-3.6.4/comix 2008-04-02 20:11:53.000000000 +0900
@@ -44,6 +44,9 @@
import pwd
import cPickle
+import subprocess
+import string
+
try:
import pygtk
pygtk.require('2.0')
@@ -6277,9 +6280,12 @@
archive = tarfile.open(path, 'r')
files = archive.getnames()
elif type == 'rar':
+ #files = \
+ #os.popen(self.rar + ' vb "' + path +
+ #'"').readlines()
files = \
- os.popen(self.rar + ' vb "' + path +
- '"').readlines()
+ subprocess.Popen([self.rar, 'vb', path],
+ stdout=subprocess.PIPE).communicate()[0].splitlines()
files = [file.rstrip('\n') for file in files]
cover = None
files.sort()
@@ -6302,9 +6308,20 @@
break
if cover != None:
if type == 'rar':
- os.popen(self.rar + ' p -inul -- "' + path + '" "' +
- cover + '" > "' + thumb_dir +
- '/temp" 2>/dev/null', "r").close()
+ #os.popen(self.rar + ' p -inul -- "' + path + '" "' +
+ #cover + '" > "' + thumb_dir +
+ #'/temp" 2>/dev/null', "r").close()
+ filen = thumb_dir + '/temp'
+ try:
+ os.remove(filen)
+ except:
+ pass
+ fp = open(filen, 'w')
+ fdp = fp.fileno()
+ p = subprocess.Popen(
+ [self.rar, 'p', '-inul', '--', path,
+ cover ], stdout = fdp).wait()
+ fp.close()
image = Image.open(thumb_dir + '/temp')
os.remove(thumb_dir + '/temp')
elif type == 'zip':
@@ -8733,8 +8750,10 @@
# =======================================================
elif archive_type == 'rar':
if self.rar:
- os.popen(
- self.rar + ' x "' + src_path + '" "' + dst_path + '"')
+ #os.popen(
+ #self.rar + ' x "' + src_path + '" "' + dst_path + '"')
+ subprocess.Popen(
+ [self.rar, 'x', src_path, dst_path],stdout=sys.stdout).wait()
else:
self.statusbar.push(0,
_('Could not find the unrar executable. Please install it if you wish to open RAR archives.'))
@@ -9168,9 +9187,37 @@
self.are_you_sure_dialog.hide()
if response != -5:
return
- os.popen(self.jpegtran + ' -copy all -trim ' + operation +
- ' -outfile "' + self.file[self.file_number] + '" "' +
- self.file[self.file_number] + '"')
+ #os.popen(self.jpegtran + ' -copy all -trim ' + operation +
+ #' -outfile "' + self.file[self.file_number] + '" "' +
+ #self.file[self.file_number] + '"')
+ op = operation.split()
+ op_len = len(op)
+
+ i=1
+ filen = self.file[self.file_number]
+ while (1):
+ tmp_file = filen + '.tmp' + 'z' * i
+ if os.path.exists(tmp_file):
+ i += 1
+ else:
+ break
+
+ # Ugly hack :(
+ if op_len == 2:
+ p = subprocess.Popen(
+ [self.jpegtran, '-copy', 'all', '-trim', op[0], op[1],
+ '-outfile', tmp_file, filen],
+ stdin=sys.stdin, stdout=sys.stdout)
+ else:
+ p = subprocess.Popen(
+ [self.jpegtran, '-copy', 'all', '-trim', op[0],
+ '-outfile', tmp_file, filen],
+ stdin=sys.stdin, stdout=sys.stdout)
+ p.wait()
+ if p.returncode == 0:
+ shutil.copymode(filen, tmp_file)
+ shutil.copy(tmp_file, filen)
+ os.remove(tmp_file)
try:
uri = 'file://' + urllib.pathname2url(self.file[self.file_number])
thumb_path = md5.new()
--- comix-3.6.4/mime/comicthumb.debug 2007-05-27 01:30:16.000000000 +0900
+++ comix-3.6.4/mime/comicthumb 2008-04-02 21:11:10.000000000 +0900
@@ -22,6 +22,9 @@
import StringIO
import re
import shutil
+
+import subprocess
+
try:
import Image
except:
@@ -138,19 +141,35 @@
if not rar:
print "You must install unrar or rar to thumbnail RAR archives."
sys.exit(1)
- rarfiles = os.popen('%s vb "%s"' % (rar, compressed_file)).readlines()
+ #rarfiles = os.popen('%s vb "%s"' % (rar, compressed_file)).readlines()
+ rarfiles = subprocess.Popen([rar, 'vb', compressed_file],
+ stdout=subprocess.PIPE).communicate()[0].splitlines()
for i in range(len(rarfiles)):
rarfiles[i] = rarfiles[i].rstrip("\n")
rarfiles.sort()
cover = guessCover(rarfiles)
if cover:
- picture = StringIO.StringIO(os.popen('%s p -inul -- "%s" "%s"'
- % (rar, compressed_file, cover), "r").read())
+ #picture = StringIO.StringIO(os.popen('%s p -inul -- "%s" "%s"'
+ #% (rar, compressed_file, cover), "r").read())
+ picture = StringIO.StringIO(subprocess.Popen(
+ [rar, 'p', '-inul', '--', compressed_file, cover],
+ stdout=subprocess.PIPE).stdout.read())
else:
subarchive = first_archive(rarfiles)
if subarchive:
- os.popen('%s p -inul -- "%s" "%s" > "/tmp/comicthumb/archive%d"'
- % (rar, compressed_file, subarchive, depth), "r")
+ #os.popen('%s p -inul -- "%s" "%s" > "/tmp/comicthumb/archive%d"'
+ #% (rar, compressed_file, subarchive, depth), "r")
+ filen = "/tmp/comicthumb/archive%d"%(depth)
+ try:
+ os.remove(filen)
+ except:
+ pass
+ fp = open(filen, 'w')
+ fdp = fp.fileno()
+ subprocess.Popen(
+ [rar, 'p', '-inul', '--', compressed_file, subarchive],
+ stdout = fdp).wait()
+ fp.close()
return get_image("/tmp/comicthumb/archive%d" % (depth),
depth + 1)
return picture
Index: comix.spec
===================================================================
RCS file: /cvs/extras/rpms/comix/F-8/comix.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- comix.spec 20 Aug 2007 11:42:14 -0000 1.9
+++ comix.spec 2 Apr 2008 12:26:10 -0000 1.10
@@ -1,12 +1,13 @@
Name: comix
Version: 3.6.4
-Release: 2%{?dist}
+Release: 4%{?dist}
Summary: A user-friendly, customizable image viewer
Group: Amusements/Graphics
URL: http://comix.sourceforge.net/
License: GPLv2+
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+Patch0: comix-3.6.4-command-argument-closure.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -31,6 +32,7 @@
%prep
%setup -q
+%patch0 -p1 -b .CVE-2008-1568
%build
%{__sed} -i -e 's|shutil.copy|shutil.copy2|' install.py
@@ -46,6 +48,8 @@
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%{__python} install.py --installdir $RPM_BUILD_ROOT%{_prefix} install
+%{__sed} -i -e 's|comix.png|comix|' \
+ $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
desktop-file-install \
--vendor fedora \
--delete-original \
@@ -72,40 +76,43 @@
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
- %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
+ %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null
# If the schema file has ever been renamed::
# gconftool-2 --makefile-uninstall-rule \
-# %{_sysconfdir}/gconf/schemas/[OLDNAME].schemas > /dev/null || :
-
-killall -HUP gconfd-2 || :
+# %{_sysconfdir}/gconf/schemas/[OLDNAME].schemas > /dev/null
+exit 0
%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule \
- %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null || :
-killall -HUP gconfd-2 || :
+ %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null
-touch --no-create %{_datadir}/icons/hicolor || :
-%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+touch --no-create %{_datadir}/icons/hicolor
+%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
-update-desktop-database &> /dev/null ||:
-update-mime-database %{_datadir}/mime &> /dev/null || :
+update-desktop-database &> /dev/null
+update-mime-database %{_datadir}/mime &> /dev/null
+
+exit 0
%preun
[ "$1" -eq 0 ] || exit 0
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
- %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null || :
-killall -HUP gconfd-2 || :
+ %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null
+
+exit 0
%postun
-touch --no-create %{_datadir}/icons/hicolor || :
-%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
+touch --no-create %{_datadir}/icons/hicolor
+%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
-update-desktop-database &> /dev/null ||:
-update-mime-database %{_datadir}/mime &> /dev/null || :
+update-desktop-database &> /dev/null
+update-mime-database %{_datadir}/mime &> /dev/null
+
+exit 0
%files -f %{name}.lang
%defattr(-,root,root,-)
@@ -127,6 +134,14 @@
%changelog
+* Wed Apr 2 2008 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 3.6.4-4
+- First patch for bug 430635
+ Replace os.popen() with subprocess.Popen() to handle hostile filename
+ properly (CVE-2008-1568)
+
+* Wed Dec 5 2007 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 3.6.4-3
+- Fix icon path in desktop file for desktop-file-utils 0.14+
+
* Mon Aug 20 2007 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 3.6.4-2
- Now %%_sysconfdir/gconf{,/schemas} are owned by GConf2 (#233756)
More information about the fedora-extras-commits
mailing list