From: Michael Vogt <michael.vogt@ubuntu.com>
Date: Fri, 16 Oct 2009 13:42:05 +0000 (+0200)
Subject: add maybe_add_auth for ftp as well
X-Git-Tag: 0.7.24ubuntu1~1^2^2~3
X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/1de1f70383ea2d44147ccaceff280fd70faf4c81?ds=inline;hp=--cc

add maybe_add_auth for ftp as well
---

1de1f70383ea2d44147ccaceff280fd70faf4c81
diff --git a/methods/ftp.cc b/methods/ftp.cc
index c91600ad5..eb398666f 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -982,7 +982,9 @@ bool FtpMethod::Fetch(FetchItem *Itm)
    FetchResult Res;
    Res.Filename = Itm->DestFile;
    Res.IMSHit = false;
-   
+
+   maybe_add_auth (Get, _config->FindFile("Dir::Etc::netrc"));
+
    // Connect to the server
    if (Server == 0 || Server->Comp(Get) == false)
    {
diff --git a/methods/http.cc b/methods/http.cc
index 6bfe80baf..50478b44c 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -725,9 +725,9 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
       Req += string("Proxy-Authorization: Basic ") + 
           Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n";
 
+   maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
    if (Uri.User.empty() == false || Uri.Password.empty() == false)
    {
-      maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
       Req += string("Authorization: Basic ") + 
           Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
    }
diff --git a/methods/https.cc b/methods/https.cc
index a86c78029..075d655b7 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -127,7 +127,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    curl_easy_reset(curl);
    SetupProxy();
 
-   maybe_add_auth (Uri, _config->FindFile("Dir::ETc::netrc"));
+   maybe_add_auth (Uri, _config->FindFile("Dir::Etc::netrc"));
 
    // callbacks
    curl_easy_setopt(curl, CURLOPT_URL, Itm->Uri.c_str());