rpms/xsane/devel xsane-0.995-close-fds.patch, NONE, 1.1 xsane.spec, 1.56, 1.57

Nils Philippsen (nphilipp) fedora-extras-commits at redhat.com
Tue Jul 15 15:54:32 UTC 2008


Author: nphilipp

Update of /cvs/pkgs/rpms/xsane/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21416

Modified Files:
	xsane.spec 
Added Files:
	xsane-0.995-close-fds.patch 
Log Message:
don't leak file descriptors to help browser process (#455450)


xsane-0.995-close-fds.patch:

--- NEW FILE xsane-0.995-close-fds.patch ---
diff -up xsane-0.995/src/xsane.c.close-fds xsane-0.995/src/xsane.c
--- xsane-0.995/src/xsane.c.close-fds	2007-09-28 17:24:56.000000000 +0200
+++ xsane-0.995/src/xsane.c	2008-07-15 17:48:17.000000000 +0200
@@ -3681,6 +3681,8 @@ static void xsane_show_doc_via_nsr(GtkWi
  char *arg[5];
  struct stat st;
  char netscape_lock_path[PATH_MAX];
+ int open_max;
+ int i;
 
   DBG(DBG_proc, "xsane_show_doc_via_nsr(%s)\n", name);
 
@@ -3725,6 +3727,17 @@ static void xsane_show_doc_via_nsr(GtkWi
         ipc_file = fdopen(xsane.ipc_pipefd[1], "w");
       }
 
+      open_max = (int) sysconf (_SC_OPEN_MAX);
+
+      DBG(DBG_info, "closing unneeded file descriptors\n");
+
+      /* leave stdin, stdout, stderr alone */
+      for (i = 3; i < open_max; i++) {
+          /* xsane.ipc_pipefd[0] is closed by now */
+          if (i != xsane.ipc_pipefd[1])
+              close (i);
+      }
+
       DBG(DBG_info, "trying to change user id for new subprocess:\n");
       DBG(DBG_info, "old effective uid = %d\n", (int) geteuid());
       setuid(getuid());


Index: xsane.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xsane/devel/xsane.spec,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- xsane.spec	19 Feb 2008 16:29:16 -0000	1.56
+++ xsane.spec	15 Jul 2008 15:53:42 -0000	1.57
@@ -3,12 +3,13 @@
 Name: xsane
 Summary: X Window System front-end for the SANE scanner interface
 Version: 0.995
-Release: 3%{?dist}
+Release: 4%{?dist}
 Source0: http://www.xsane.org/download/%{name}-%{version}.tar.gz
 Source1: xsane.desktop
 Source2: xsane.conf.in
 Patch0: xsane-0.995-xdg-open.patch
 Patch1: xsane-0.995-eula-license-size.patch
+Patch2: xsane-0.995-close-fds.patch
 License: GPLv2+
 URL: http://www.xsane.org/
 Group: Applications/Multimedia
@@ -41,6 +42,7 @@
 %setup -q
 %patch0 -p1 -b .xdg-open
 %patch1 -p1 -b .eula-license-size
+%patch2 -p1 -b .close-fds
 
 %build
 %configure --enable-gimp
@@ -105,6 +107,9 @@
 %config(noreplace) %{_sysconfdir}/gimp/plugins.d/xsane.conf
 
 %changelog
+* Tue Jul 15 2008 Nils Philippsen <nphilipp at redhat.com> - 0.995-4
+- don't leak file descriptors to help browser process (#455450)
+
 * Tue Feb 19 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 0.995-3
 - Autorebuild for GCC 4.3
 




More information about the scm-commits mailing list