diff -Nru libfcgi-2.4.0/debian/changelog libfcgi-2.4.0/debian/changelog --- libfcgi-2.4.0/debian/changelog 2016-07-28 16:39:51.000000000 +0000 +++ libfcgi-2.4.0/debian/changelog 2017-11-22 00:48:26.000000000 +0000 @@ -1,3 +1,31 @@ +libfcgi (2.4.0-10) unstable; urgency=medium + + * Update debian/rules: + - enable all hardening flags + - add --no-parallel option to dh + + -- Boris Pek Wed, 22 Nov 2017 03:48:26 +0300 + +libfcgi (2.4.0-9) unstable; urgency=medium + + * New maintainer. (Closes: #837523) + * Bump Standards-Version to 4.1.1 (was 3.9.5): no changes required. + * Bump debhelper version to 10 (was 9); update debian/compat. + * Update debian/control: + - update Homepage field + - add Vcs-Git and Vcs-Browser fields + - delete build dependency from dh-autoreconf + - update short and long descriptions of binary packages + - fix lintian note binary-control-field-duplicates-source field + * Rename old patches for using of common naming scheme. + * Add description to patch binutils-indirect-linking. + * Add patch reset-file-descriptor-after-closing. (LP: #1248516) + * Delete empty file debian/libfcgi0ldbl.manpages. + * Update debian/copyright. + * Update debian/watch. + + -- Boris Pek Wed, 22 Nov 2017 02:56:53 +0300 + libfcgi (2.4.0-8.4) unstable; urgency=medium * Non-maintainer upload. diff -Nru libfcgi-2.4.0/debian/compat libfcgi-2.4.0/debian/compat --- libfcgi-2.4.0/debian/compat 2016-07-28 16:39:51.000000000 +0000 +++ libfcgi-2.4.0/debian/compat 2017-11-22 00:48:25.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru libfcgi-2.4.0/debian/control libfcgi-2.4.0/debian/control --- libfcgi-2.4.0/debian/control 2016-07-28 16:39:51.000000000 +0000 +++ libfcgi-2.4.0/debian/control 2017-11-22 00:48:25.000000000 +0000 @@ -1,35 +1,40 @@ Source: libfcgi Section: libs Priority: optional -Maintainer: Tatsuki Sugiura -Build-Depends: debhelper (>= 9), dh-autoreconf -Standards-Version: 3.9.5 -Uploaders: Taku YASUI -Homepage: http://www.fastcgi.com/drupal/ +Maintainer: Boris Pek +Build-Depends: debhelper (>= 10) +Standards-Version: 4.1.1 +Homepage: https://github.com/FastCGI-Archives +Vcs-Git: https://github.com/tehnick/libfcgi-debian.git +Vcs-Browser: https://github.com/tehnick/libfcgi-debian Package: libfcgi-dev Section: libdevel Architecture: any Depends: libfcgi0ldbl (= ${binary:Version}), ${misc:Depends} Multi-Arch: same -Description: Header files of FastCGI +Description: header files of FastCGI FastCGI is a language independent, scalable, open extension to CGI that provides high performance without the limitations of server specific APIs. + . + This package contains the header files, symlinks and static libraries which + are needed to develop applications based on libfcgi. Package: libfcgi0ldbl Provides: libfcgi -Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: libfcgi-bin (= ${binary:Version}) Conflicts: libfcgi0, libfcgi0c2 Replaces: libfcgi0, libfcgi0c2 Multi-Arch: same -Description: Shared library of FastCGI +Description: shared library of FastCGI FastCGI is a language independent, scalable, open extension to CGI that provides high performance without the limitations of server specific APIs. + . + This package contains the shared libraries. Package: libfcgi-bin Section: utils diff -Nru libfcgi-2.4.0/debian/copyright libfcgi-2.4.0/debian/copyright --- libfcgi-2.4.0/debian/copyright 2014-08-08 10:54:03.000000000 +0000 +++ libfcgi-2.4.0/debian/copyright 2017-11-22 00:48:25.000000000 +0000 @@ -1,12 +1,13 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Source: http://www.fastcgi.com/#TheDevKit +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: https://github.com/FastCGI-Archives/fcgi2/tags Files: * Copyright: 1996 Open Market, Inc. License: FASTCGI Files: debian/* -Copyright: Tatsuki Sugiura +Copyright: 2003-2010 Tatsuki Sugiura + 2017 Boris Pek License: FASTCGI License: FASTCGI diff -Nru libfcgi-2.4.0/debian/patches/binutils-indirect-linking libfcgi-2.4.0/debian/patches/binutils-indirect-linking --- libfcgi-2.4.0/debian/patches/binutils-indirect-linking 2011-08-20 21:42:11.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/binutils-indirect-linking 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ ---- libfcgi-2.4.0.orig/examples/Makefile.am -+++ libfcgi-2.4.0/examples/Makefile.am -@@ -34,5 +34,5 @@ threaded_CFLAGS = @PTHREAD_CFLAGS@ - threaded_LDFLAGS = @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ - - echo_cpp_SOURCES = $(INCLUDE_FILES) $(INCLUDEDIR)/fcgio.h echo-cpp.cpp --echo_cpp_LDADD = $(LIBDIR)/libfcgi++.la -+echo_cpp_LDADD = $(LIBDIR)/libfcgi++.la $(LIBDIR)/libfcgi.la - diff -Nru libfcgi-2.4.0/debian/patches/binutils-indirect-linking.patch libfcgi-2.4.0/debian/patches/binutils-indirect-linking.patch --- libfcgi-2.4.0/debian/patches/binutils-indirect-linking.patch 1970-01-01 00:00:00.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/binutils-indirect-linking.patch 2017-11-22 00:48:25.000000000 +0000 @@ -0,0 +1,16 @@ +Author: Stefan Potyra +Bug-Debian: https://bugs.debian.org/555178 +Description: fix FTBFS with binutils-gold +Last-Update: 2017-11-22 +Forwarded: no + + +--- libfcgi-2.4.0.orig/examples/Makefile.am ++++ libfcgi-2.4.0/examples/Makefile.am +@@ -34,5 +34,5 @@ threaded_CFLAGS = @PTHREAD_CFLAGS@ + threaded_LDFLAGS = @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ + + echo_cpp_SOURCES = $(INCLUDE_FILES) $(INCLUDEDIR)/fcgio.h echo-cpp.cpp +-echo_cpp_LDADD = $(LIBDIR)/libfcgi++.la ++echo_cpp_LDADD = $(LIBDIR)/libfcgi++.la $(LIBDIR)/libfcgi.la + diff -Nru libfcgi-2.4.0/debian/patches/fix_compiler_warnings.patch libfcgi-2.4.0/debian/patches/fix_compiler_warnings.patch --- libfcgi-2.4.0/debian/patches/fix_compiler_warnings.patch 2014-08-08 10:54:03.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/fix_compiler_warnings.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -Description: Fix up compiler warnings in codebase, including: - - Unwind complex deferencing of pointers resolving: - "warning: dereferencing type-punned pointer will break strict-aliasing rules" - - Remove unused variable from the codebase: - "warning: variable 'numFDs' set but not used" - - Cast parameters properly for formatting in fprintf: - "warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t'" - - Interim cast to intprt_t when passing FD's as ClientData pointers: - "warning: cast to pointer from integer of different size" -Author: James Page -Bug-Ubuntu: https://bugs.launchpad.net/bugs/1017978 -Forwarded: yes, fastcgi-developers@mailman.fastcgi.com - ---- a/libfcgi/fcgiapp.c -+++ b/libfcgi/fcgiapp.c -@@ -1486,16 +1486,17 @@ static int ProcessManagementRecord(int t - } - len = responseP - &response[FCGI_HEADER_LEN]; - paddedLen = AlignInt8(len); -- *((FCGI_Header *) response) -- = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID, -- len, paddedLen - len); -+ FCGI_Header *header = (FCGI_Header *)response; -+ *header = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID, -+ len, paddedLen - len); - FreeParams(¶msPtr); - } else { - paddedLen = len = sizeof(FCGI_UnknownTypeBody); -- ((FCGI_UnknownTypeRecord *) response)->header -+ FCGI_UnknownTypeRecord *utr = (FCGI_UnknownTypeRecord *) response; -+ utr->header - = MakeHeader(FCGI_UNKNOWN_TYPE, FCGI_NULL_REQUEST_ID, - len, 0); -- ((FCGI_UnknownTypeRecord *) response)->body -+ utr->body - = MakeUnknownTypeBody(type); - } - if (write_it_all(data->reqDataPtr->ipcFd, response, FCGI_HEADER_LEN + paddedLen) < 0) { ---- a/cgi-fcgi/cgi-fcgi.c -+++ b/cgi-fcgi/cgi-fcgi.c -@@ -386,8 +386,8 @@ static void WebServerReadHandler(ClientD - if(bytesRead < 0) { - exit(OS_Errno); - } -- *((FCGI_Header *) &fromWS.buff[0]) -- = MakeHeader(FCGI_STDIN, requestId, bytesRead, 0); -+ FCGI_Header *header = (FCGI_Header *) &fromWS.buff[0]; -+ *header = MakeHeader(FCGI_STDIN, requestId, bytesRead, 0); - bytesToRead -= bytesRead; - fromWS.stop = &fromWS.buff[sizeof(FCGI_Header) + bytesRead]; - webServerReadHandlerEOF = (bytesRead == 0); -@@ -458,7 +458,7 @@ static void ScheduleIo(void) - ((length = fromWS.stop - fromWS.next) != 0)) { - if(OS_AsyncWrite(appServerSock, 0, fromWS.next, length, - AppServerWriteHandler, -- (ClientData)appServerSock) == -1) { -+ (ClientData)(intptr_t)appServerSock) == -1) { - FCGIexit(OS_Errno); - } else { - fcgiWritePending = TRUE; -@@ -474,7 +474,7 @@ static void ScheduleIo(void) - - if(OS_AsyncRead(appServerSock, 0, fromAS.next, BUFFLEN, - AppServerReadHandler, -- (ClientData)appServerSock) == -1) { -+ (ClientData)(intptr_t)appServerSock) == -1) { - FCGIexit(OS_Errno); - } else { - fcgiReadPending = TRUE; -@@ -640,7 +640,7 @@ static int ParseArgs(int argc, char *arg - } - if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) { - fprintf(stderr, "Cannot allocate %d bytes\n", -- strlen(tp1)+1); -+ (int)strlen(tp1)+1); - exit(-1); - } - strcpy(av[ac++], tp1); -@@ -722,7 +722,6 @@ int main(int argc, char **argv) - char **envp = environ; - int count; - FCGX_Stream *paramsStream; -- int numFDs; - unsigned char headerBuff[8]; - int headerLen, valueLen; - char *equalPtr; -@@ -821,10 +820,6 @@ int main(int argc, char **argv) - */ - fromWS.stop = fromWS.next = &fromWS.buff[0]; - webServerReadHandlerEOF = FALSE; -- /* -- * XXX: might want to use numFDs in the os library. -- */ -- numFDs = max(appServerSock, STDIN_FILENO) + 1; - OS_SetFlags(appServerSock, O_NONBLOCK); - - if (bytesToRead <= 0) diff -Nru libfcgi-2.4.0/debian/patches/fix-compiler-warnings.patch libfcgi-2.4.0/debian/patches/fix-compiler-warnings.patch --- libfcgi-2.4.0/debian/patches/fix-compiler-warnings.patch 1970-01-01 00:00:00.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/fix-compiler-warnings.patch 2017-11-22 00:48:25.000000000 +0000 @@ -0,0 +1,97 @@ +Description: Fix up compiler warnings in codebase, including: + - Unwind complex deferencing of pointers resolving: + "warning: dereferencing type-punned pointer will break strict-aliasing rules" + - Remove unused variable from the codebase: + "warning: variable 'numFDs' set but not used" + - Cast parameters properly for formatting in fprintf: + "warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t'" + - Interim cast to intprt_t when passing FD's as ClientData pointers: + "warning: cast to pointer from integer of different size" +Author: James Page +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1017978 +Forwarded: yes, fastcgi-developers@mailman.fastcgi.com + +--- a/libfcgi/fcgiapp.c ++++ b/libfcgi/fcgiapp.c +@@ -1486,16 +1486,17 @@ static int ProcessManagementRecord(int t + } + len = responseP - &response[FCGI_HEADER_LEN]; + paddedLen = AlignInt8(len); +- *((FCGI_Header *) response) +- = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID, +- len, paddedLen - len); ++ FCGI_Header *header = (FCGI_Header *)response; ++ *header = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID, ++ len, paddedLen - len); + FreeParams(¶msPtr); + } else { + paddedLen = len = sizeof(FCGI_UnknownTypeBody); +- ((FCGI_UnknownTypeRecord *) response)->header ++ FCGI_UnknownTypeRecord *utr = (FCGI_UnknownTypeRecord *) response; ++ utr->header + = MakeHeader(FCGI_UNKNOWN_TYPE, FCGI_NULL_REQUEST_ID, + len, 0); +- ((FCGI_UnknownTypeRecord *) response)->body ++ utr->body + = MakeUnknownTypeBody(type); + } + if (write_it_all(data->reqDataPtr->ipcFd, response, FCGI_HEADER_LEN + paddedLen) < 0) { +--- a/cgi-fcgi/cgi-fcgi.c ++++ b/cgi-fcgi/cgi-fcgi.c +@@ -386,8 +386,8 @@ static void WebServerReadHandler(ClientD + if(bytesRead < 0) { + exit(OS_Errno); + } +- *((FCGI_Header *) &fromWS.buff[0]) +- = MakeHeader(FCGI_STDIN, requestId, bytesRead, 0); ++ FCGI_Header *header = (FCGI_Header *) &fromWS.buff[0]; ++ *header = MakeHeader(FCGI_STDIN, requestId, bytesRead, 0); + bytesToRead -= bytesRead; + fromWS.stop = &fromWS.buff[sizeof(FCGI_Header) + bytesRead]; + webServerReadHandlerEOF = (bytesRead == 0); +@@ -458,7 +458,7 @@ static void ScheduleIo(void) + ((length = fromWS.stop - fromWS.next) != 0)) { + if(OS_AsyncWrite(appServerSock, 0, fromWS.next, length, + AppServerWriteHandler, +- (ClientData)appServerSock) == -1) { ++ (ClientData)(intptr_t)appServerSock) == -1) { + FCGIexit(OS_Errno); + } else { + fcgiWritePending = TRUE; +@@ -474,7 +474,7 @@ static void ScheduleIo(void) + + if(OS_AsyncRead(appServerSock, 0, fromAS.next, BUFFLEN, + AppServerReadHandler, +- (ClientData)appServerSock) == -1) { ++ (ClientData)(intptr_t)appServerSock) == -1) { + FCGIexit(OS_Errno); + } else { + fcgiReadPending = TRUE; +@@ -640,7 +640,7 @@ static int ParseArgs(int argc, char *arg + } + if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) { + fprintf(stderr, "Cannot allocate %d bytes\n", +- strlen(tp1)+1); ++ (int)strlen(tp1)+1); + exit(-1); + } + strcpy(av[ac++], tp1); +@@ -722,7 +722,6 @@ int main(int argc, char **argv) + char **envp = environ; + int count; + FCGX_Stream *paramsStream; +- int numFDs; + unsigned char headerBuff[8]; + int headerLen, valueLen; + char *equalPtr; +@@ -821,10 +820,6 @@ int main(int argc, char **argv) + */ + fromWS.stop = fromWS.next = &fromWS.buff[0]; + webServerReadHandlerEOF = FALSE; +- /* +- * XXX: might want to use numFDs in the os library. +- */ +- numFDs = max(appServerSock, STDIN_FILENO) + 1; + OS_SetFlags(appServerSock, O_NONBLOCK); + + if (bytesToRead <= 0) diff -Nru libfcgi-2.4.0/debian/patches/gcc44-fix-include libfcgi-2.4.0/debian/patches/gcc44-fix-include --- libfcgi-2.4.0/debian/patches/gcc44-fix-include 2010-02-08 15:27:34.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/gcc44-fix-include 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -Description: Upstream changes introduced in version 2.4.0-8 - This patch has been created by dpkg-source during the package build. - Here's the last changelog entry, hopefully it gives details on why - those changes were made: - . - libfcgi (2.4.0-8) unstable; urgency=low - . - * Switch to dpkg-source 3.0 (quilt) format - . - The person named in the Author field signed this changelog entry. -Author: Tatsuki Sugiura -Origin: vendor, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504963 -Bug-Debian: http://bugs.debian.org/504963 -Forwarded: no -Last-Update: 2010-02-08 - -Index: libfcgi/libfcgi/fcgio.cpp -=================================================================== ---- libfcgi.orig/libfcgi/fcgio.cpp 2010-01-23 19:13:53.000000000 +0900 -+++ libfcgi/libfcgi/fcgio.cpp 2010-01-23 19:13:55.000000000 +0900 -@@ -22,6 +22,7 @@ - #define DLLAPI __declspec(dllexport) - #endif - -+#include - #include - #include "fcgio.h" - diff -Nru libfcgi-2.4.0/debian/patches/gcc44-fix-include.patch libfcgi-2.4.0/debian/patches/gcc44-fix-include.patch --- libfcgi-2.4.0/debian/patches/gcc44-fix-include.patch 1970-01-01 00:00:00.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/gcc44-fix-include.patch 2017-11-22 00:48:25.000000000 +0000 @@ -0,0 +1,28 @@ +Description: Upstream changes introduced in version 2.4.0-8 + This patch has been created by dpkg-source during the package build. + Here's the last changelog entry, hopefully it gives details on why + those changes were made: + . + libfcgi (2.4.0-8) unstable; urgency=low + . + * Switch to dpkg-source 3.0 (quilt) format + . + The person named in the Author field signed this changelog entry. +Author: Tatsuki Sugiura +Origin: vendor, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504963 +Bug-Debian: http://bugs.debian.org/504963 +Forwarded: no +Last-Update: 2010-02-08 + +Index: libfcgi/libfcgi/fcgio.cpp +=================================================================== +--- libfcgi.orig/libfcgi/fcgio.cpp 2010-01-23 19:13:53.000000000 +0900 ++++ libfcgi/libfcgi/fcgio.cpp 2010-01-23 19:13:55.000000000 +0900 +@@ -22,6 +22,7 @@ + #define DLLAPI __declspec(dllexport) + #endif + ++#include + #include + #include "fcgio.h" + diff -Nru libfcgi-2.4.0/debian/patches/poll libfcgi-2.4.0/debian/patches/poll --- libfcgi-2.4.0/debian/patches/poll 2014-08-08 10:54:03.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/poll 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -Author: Anton Kortunov -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libfcgi/+bug/933417 -Description: use poll in os_unix.c instead of select to avoid problem with > 1024 connections -Forwarded: yes, fastcgi-developers@mailman.fastcgi.com - -diff --git a/libfcgi/os_unix.c b/libfcgi/os_unix.c -index 73e6a7f..af35aee 100755 ---- a/libfcgi/os_unix.c -+++ b/libfcgi/os_unix.c -@@ -42,6 +42,7 @@ static const char rcsid[] = "$Id: os_unix.c,v 1.37 2002/03/05 19:14:49 robs Exp - #include - #include - #include -+#include - - #ifdef HAVE_NETDB_H - #include -@@ -103,6 +104,9 @@ static int volatile maxFd = -1; - static int shutdownPending = FALSE; - static int shutdownNow = FALSE; - -+static int libfcgiOsClosePollTimeout = 2000; -+static int libfcgiIsAfUnixKeeperPollTimeout = 2000; -+ - void OS_ShutdownPending() - { - shutdownPending = TRUE; -@@ -168,6 +172,16 @@ int OS_LibInit(int stdioFds[3]) - if(libInitialized) - return 0; - -+ char *libfcgiOsClosePollTimeoutStr = getenv( "LIBFCGI_OS_CLOSE_POLL_TIMEOUT" ); -+ if(libfcgiOsClosePollTimeoutStr) { -+ libfcgiOsClosePollTimeout = atoi(libfcgiOsClosePollTimeoutStr); -+ } -+ -+ char *libfcgiIsAfUnixKeeperPollTimeoutStr = getenv( "LIBFCGI_IS_AF_UNIX_KEEPER_POLL_TIMEOUT" ); -+ if(libfcgiIsAfUnixKeeperPollTimeoutStr) { -+ libfcgiIsAfUnixKeeperPollTimeout = atoi(libfcgiIsAfUnixKeeperPollTimeoutStr); -+ } -+ - asyncIoTable = (AioInfo *)malloc(asyncIoTableSize * sizeof(AioInfo)); - if(asyncIoTable == NULL) { - errno = ENOMEM; -@@ -755,19 +769,16 @@ int OS_Close(int fd) - - if (shutdown(fd, 1) == 0) - { -- struct timeval tv; -- fd_set rfds; -+ struct pollfd pfd; - int rv; - char trash[1024]; - -- FD_ZERO(&rfds); -+ pfd.fd = fd; -+ pfd.events = POLLIN; - - do - { -- FD_SET(fd, &rfds); -- tv.tv_sec = 2; -- tv.tv_usec = 0; -- rv = select(fd + 1, &rfds, NULL, NULL, &tv); -+ rv = poll(&pfd, 1, libfcgiOsClosePollTimeout); - } - while (rv > 0 && read(fd, trash, sizeof(trash)) > 0); - } -@@ -1116,13 +1127,11 @@ static int is_reasonable_accept_errno (const int error) - */ - static int is_af_unix_keeper(const int fd) - { -- struct timeval tval = { READABLE_UNIX_FD_DROP_DEAD_TIMEVAL }; -- fd_set read_fds; -- -- FD_ZERO(&read_fds); -- FD_SET(fd, &read_fds); -+ struct pollfd pfd; -+ pfd.fd = fd; -+ pfd.events = POLLIN; - -- return select(fd + 1, &read_fds, NULL, NULL, &tval) >= 0 && FD_ISSET(fd, &read_fds); -+ return poll(&pfd, 1, libfcgiIsAfUnixKeeperPollTimeout) >= 0 && (pfd.revents & POLLIN); - } - - /* diff -Nru libfcgi-2.4.0/debian/patches/reset-file-descriptor-after-closing.patch libfcgi-2.4.0/debian/patches/reset-file-descriptor-after-closing.patch --- libfcgi-2.4.0/debian/patches/reset-file-descriptor-after-closing.patch 1970-01-01 00:00:00.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/reset-file-descriptor-after-closing.patch 2017-11-22 00:48:25.000000000 +0000 @@ -0,0 +1,17 @@ +Author: André Düwel +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libfcgi/+bug/1248516 +Description: reset file descriptor after closing + Fixes problem: FastCGI Application occasionally hangs in an infinite loop + after restarting of Apache. +Forwarded: no + +--- a/libfcgi/os_unix.c ++++ b/libfcgi/os_unix.c +@@ -1199,6 +1199,7 @@ + break; + + close(socket); ++ socket = -1; + } /* socket >= 0 */ + } /* for(;;) */ + diff -Nru libfcgi-2.4.0/debian/patches/series libfcgi-2.4.0/debian/patches/series --- libfcgi-2.4.0/debian/patches/series 2014-08-08 10:55:24.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/series 2017-11-22 00:48:25.000000000 +0000 @@ -1,4 +1,5 @@ -binutils-indirect-linking -gcc44-fix-include -poll -fix_compiler_warnings.patch +binutils-indirect-linking.patch +gcc44-fix-include.patch +use-poll.patch +fix-compiler-warnings.patch +reset-file-descriptor-after-closing.patch diff -Nru libfcgi-2.4.0/debian/patches/use-poll.patch libfcgi-2.4.0/debian/patches/use-poll.patch --- libfcgi-2.4.0/debian/patches/use-poll.patch 1970-01-01 00:00:00.000000000 +0000 +++ libfcgi-2.4.0/debian/patches/use-poll.patch 2017-11-22 00:48:25.000000000 +0000 @@ -0,0 +1,86 @@ +Author: Anton Kortunov +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libfcgi/+bug/933417 +Description: use poll in os_unix.c instead of select to avoid problem with > 1024 connections +Forwarded: yes, fastcgi-developers@mailman.fastcgi.com + +diff --git a/libfcgi/os_unix.c b/libfcgi/os_unix.c +index 73e6a7f..af35aee 100755 +--- a/libfcgi/os_unix.c ++++ b/libfcgi/os_unix.c +@@ -42,6 +42,7 @@ static const char rcsid[] = "$Id: os_unix.c,v 1.37 2002/03/05 19:14:49 robs Exp + #include + #include + #include ++#include + + #ifdef HAVE_NETDB_H + #include +@@ -103,6 +104,9 @@ static int volatile maxFd = -1; + static int shutdownPending = FALSE; + static int shutdownNow = FALSE; + ++static int libfcgiOsClosePollTimeout = 2000; ++static int libfcgiIsAfUnixKeeperPollTimeout = 2000; ++ + void OS_ShutdownPending() + { + shutdownPending = TRUE; +@@ -168,6 +172,16 @@ int OS_LibInit(int stdioFds[3]) + if(libInitialized) + return 0; + ++ char *libfcgiOsClosePollTimeoutStr = getenv( "LIBFCGI_OS_CLOSE_POLL_TIMEOUT" ); ++ if(libfcgiOsClosePollTimeoutStr) { ++ libfcgiOsClosePollTimeout = atoi(libfcgiOsClosePollTimeoutStr); ++ } ++ ++ char *libfcgiIsAfUnixKeeperPollTimeoutStr = getenv( "LIBFCGI_IS_AF_UNIX_KEEPER_POLL_TIMEOUT" ); ++ if(libfcgiIsAfUnixKeeperPollTimeoutStr) { ++ libfcgiIsAfUnixKeeperPollTimeout = atoi(libfcgiIsAfUnixKeeperPollTimeoutStr); ++ } ++ + asyncIoTable = (AioInfo *)malloc(asyncIoTableSize * sizeof(AioInfo)); + if(asyncIoTable == NULL) { + errno = ENOMEM; +@@ -755,19 +769,16 @@ int OS_Close(int fd) + + if (shutdown(fd, 1) == 0) + { +- struct timeval tv; +- fd_set rfds; ++ struct pollfd pfd; + int rv; + char trash[1024]; + +- FD_ZERO(&rfds); ++ pfd.fd = fd; ++ pfd.events = POLLIN; + + do + { +- FD_SET(fd, &rfds); +- tv.tv_sec = 2; +- tv.tv_usec = 0; +- rv = select(fd + 1, &rfds, NULL, NULL, &tv); ++ rv = poll(&pfd, 1, libfcgiOsClosePollTimeout); + } + while (rv > 0 && read(fd, trash, sizeof(trash)) > 0); + } +@@ -1116,13 +1127,11 @@ static int is_reasonable_accept_errno (const int error) + */ + static int is_af_unix_keeper(const int fd) + { +- struct timeval tval = { READABLE_UNIX_FD_DROP_DEAD_TIMEVAL }; +- fd_set read_fds; +- +- FD_ZERO(&read_fds); +- FD_SET(fd, &read_fds); ++ struct pollfd pfd; ++ pfd.fd = fd; ++ pfd.events = POLLIN; + +- return select(fd + 1, &read_fds, NULL, NULL, &tval) >= 0 && FD_ISSET(fd, &read_fds); ++ return poll(&pfd, 1, libfcgiIsAfUnixKeeperPollTimeout) >= 0 && (pfd.revents & POLLIN); + } + + /* diff -Nru libfcgi-2.4.0/debian/rules libfcgi-2.4.0/debian/rules --- libfcgi-2.4.0/debian/rules 2016-07-28 16:39:51.000000000 +0000 +++ libfcgi-2.4.0/debian/rules 2017-11-22 00:48:25.000000000 +0000 @@ -1,12 +1,11 @@ #!/usr/bin/make -f +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +export DEB_BUILD_MAINT_OPTIONS = hardening=+all export AUTOMAKE=automake --foreign %: - dh $@ --with autoreconf - -override_dh_auto_configure: - dh_auto_configure -- $(shell dpkg-buildflags --export=cmdline) + dh $@ --no-parallel --with autoreconf override_dh_auto_install: dh_auto_install diff -Nru libfcgi-2.4.0/debian/watch libfcgi-2.4.0/debian/watch --- libfcgi-2.4.0/debian/watch 2010-02-08 15:27:34.000000000 +0000 +++ libfcgi-2.4.0/debian/watch 2017-11-22 00:48:25.000000000 +0000 @@ -1,6 +1,2 @@ -# Example watch control file for uscan -# Rename this file to "watch" and then you can run the "uscan" command -# to check for upstream updates and more. -# Site Directory Pattern Version Script -version=2 -http://www.fastcgi.com/dist/ fcgi-([0-9\.-]*)\.tar\.gz debian uupdate +version=3 +https://github.com/FastCGI-Archives/fcgi2/tags .*/FastCGI-Archives/fcgi2/archive/(\d.+)\.tar\.gz debian uupdate