Bug 1320721

Summary: lftp crash when mirroring over a http proxy
Product: Red Hat Enterprise Linux 6 Reporter: Paulo Andrade <pandrade>
Component: lftpAssignee: Michal Ruprich <mruprich>
Status: CLOSED ERRATA QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.7CC: bnater, jkejda, thozza
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: lftp-4.0.9-13.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-21 11:00:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1269194, 1356054, 1359261    
Attachments:
Description Flags
Patch none

Description Paulo Andrade 2016-03-23 19:56:19 UTC
Problem reported upstream as:

"""
Command slightly edited is:
exec /usr/bin/lftp -c 'set ssl:ca-file "/etc/$dir/$file.pem"; set ssl:key-file "/etc/$dir/$file.pem"; set ssl:cert-file "/etc/$dir/$otherfile.pem"; set https:proxy http://example.com:8080; debug; set net:timeout 86400; mirror -c -P -v -v -v -e -I *.rpm -X "/headers/" -X "/repodata/" -X "*.src.rpm" -X "/SRPMS/" -X "*-debuginfo-*.rpm" -X "/debug/" https://the/path/ /other/path'

After some debug, and trial and error, it was found that this patch corrects the problem:

diff -up lftp-4.0.9/src/Http.h.orig lftp-4.0.9/src/Http.h
--- lftp-4.0.9/src/Http.h.orig  2016-03-22 14:56:33.012073459 -0300
+++ lftp-4.0.9/src/Http.h   2016-03-22 14:57:47.116895185 -0300
@@ -83,11 +83,7 @@ class Http : public NetAccess
    void MoveConnectionHere(Http *o);
    int IsConnected() const
       {
-    if(sock==-1)
-       return 0;
-    if(state==CONNECTING)
-       return 1;
-    return 2;
+    return state!=DISCONNECTED || tunnel_state!=NO_TUNNEL;
       }
 #if USE_SSL
    Ref<lftp_ssl> ssl;

The crash backtrace looked like this:

(gdb) bt full
#0  lftp_ssl_gnutls::read (this=0x0, buf=0x21e98e0 "", size=65536)
    at lftp_ssl.cc:531
        res = <value optimized out>
#1  0x00007fe62fa94b0f in IOBufferSSL::Get_LL (this=0x22714c0, 
    size=<value optimized out>) at buffer_ssl.cc:85
        res = <value optimized out>
#2  0x00007fe62fa94c04 in IOBufferSSL::Do (this=0x22714c0) at buffer_ssl.cc:57
        res = 0
#3  0x00007fe6371ebfc4 in SMTask::Schedule () at SMTask.cc:238
        scan = 0x22714c0
        timer_timeout = <value optimized out>
        res = <value optimized out>
#4  0x00007fe63747c4cd in Job::WaitDone (this=0x1a4fd00) at Job.cc:494
No locals.
#5  0x0000000000405af5 in main (argc=<value optimized out>, 
    argv=<value optimized out>) at lftp.cc:479
        home = <value optimized out>
        args = {ptr = 0x0, static null = <optimized out>}
        exit_code = <value optimized out>
"""

Comment 1 Paulo Andrade 2016-03-23 19:57:45 UTC
Upstream bug report at https://github.com/lavv17/lftp/issues/220

Comment 4 Michal Ruprich 2016-10-11 07:33:46 UTC
Created attachment 1209030 [details]
Patch

The suggested solution from #c1 solves the problem. I added the patch as an attachment.

Comment 9 errata-xmlrpc 2017-03-21 11:00:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0701.html