[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#617690: [PATCH] Fix #617690 (APT::Get::AllowUnauthenticated=true always



I seem to fix this issue with the following patch:

 

From bf771923a40a8ba9046643b48a8aa678ecd5d9bc Mon Sep 17 00:00:00 2001

From: Vadim Markovtsev <v.markovtsev@samsung.com>

Date: Thu, 19 Sep 2013 17:20:33 +0400

Subject: [PATCH] Fix #617690 (APT::Get::AllowUnauthenticated=true always

causes warning "packages cannot be authenticated")

 

Signed-off-by: Vadim Markovtsev <v.markovtsev@samsung.com>

---

apt-pkg/acquire-item.cc        | 14 +++++++++++++-

apt-pkg/acquire-item.h         | 12 ++++++++++++

apt-private/private-install.cc |  2 +-

3 files changed, 26 insertions(+), 2 deletions(-)

 

diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc

index 97b2d1e..2b9f9d7 100644

--- a/apt-pkg/acquire-item.cc

+++ b/apt-pkg/acquire-item.cc

@@ -1679,7 +1679,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,

                                                   string &StoreFilename) :

                Item(Owner), Version(Version), Sources(Sources), Recs(Recs),

                StoreFilename(StoreFilename), Vf(Version.FileList()),

-                     Trusted(false)

+                    Trusted(false), UntrustedOldBehavior(false)

{

    Retries = _config->FindI("Acquire::Retries",0);

@@ -1740,7 +1740,11 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,

    // that means that e.g. unauthenticated file:// uris are higher

    // priority than authenticated http:// uris

    if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)

+   {

       Trusted = false;

+      // Avoid printing useless warnings in CheckAuth (private-install.cc)

+      UntrustedOldBehavior = true;

+   }

    // Select a source

    if (QueueNext() == false && _error->PendingError() == false)

@@ -1988,6 +1992,14 @@ bool pkgAcqArchive::IsTrusted()

    return Trusted;

}

                                                                                                                                            /*}}}*/

+// AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source

+// but actually set as untrusted due to APT::Get::AllowUnauthenticated setting /*{{{*/

+// ---------------------------------------------------------------------

+bool pkgAcqArchive::IsUntrustedOldBehavior()

+{

+  return UntrustedOldBehavior;

+}

+                  /*}}}*/

// AcqArchive::Finished - Fetching has finished, tidy up                              /*{{{*/

// ---------------------------------------------------------------------

/* */

diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h

index 10c855e..ce8b3bf 100644

--- a/apt-pkg/acquire-item.h

+++ b/apt-pkg/acquire-item.h

@@ -253,6 +253,12 @@ class pkgAcquire::Item : public WeakPointable

    /** \return \b true if this object is being fetched from a trusted source. */

    virtual bool IsTrusted() {return false;};

    

+   /** \return \b true if this object is being fetched from a trusted source,

+    *  but set as untrusted due to APT::Get::AllowUnauthenticated setting to

+    *  restore apts old fetching behavior.

+    */

+   virtual bool IsUntrustedOldBehavior() {return false;};

+

    // report mirror problems

    /** \brief Report mirror problem

     *

@@ -955,6 +961,11 @@ class pkgAcqArchive : public pkgAcquire::Item

     */

    bool Trusted;

 

+   /** \brief \b true if this version file is actually trusted, but set as

+    *  untrusted due to APT::Get::AllowUnauthenticated setting.

+    */

+   bool UntrustedOldBehavior;

+

    /** \brief Queue up the next available file for this version. */

    bool QueueNext();

   

@@ -968,6 +979,7 @@ class pkgAcqArchive : public pkgAcquire::Item

    virtual void Finished();

    virtual std::string HashSum() {return ExpectedHash.toStr(); };

    virtual bool IsTrusted();

+   virtual bool IsUntrustedOldBehavior();

   

    /** \brief Create a new pkgAcqArchive.

     *

diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc

index 9808c3d..c1e3016 100644

--- a/apt-private/private-install.cc

+++ b/apt-private/private-install.cc

@@ -58,7 +58,7 @@ static bool CheckAuth(pkgAcquire& Fetcher)

    std::string UntrustedList;

    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd(); ++I)

    {

-      if (!(*I)->IsTrusted())

+      if (!(*I)->IsTrusted() && !(*I)->IsUntrustedOldBehavior())

       {

           UntrustedList += std::string((*I)->ShortDesc()) + " ";

       }

--

1.8.1.2


Reply to: