summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc51
-rw-r--r--apt-pkg/acquire-item.h4
-rw-r--r--apt-pkg/init.h4
-rw-r--r--apt-pkg/makefile2
4 files changed, 51 insertions, 10 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 197cbf786..c6a49653b 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -862,7 +862,7 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
const vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser) :
Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false),
- MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
+ MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets), IMSHit(false)
{
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
@@ -955,6 +955,9 @@ void pkgAcqMetaIndex::RetrievalDone(string Message)
return;
}
+ // see if the download was a IMSHit
+ IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false);
+
Complete = true;
string FinalFile = _config->FindDir("Dir::State::lists");
@@ -983,7 +986,7 @@ void pkgAcqMetaIndex::AuthDone(string Message)
return;
}
- if (!VerifyVendor())
+ if (!VerifyVendor(Message))
{
return;
}
@@ -1041,7 +1044,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)
}
}
-bool pkgAcqMetaIndex::VerifyVendor()
+bool pkgAcqMetaIndex::VerifyVendor(string Message)
{
// // Maybe this should be made available from above so we don't have
// // to read and parse it every time?
@@ -1066,6 +1069,22 @@ bool pkgAcqMetaIndex::VerifyVendor()
// break;
// }
// }
+ string::size_type pos;
+
+ // check for missing sigs (that where not fatal because otherwise we had
+ // bombed earlier)
+ string missingkeys;
+ string msg = _("There are no public key available for the "
+ "following key IDs:\n");
+ pos = Message.find("NO_PUBKEY ");
+ if (pos != std::string::npos)
+ {
+ string::size_type start = pos+strlen("NO_PUBKEY ");
+ string Fingerprint = Message.substr(start, Message.find("\n")-start);
+ missingkeys += (Fingerprint);
+ }
+ if(!missingkeys.empty())
+ _error->Warning("%s", string(msg+missingkeys).c_str());
string Transformed = MetaIndexParser->GetExpectedDist();
@@ -1074,7 +1093,7 @@ bool pkgAcqMetaIndex::VerifyVendor()
Transformed = "experimental";
}
- string::size_type pos = Transformed.rfind('/');
+ pos = Transformed.rfind('/');
if (pos != string::npos)
{
Transformed = Transformed.substr(0, pos);
@@ -1120,10 +1139,30 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
if (AuthPass == true)
{
- // gpgv method failed
+ // if we fail the authentication but got the file via a IMS-Hit
+ // this means that the file wasn't downloaded and that it might be
+ // just stale (server problem, proxy etc). we delete what we have
+ // queue it again without i-m-s
+ // alternatively we could just unlink the file and let the user try again
+ if (IMSHit)
+ {
+ Complete = false;
+ Local = false;
+ AuthPass = false;
+ unlink(DestFile.c_str());
+
+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
+ DestFile += URItoFileName(RealURI);
+ Desc.URI = RealURI;
+ QueueURI(Desc);
+ return;
+ }
+
+ // gpgv method failed
_error->Warning("GPG error: %s: %s",
Desc.Description.c_str(),
LookupTag(Message,"Message").c_str());
+
}
// No Release file was present, or verification failed, so fall
@@ -1469,7 +1508,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
else
PartialSize = Buf.st_size;
}
-
+
QueueURI(Desc);
}
/*}}}*/
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 58c915344..217ddb3ef 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -691,13 +691,15 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
/** \brief If \b true, the index's signature is currently being verified.
*/
bool AuthPass;
+ // required to deal gracefully with problems caused by incorrect ims hits
+ bool IMSHit;
/** \brief Check that the release file is a release file for the
* correct distribution.
*
* \return \b true if no fatal errors were encountered.
*/
- bool VerifyVendor();
+ bool VerifyVendor(string Message);
/** \brief Called when a file is finished being retrieved.
*
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index 8255b406a..63547619f 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -17,8 +17,8 @@
#include <apt-pkg/pkgsystem.h>
// See the makefile
-#define APT_PKG_MAJOR 3
-#define APT_PKG_MINOR 11
+#define APT_PKG_MAJOR 4
+#define APT_PKG_MINOR 0
#define APT_PKG_RELEASE 0
extern const char *pkgVersion;
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index 0e6aecc65..fa0efe5b2 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -13,7 +13,7 @@ include ../buildlib/defaults.mak
# methods/makefile - FIXME
LIBRARY=apt-pkg
LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
-MAJOR=3.11
+MAJOR=4.0
MINOR=0
SLIBS=$(PTHREADLIB) $(INTLLIBS)
APT_DOMAIN:=libapt-pkg$(MAJOR)