Ignore the (unrouteable) FTP passive-mode IP address given by v2.13.157
authorCarl Hetherington <cth@carlh.net>
Mon, 29 Apr 2019 20:59:33 +0000 (21:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 29 Apr 2019 20:59:33 +0000 (21:59 +0100)
the Dolby certificate server (#1541).

src/lib/internet.cc
src/lib/internet.h
src/wx/barco_alchemy_certificate_panel.cc
src/wx/christie_certificate_panel.cc
src/wx/dolby_doremi_certificate_panel.cc
src/wx/gdc_certificate_panel.cc
src/wx/swaroop_controls.cc

index 4eba1efa3ada8762fc80a60ec684fa032c23ca6c..e0af49b6698e64c75148ec5ecfddee14e1c75969 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -48,7 +48,7 @@ get_from_url_data (void* buffer, size_t size, size_t nmemb, void* stream)
 }
 
 optional<string>
-get_from_url (string url, bool pasv, ScopedTemporary& temp)
+get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp)
 {
        CURL* curl = curl_easy_init ();
        curl_easy_setopt (curl, CURLOPT_URL, url.c_str());
@@ -58,6 +58,9 @@ get_from_url (string url, bool pasv, ScopedTemporary& temp)
        curl_easy_setopt (curl, CURLOPT_WRITEDATA, f);
        curl_easy_setopt (curl, CURLOPT_FTP_USE_EPSV, 0);
        curl_easy_setopt (curl, CURLOPT_FTP_USE_EPRT, 0);
+       if (skip_pasv_ip) {
+               curl_easy_setopt (curl, CURLOPT_FTP_SKIP_PASV_IP, 1);
+       }
        if (!pasv) {
                curl_easy_setopt (curl, CURLOPT_FTPPORT, "-");
        }
@@ -77,10 +80,10 @@ get_from_url (string url, bool pasv, ScopedTemporary& temp)
 }
 
 optional<string>
-get_from_url (string url, bool pasv, function<void (boost::filesystem::path)> load)
+get_from_url (string url, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load)
 {
        ScopedTemporary temp;
-       optional<string> e = get_from_url (url, pasv, temp);
+       optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp);
        if (e) {
                return e;
        }
@@ -93,11 +96,11 @@ get_from_url (string url, bool pasv, function<void (boost::filesystem::path)> lo
  *  @param load Function passed a (temporary) filesystem path of the unpacked file.
  */
 optional<string>
-get_from_zip_url (string url, string file, bool pasv, function<void (boost::filesystem::path)> load)
+get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, function<void (boost::filesystem::path)> load)
 {
        /* Download the ZIP file to temp_zip */
        ScopedTemporary temp_zip;
-       optional<string> e = get_from_url (url, pasv, temp_zip);
+       optional<string> e = get_from_url (url, pasv, skip_pasv_ip, temp_zip);
        if (e) {
                return e;
        }
index 101eaeae969bf3ae50d1cf4af3a5c75fd18c89d0..125533b5d7e39aa21741c2b370d3c36fadd66db6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -24,6 +24,6 @@
 
 class ScopedTemporary;
 
-boost::optional<std::string> get_from_url (std::string url, bool pasv, ScopedTemporary& temp);
-boost::optional<std::string> get_from_url (std::string url, bool pasv, boost::function<void (boost::filesystem::path)> load);
-boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, boost::function<void (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp);
+boost::optional<std::string> get_from_url (std::string url, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
+boost::optional<std::string> get_from_zip_url (std::string url, std::string file, bool pasv, bool skip_pasv_ip, boost::function<void (boost::filesystem::path)> load);
index ba7deb8fd001a9d845f9ac0b11d29b181e326087..84048c65cf98d97b767577668d14e489e9dad93c 100644 (file)
@@ -60,7 +60,7 @@ BarcoAlchemyCertificatePanel::do_download ()
                serial
                );
 
-       optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+       optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
        if (error) {
                _dialog->message()->SetLabel(wxT(""));
                error_dialog (this, std_to_wx(*error));
index fa91cc2b594ae2f79deb7ded0687634686bfca10..9e95aa994531a728a989d153b560bb25e2cd6652 100644 (file)
@@ -57,13 +57,13 @@ ChristieCertificatePanel::do_download ()
 
        optional<string> all_errors;
 
-       optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+       optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
        if (error) {
                all_errors = *error;
 
                string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial);
 
-               error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+               error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
                if (error) {
                        *all_errors += "\n" + *error;
                }
index ea0207a9ba067875decfd86654c4707e85b1b947..c37b42e43796193d4fe1276094aca11ab77a7b70 100644 (file)
@@ -177,7 +177,7 @@ DolbyDoremiCertificatePanel::do_download ()
        list<string>::const_iterator i = urls.begin ();
        list<string>::const_iterator j = files.begin ();
        while (!ok && i != urls.end ()) {
-               optional<string> error = get_from_zip_url (*i++, *j++, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+               optional<string> error = get_from_zip_url (*i++, *j++, true, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
                if (error) {
                        errors.push_back (error.get ());
                } else {
index a90f098f51b8e16874d9255cfd70a8763e2fbdf3..b0bb31674458fc7711a7c6bf634660f1ba73dcb9 100644 (file)
@@ -51,7 +51,7 @@ GDCCertificatePanel::do_download ()
                wx_to_std(_serial->GetValue())
                );
 
-       optional<string> error = get_from_url (url, true, boost::bind (&DownloadCertificatePanel::load, this, _1));
+       optional<string> error = get_from_url (url, true, false, boost::bind (&DownloadCertificatePanel::load, this, _1));
 
        if (error) {
                _dialog->message()->SetLabel(wxT(""));
index 78419a08c3b8e0ef08ca0bf017b61ebf5e71c59f..33db37babb57f1bedecaab84a2e50e5b055a9344 100644 (file)
@@ -348,7 +348,7 @@ SwaroopControls::get_kdm_from_url (shared_ptr<DCPContent> dcp)
        string url = Config::instance()->kdm_server_url();
        boost::algorithm::replace_all (url, "{CPL}", *dcp->cpl());
        optional<dcp::EncryptedKDM> kdm;
-       if (dcp->cpl() && !get_from_url(url, false, temp)) {
+       if (dcp->cpl() && !get_from_url(url, false, false, temp)) {
                try {
                        kdm = dcp::EncryptedKDM (dcp::file_to_string(temp.file()));
                        if (kdm->cpl_id() != dcp->cpl()) {