Fixed FD leak in biff

This commit is contained in:
Jaroslav Škarvada 2012-07-03 09:18:48 +02:00
parent fc405dc53f
commit 04a58df8c3
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,27 @@
diff -up postfix-2.3.3/src/local/biff_notify.c.orig2 postfix-2.3.3/src/local/biff_notify.c
--- postfix-2.3.3/src/local/biff_notify.c.orig2 2005-07-13 22:46:18.000000000 +0200
+++ postfix-2.3.3/src/local/biff_notify.c 2012-07-02 18:17:28.694042972 +0200
@@ -46,6 +46,7 @@
/* Application-specific. */
+#include "iostuff.h"
#include <biff_notify.h>
/* biff_notify - notify recipient via the biff "protocol" */
@@ -81,9 +82,12 @@ void biff_notify(const char *text, ss
/*
* Open a socket, or re-use an existing one.
*/
- if (sock < 0 && (sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- msg_warn("socket: %m");
- return;
+ if (sock < 0) {
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ msg_warn("socket: %m");
+ return;
+ }
+ close_on_exec(sock, CLOSE_ON_EXEC);
}
/*

View File

@ -38,7 +38,7 @@
Name: postfix Name: postfix
Summary: Postfix Mail Transport Agent Summary: Postfix Mail Transport Agent
Version: 2.9.3 Version: 2.9.3
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 2 Epoch: 2
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.postfix.org URL: http://www.postfix.org
@ -79,6 +79,8 @@ Patch2: postfix-2.6.1-files.patch
Patch3: postfix-alternatives.patch Patch3: postfix-alternatives.patch
Patch8: postfix-large-fs.patch Patch8: postfix-large-fs.patch
Patch9: pflogsumm-1.1.3-datecalc.patch Patch9: pflogsumm-1.1.3-datecalc.patch
# Fix for FD leak in biff (accepted upstream)
Patch10: postfix-2.3.3-biff-cloexec.patch
# Optional patches - set the appropriate environment variables to include # Optional patches - set the appropriate environment variables to include
# them when building the package/spec file # them when building the package/spec file
@ -147,6 +149,8 @@ pushd pflogsumm-%{pflogsumm_ver}
popd popd
%endif %endif
%patch10 -p1 -b .biff-cloexec
for f in README_FILES/TLS_{LEGACY_,}README TLS_ACKNOWLEDGEMENTS; do for f in README_FILES/TLS_{LEGACY_,}README TLS_ACKNOWLEDGEMENTS; do
iconv -f iso8859-1 -t utf8 -o ${f}{_,} && iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
touch -r ${f}{,_} && mv -f ${f}{_,} touch -r ${f}{,_} && mv -f ${f}{_,}
@ -525,6 +529,9 @@ rm -rf $RPM_BUILD_ROOT
%endif %endif
%changelog %changelog
* Tue Jul 03 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 2:2.9.3-2
- Fixed FD leak in biff
* Tue Jun 5 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 2:2.9.3-1 * Tue Jun 5 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 2:2.9.3-1
- New version - New version
Resolves: rhbz#828242 Resolves: rhbz#828242