Re: [squid-dev] [PATCH] Segfault via Ftp::Client::readControlReply.

2016-11-10 Thread Amos Jeffries
On 11/11/2016 6:03 a.m., Christos Tsantilas wrote:
> 
> Added nil dereference checks for Ftp::Client::ctrl.conn, including:
> - Ftp::Client::handlePasvReply() and handleEpsvReply() that dereference
> ctrl.conn in DBG_IMPORTANT messages.
> - Many functions inside FtpClient.cc and FtpGateway.cc files.
> 
> TODO: We need to find a better way to handle nil ctrl.conn. It is only a
> matter of time when we forget to add another dereference check or
> discover a place we missed during this change.
> 
> Also disabled forwarding of EPRT and PORT commands to origin servers.
> Squid support for those commands is broken and their forwarding may
> cause segfaults (bug #4004). Active FTP is still supported, of course.
> 
> This is a Measurement Factory project.


in ftpReadPasv()
- please leave the ftpSendEPRT where it was (but comment out). As-is
this will just add a new Coverity issue about dead/unreachable code.

in completeForwarding()
- sic you are changing the debugs line please polish it all up to remove
the HERE
 - also s/completeForwarding avoids /avoid /

+1 with the above polish.

pPS. please remember to apply on the squid-5 branchnow, not trunk or v4.

Amos

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


Re: [squid-dev] [PATCH] ICAP trailer support

2016-11-10 Thread Amos Jeffries
On 10/11/2016 7:29 a.m., Alex Rousskov wrote:
> On 11/09/2016 08:16 AM, Amos Jeffries wrote:
>> On 9/11/2016 3:05 a.m., Eduard Bagdasaryan wrote:
>>> Also simplified and fixed headers isolating code while dealing with
>>> empty (i.e. zero header fields) headers. Old httpMsgIsolateHeaders()
>>> tried to re-implement header end detection/processing logic that is
>>> actually covered by headersEnd(). Old httpMsgIsolateHeaders() could
>>> return success for some garbage input (e.g., a buffer of several CRs)
>>> even if no end of headers was found.
> 
> 
>> Careful there. Since HttpMsg is actually HTTP parse logic a buffer
>> containing several CR's can be a valid mime block (just empty). CR is
>> part of BWS/OWS in HTTP.
> 
> Amos,
> 
> Do you agree that a buffer consisting of several CRs and nothing
> else must not result in httpMsgIsolateHeaders() returning 1 (i.e.
> "success")?

Only if all the callers of this function are handling the case where it
produces non-1 and adding a terminator LF explicitly for a re-parse attempt.

IIRC we made the HTTP code do that, but I'm not sure of the ICAP or HTCP
code, or the Store loading code (which parses into StoreEntry/MemObject
or something).

If this functions output in this case is going to change then all those
callers need to be checked that they cope with this change correctly.


> 
> The above preamble text is trying to say that the old
> httpMsgIsolateHeaders() could return 1 in that invalid-input case. The
> text should be rephrased for clarity if that is not how you interpreted
> it. Suggestions welcomed.
> 
> 
> In this context, the "HTTP header(s)" is defined as
> 
>   *( header-field CR?LF )
>   CR?LF
> 
> where CR?LF is either CRLF or just LF.
> 
> Old httpMsgIsolateHeaders() and new HttpHeader::Isolate() must extract
> the mime block (i.e., the *(header-field CR?LF) part) but only if
> headersEnd() finds the end of the HTTP header first. The old
> httpMsgIsolateHeaders was buggy. If you believe HttpHeader::Isolate() is
> buggy, please speak up!

I have not seen any bugs, just the above needs doing.

Amos

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


Re: [squid-dev] [PATCH] Extend SBufContainerJoin to have prefix and suffix arguments

2016-11-10 Thread Amos Jeffries
On 11/11/2016 9:28 a.m., Kinkie wrote:
> 
> v4 attached.
> 

Does it have to take begin() and end() iterators explicitly?
 can we not have it take the container itself and use a for(auto  :
container) loop ?

Amos

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


[squid-dev] Build failed in Jenkins: 4-matrix » gcc,d-debian-unstable #2

2016-11-10 Thread noc
http://build.squid-cache.org/job/4-matrix/compiler=gcc,label=d-debian-unstable/2/--
[...truncated 32111 lines...]
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT 
stub_memaccount.lo -MD -MP -MF .deps/stub_memaccount.Tpo -c 
../../../lib/stub_memaccount.c  -fPIC -DPIC -o stub_memaccount.o >/dev/null 2>&1
depbase=`echo xusleep.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ../libtool  --tag=CC   --mode=compile ccache gcc -DHAVE_CONFIG_H   
-I../../.. -I../../../include -I../../../lib -I../../../src -I../include
-I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings 
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow -Werror -pipe 
-D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD -MP -MF $depbase.Tpo -c -o 
xusleep.lo ../../../lib/xusleep.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  ccache g++ -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 
-I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Wshadow -Woverloaded-virtual -Werror -Wno-deprecated-register -pipe 
-D_REENTRANT -I/usr/include/p11-kit-1 -g -O2 -MT Splay.lo -MD -MP -MF 
.deps/Splay.Tpo -c ../../../lib/Splay.cc  -fPIC -DPIC -o Splay.o >/dev/null 2>&1
/bin/bash ../libtool  --tag=CC   --mode=link ccache gcc -Wall -Wpointer-arith 
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow 
-Werror -pipe -D_REENTRANT -Wall -g -O2  -g -o libmiscencoding.la  base64.lo 
charset.lo html_quote.lo md5.lo rfc1738.lo rfc2617.lo uudecode.lo  
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmisccontainers.la  hash.lo  
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o .libs/util.o
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o 
.libs/xusleep.o
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o xusleep.o 
>/dev/null 2>&1
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o util.o >/dev/null 2>&1
libtool: link: /usr/bin/ar cru .libs/libmiscencoding.a .libs/base64.o 
.libs/charset.o .libs/html_quote.o .libs/md5.o .libs/rfc1738.o .libs/rfc2617.o 
.libs/uudecode.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libmiscencoding.a
libtool: link: ( cd ".libs" && rm -f "libmiscencoding.la" && ln -s 
"../libmiscencoding.la" "libmiscencoding.la" )
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmiscutil.la  getfullhostname.lo heap.lo iso3307.lo radix.lo 
rfc1123.lo Splay.lo stub_memaccount.lo util.lo xusleep.lo  
libtool: link: /usr/bin/ar cru .libs/libmisccontainers.a .libs/hash.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libmisccontainers.a
libtool: link: ( cd ".libs" && rm -f "libmisccontainers.la" && ln -s 
"../libmisccontainers.la" "libmisccontainers.la" )
libtool: link: /usr/bin/ar cru .libs/libmiscutil.a .libs/getfullhostname.o 
.libs/heap.o .libs/iso3307.o .libs/radix.o .libs/rfc1123.o .libs/Splay.o 
.libs/stub_memaccount.o .libs/util.o 

Re: [squid-dev] [PATCH] Extend SBufContainerJoin to have prefix and suffix arguments

2016-11-10 Thread Kinkie
> Tests and code analysis show that JoinContainerIntoSBuf() allocates when
> no allocation is needed. I have also shown that it is possible to
> implement JoinContainerIntoSBuf() so that there is no extra allocation.
> AFAICT, going forward, you choices are:
>
> * state that the extra allocation is not your fault, leaving it as is,
>   and/or
> * fix JoinContainerIntoSBuf() to avoid the extra allocation.
>
> When you added the "dest" parameter, you have started moving in the
> latter direction.

I'm completing that by using the reseve() based approach

>> At the same time, it's not a matter of API: the extended
>> reserve() has the same behavior as the "problem" is elsewhere.
>
> Whether SBuf::reserve() has the same behavior as reserveSpace() depends
> on reserve() configuration parameters.
>
> JoinContainerIntoSBuf() should configure reserve() in such a way that
> reserve() does _not_ have the same behavior as reserveSpace(). I showed
> how to do that in JoinContainerIntoSBuf4() in my earlier patch. The
> patch attached now has an even simpler JoinContainerIntoSBuf5()
> implementation because I fixed reserve() to not require the .ideal
> configuration parameter to be set (trunk r14917).

Aha! I was confused as I had branched off earlier. Merging.

>
>> What we could do is:
>> - define a reserveMinSpace() which does not shrink storage
>
> Having two methods called reserveMinSpace() and reserveSpace(), one of
> which does not shrink and the other one does, makes no sense to me
> because the method names do not reflect that difference at all and
> because reserve() is always primarily about "minimum" space anyway.
>
> More importantly, reserveSpace() guarantees single ownership. IMO,
> shrinking is essentially a side effect of that guarantee.

Yes.

> I suspect we do not need a "provide single-ownership space, shrinking
> the existing single-owned MemBlob if there is one" method, but if you
> have some existing use cases for it, please share them. If there are no
> such cases, reserveSpace()/reserveCapacity() should be optimized to
> avoid unnecessary re-allocation when their MemBlob is already not
> shared, but that is a different story, unrelated to JoinContainerIntoSBuf!

I agree. And that's why I think they could be simply convenience
methods for reserve().

>> - reimplement [...] reserveSpace() as convenience wrapper around reserve()
>
> Sure, but that is outside this patch scope.

Yes.


>> - while we're at it, give SBufReservationRequirements a convenience 
>> constructor
>
> With minSpace as the only parameter? Sure. Please do not forget
> "explicit". Again, that seems to be outside your patch scope.

Yes.

> I do not recommend providing more than one constructor parameter though
> because constructors with multiple same- or similar-type parameters are
> a recipe for mismatching parameters disasters.

Let's optimize the common case, we'll see if there is a need for more later on.

v4 attached.

-- 
Francesco


sbufcontainerjoin-v4.patch
Description: Binary data
___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


[squid-dev] Build failed in Jenkins: 5-matrix » gcc,d-debian-unstable #3

2016-11-10 Thread noc
http://build.squid-cache.org/job/5-matrix/compiler=gcc,label=d-debian-unstable/3/--
[...truncated 32111 lines...]
libtool: compile:  ccache g++ -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 
-I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Wshadow -Woverloaded-virtual -Werror -Wno-deprecated-register -pipe 
-D_REENTRANT -I/usr/include/p11-kit-1 -g -O2 -MT Splay.lo -MD -MP -MF 
.deps/Splay.Tpo -c ../../../lib/Splay.cc  -fPIC -DPIC -o .libs/Splay.o
depbase=`echo xusleep.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ../libtool  --tag=CC   --mode=compile ccache gcc -DHAVE_CONFIG_H   
-I../../.. -I../../../include -I../../../lib -I../../../src -I../include
-I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings 
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow -Werror -pipe 
-D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD -MP -MF $depbase.Tpo -c -o 
xusleep.lo ../../../lib/xusleep.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT 
stub_memaccount.lo -MD -MP -MF .deps/stub_memaccount.Tpo -c 
../../../lib/stub_memaccount.c  -fPIC -DPIC -o stub_memaccount.o >/dev/null 2>&1
libtool: compile:  ccache g++ -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 
-I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Wshadow -Woverloaded-virtual -Werror -Wno-deprecated-register -pipe 
-D_REENTRANT -I/usr/include/p11-kit-1 -g -O2 -MT Splay.lo -MD -MP -MF 
.deps/Splay.Tpo -c ../../../lib/Splay.cc  -fPIC -DPIC -o Splay.o >/dev/null 2>&1
/bin/bash ../libtool  --tag=CC   --mode=link ccache gcc -Wall -Wpointer-arith 
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow 
-Werror -pipe -D_REENTRANT -Wall -g -O2  -g -o libmiscencoding.la  base64.lo 
charset.lo html_quote.lo md5.lo rfc1738.lo rfc2617.lo uudecode.lo  
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o .libs/util.o
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmisccontainers.la  hash.lo  
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o util.o >/dev/null 2>&1
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o 
.libs/xusleep.o
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o xusleep.o 
>/dev/null 2>&1
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmiscutil.la  getfullhostname.lo heap.lo iso3307.lo radix.lo 
rfc1123.lo Splay.lo stub_memaccount.lo util.lo xusleep.lo  
libtool: link: /usr/bin/ar cru .libs/libmiscencoding.a .libs/base64.o 
.libs/charset.o .libs/html_quote.o .libs/md5.o .libs/rfc1738.o .libs/rfc2617.o 
.libs/uudecode.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libmiscencoding.a
libtool: link: ( cd ".libs" && rm -f "libmiscencoding.la" && ln -s 
"../libmiscencoding.la" "libmiscencoding.la" )
libtool: link: /usr/bin/ar cru .libs/libmisccontainers.a .libs/hash.o 
/usr/bin/ar: `u' modifier ignored 

[squid-dev] [PATCH] Segfault via Ftp::Client::readControlReply.

2016-11-10 Thread Christos Tsantilas


Added nil dereference checks for Ftp::Client::ctrl.conn, including:
- Ftp::Client::handlePasvReply() and handleEpsvReply() that dereference 
ctrl.conn in DBG_IMPORTANT messages.

- Many functions inside FtpClient.cc and FtpGateway.cc files.

TODO: We need to find a better way to handle nil ctrl.conn. It is only a 
matter of time when we forget to add another dereference check or 
discover a place we missed during this change.


Also disabled forwarding of EPRT and PORT commands to origin servers. 
Squid support for those commands is broken and their forwarding may 
cause segfaults (bug #4004). Active FTP is still supported, of course.


This is a Measurement Factory project.
Segfault via Ftp::Client::readControlReply.

Added nil dereference checks for Ftp::Client::ctrl.conn, including:
- Ftp::Client::handlePasvReply() and handleEpsvReply() that dereference
  ctrl.conn in DBG_IMPORTANT messages.
- Many functions inside FtpClient.cc and FtpGateway.cc files.

TODO: We need to find a better way to handle nil ctrl.conn. It is only
a matter of time when we forget to add another dereference check or
discover a place we missed during this change.

Also disabled forwarding of EPRT and PORT commands to origin servers.
Squid support for those commands is broken and their forwarding may
cause segfaults (bug #4004). Active FTP is still supported, of course.

This is a Measurement Factory project.

=== modified file 'src/clients/FtpClient.cc'
--- src/clients/FtpClient.cc	2016-07-27 08:18:03 +
+++ src/clients/FtpClient.cc	2016-11-10 16:17:11 +
@@ -425,71 +425,81 @@
 if (ctrl.offset == bytes_used) {
 /* used it all up */
 ctrl.offset = 0;
 } else {
 /* Got some data past the complete reply */
 assert(bytes_used < ctrl.offset);
 ctrl.offset -= bytes_used;
 memmove(ctrl.buf, ctrl.buf + bytes_used, ctrl.offset);
 }
 
 debugs(9, 3, "state=" << state << ", code=" << ctrl.replycode);
 }
 
 bool
 Ftp::Client::handlePasvReply(Ip::Address )
 {
 int code = ctrl.replycode;
 char *buf;
 debugs(9, 3, status());
 
+if (!Comm::IsConnOpen(ctrl.conn)) {
+debugs(9, 5, "The control connection to the remote end is closed");
+return false;
+}
+
 if (code != 227) {
 debugs(9, 2, "PASV not supported by remote end");
 return false;
 }
 
 /*  227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).  */
 /*  ANSI sez [^0-9] is undefined, it breaks on Watcom cc */
 debugs(9, 5, "scanning: " << ctrl.last_reply);
 
 buf = ctrl.last_reply + strcspn(ctrl.last_reply, "0123456789");
 
 const char *forceIp = Config.Ftp.sanitycheck ?
   fd_table[ctrl.conn->fd].ipaddr : NULL;
 if (!Ftp::ParseIpPort(buf, forceIp, srvAddr)) {
 debugs(9, DBG_IMPORTANT, "Unsafe PASV reply from " <<
ctrl.conn->remote << ": " << ctrl.last_reply);
 return false;
 }
 
 data.addr(srvAddr);
 
 return true;
 }
 
 bool
 Ftp::Client::handleEpsvReply(Ip::Address )
 {
 int code = ctrl.replycode;
 char *buf;
 debugs(9, 3, status());
 
+if (!Comm::IsConnOpen(ctrl.conn)) {
+debugs(9, 5, "The control connection to the remote end is closed");
+return false;
+}
+
 if (code != 229 && code != 522) {
 if (code == 200) {
 /* handle broken servers (RFC 2428 says OK code for EPSV MUST be 229 not 200) */
 /* vsftpd for one send '200 EPSV ALL ok.' without even port info.
  * Its okay to re-send EPSV 1/2 but nothing else. */
 debugs(9, DBG_IMPORTANT, "Broken FTP Server at " << ctrl.conn->remote << ". Wrong accept code for EPSV");
 } else {
 debugs(9, 2, "EPSV not supported by remote end");
 }
 return sendPassive();
 }
 
 if (code == 522) {
 /* Peer responded with a list of supported methods:
  *   522 Network protocol not supported, use (1)
  *   522 Network protocol not supported, use (1,2)
  *   522 Network protocol not supported, use (2)
  * TODO: Handle the (1,2) case which may happen after EPSV ALL. Close
  * data + control without self-destructing and re-open from scratch.
  */
@@ -718,40 +728,45 @@
 }
 }
 break;
 }
 }
 
 if (ctrl.message)
 wordlistDestroy();
 ctrl.message = NULL; //No message to return to client.
 ctrl.offset = 0; //reset readed response, to make room read the next response
 
 writeCommand(mb.content());
 
 shortenReadTimeout = true;
 return true;
 }
 
 void
 Ftp::Client::connectDataChannel()
 {
+if (!Comm::IsConnOpen(ctrl.conn)) {
+debugs(9, 5, "The control connection to the remote end is closed");
+return;
+}
+
 safe_free(ctrl.last_command);
 
 safe_free(ctrl.last_reply);
 
 ctrl.last_command = xstrdup("Connect to server data port");
 
 // Generate a new data channel 

[squid-dev] Build failed in Jenkins: 5-matrix » gcc,d-debian-unstable #2

2016-11-10 Thread noc
http://build.squid-cache.org/job/5-matrix/compiler=gcc,label=d-debian-unstable/2/--
[...truncated 32111 lines...]
depbase=`echo xusleep.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ../libtool  --tag=CC   --mode=compile ccache gcc -DHAVE_CONFIG_H   
-I../../.. -I../../../include -I../../../lib -I../../../src -I../include
-I/usr/include/libxml2  -Wall -Wpointer-arith -Wwrite-strings 
-Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow -Werror -pipe 
-D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD -MP -MF $depbase.Tpo -c -o 
xusleep.lo ../../../lib/xusleep.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT 
stub_memaccount.lo -MD -MP -MF .deps/stub_memaccount.Tpo -c 
../../../lib/stub_memaccount.c  -fPIC -DPIC -o stub_memaccount.o >/dev/null 2>&1
libtool: compile:  ccache g++ -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 
-I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Wshadow -Woverloaded-virtual -Werror -Wno-deprecated-register -pipe 
-D_REENTRANT -I/usr/include/p11-kit-1 -g -O2 -MT Splay.lo -MD -MP -MF 
.deps/Splay.Tpo -c ../../../lib/Splay.cc  -fPIC -DPIC -o .libs/Splay.o
/bin/bash ../libtool  --tag=CC   --mode=link ccache gcc -Wall -Wpointer-arith 
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow 
-Werror -pipe -D_REENTRANT -Wall -g -O2  -g -o libmiscencoding.la  base64.lo 
charset.lo html_quote.lo md5.lo rfc1738.lo rfc2617.lo uudecode.lo  
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o .libs/util.o
libtool: compile:  ccache g++ -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 
-I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments 
-Wshadow -Woverloaded-virtual -Werror -Wno-deprecated-register -pipe 
-D_REENTRANT -I/usr/include/p11-kit-1 -g -O2 -MT Splay.lo -MD -MP -MF 
.deps/Splay.Tpo -c ../../../lib/Splay.cc  -fPIC -DPIC -o Splay.o >/dev/null 2>&1
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT util.lo -MD -MP 
-MF .deps/util.Tpo -c ../../../lib/util.c  -fPIC -DPIC -o util.o >/dev/null 2>&1
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmisccontainers.la  hash.lo  
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o 
.libs/xusleep.o
libtool: compile:  ccache gcc -DHAVE_CONFIG_H -I../../.. -I../../../include 
-I../../../lib -I../../../src -I../include -I/usr/include/libxml2 -Wall 
-Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations 
-Wcomments -Wshadow -Werror -pipe -D_REENTRANT -Wall -g -O2 -MT xusleep.lo -MD 
-MP -MF .deps/xusleep.Tpo -c ../../../lib/xusleep.c  -fPIC -DPIC -o xusleep.o 
>/dev/null 2>&1
/bin/bash ../libtool  --tag=CXX   --mode=link ccache g++ -I/usr/include/libxml2 
-Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual 
-Werror -Wno-deprecated-register -pipe -D_REENTRANT -I/usr/include/p11-kit-1 -g 
-O2  -g -o libmiscutil.la  getfullhostname.lo heap.lo iso3307.lo radix.lo 
rfc1123.lo Splay.lo stub_memaccount.lo util.lo xusleep.lo  
libtool: link: /usr/bin/ar cru .libs/libmiscencoding.a .libs/base64.o 
.libs/charset.o .libs/html_quote.o .libs/md5.o .libs/rfc1738.o .libs/rfc2617.o 
.libs/uudecode.o 
/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libmiscencoding.a
libtool: link: ( cd ".libs" && rm -f "libmiscencoding.la" && ln -s 
"../libmiscencoding.la" "libmiscencoding.la" )
libtool: link: /usr/bin/ar cru .libs/libmisccontainers.a .libs/hash.o 
/usr/bin/ar: `u' modifier ignored