diff options
-rw-r--r-- | apt-pkg/acquire-item.cc | 13 | ||||
-rw-r--r-- | apt-pkg/cachefilter.h | 61 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 20 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 3 | ||||
-rw-r--r-- | apt-pkg/contrib/netrc.cc | 12 | ||||
-rw-r--r-- | apt-pkg/contrib/netrc.h | 4 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.cc | 125 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 2 | ||||
-rw-r--r-- | apt-pkg/init.h | 2 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 4 | ||||
-rw-r--r-- | apt-pkg/pkgcache.h | 2 | ||||
-rw-r--r-- | apt-pkg/srcrecords.h | 1 | ||||
-rw-r--r-- | apt-private/private-list.cc | 8 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 11 | ||||
-rw-r--r-- | debian/apt.install.in | 4 | ||||
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/libapt-pkg4.13.install.in (renamed from debian/libapt-pkg4.12.install.in) | 0 | ||||
-rw-r--r-- | debian/libapt-pkg4.13.symbols (renamed from debian/libapt-pkg4.12.symbols) | 2 | ||||
-rwxr-xr-x | test/integration/skip-aptwebserver | 25 | ||||
-rwxr-xr-x | test/integration/test-debsrc-hashes | 77 | ||||
-rw-r--r-- | test/interactive-helper/makefile | 2 |
22 files changed, 239 insertions, 154 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 36bb48382..230d5aba9 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1417,9 +1417,20 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash, / } else { + // FIXME: move this into pkgAcqMetaClearSig::Done on the next + // ABI break + + // if we expect a ClearTextSignature (InRelase), ensure that + // this is what we get and if not fail to queue a + // Release/Release.gpg, see #346386 + if (SigFile == DestFile && !StartsWithGPGClearTextSignature(DestFile)) + { + Failed(Message, Cfg); + return; + } + // There was a signature file, so pass it to gpgv for // verification - if (_config->FindB("Debug::pkgAcquire::Auth", false)) std::cerr << "Metaindex acquired, queueing gpg verification (" << SigFile << "," << DestFile << ")\n"; diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h index 34b7d0b46..8e8776ed9 100644 --- a/apt-pkg/cachefilter.h +++ b/apt-pkg/cachefilter.h @@ -15,66 +15,6 @@ namespace APT { namespace CacheFilter { -#define PACKAGE_MATCHER_ABI_COMPAT 1 -#ifdef PACKAGE_MATCHER_ABI_COMPAT - -// PackageNameMatchesRegEx /*{{{*/ -class PackageNameMatchesRegEx { - /** \brief dpointer placeholder (for later in case we need it) */ - void *d; - regex_t* pattern; -public: - PackageNameMatchesRegEx(std::string const &Pattern); - bool operator() (pkgCache::PkgIterator const &Pkg); - bool operator() (pkgCache::GrpIterator const &Grp); - ~PackageNameMatchesRegEx(); -}; - /*}}}*/ -// PackageNameMatchesFnmatch /*{{{*/ - class PackageNameMatchesFnmatch { - /** \brief dpointer placeholder (for later in case we need it) */ - void *d; - const std::string Pattern; -public: - PackageNameMatchesFnmatch(std::string const &Pattern) - : Pattern(Pattern) {}; - bool operator() (pkgCache::PkgIterator const &Pkg); - bool operator() (pkgCache::GrpIterator const &Grp); - ~PackageNameMatchesFnmatch() {}; -}; - /*}}}*/ -// PackageArchitectureMatchesSpecification /*{{{*/ -/** \class PackageArchitectureMatchesSpecification - \brief matching against architecture specification strings - - The strings are of the format <kernel>-<cpu> where either component, - or the whole string, can be the wildcard "any" as defined in - debian-policy §11.1 "Architecture specification strings". - - Examples: i386, mipsel, linux-any, any-amd64, any */ -class PackageArchitectureMatchesSpecification { - std::string literal; - std::string complete; - bool isPattern; - /** \brief dpointer placeholder (for later in case we need it) */ - void *d; -public: - /** \brief matching against architecture specification strings - * - * @param pattern is the architecture specification string - * @param isPattern defines if the given \b pattern is a - * architecture specification pattern to match others against - * or if it is the fixed string and matched against patterns - */ - PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true); - bool operator() (char const * const &arch); - bool operator() (pkgCache::PkgIterator const &Pkg); - bool operator() (pkgCache::VerIterator const &Ver); - ~PackageArchitectureMatchesSpecification(); -}; - -#else - class PackageMatcher { public: virtual bool operator() (pkgCache::PkgIterator const &Pkg) { return false; }; @@ -138,7 +78,6 @@ public: virtual bool operator() (pkgCache::VerIterator const &Ver); virtual ~PackageArchitectureMatchesSpecification(); }; -#endif /*}}}*/ } } diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52411a762..9da5ac84e 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -874,6 +874,26 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap) } /*}}}*/ +// StartsWithGPGClearTextSignature - Check if a file is Pgp/GPG clearsigned /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool StartsWithGPGClearTextSignature(string const &FileName) +{ + static const char* SIGMSG = "-----BEGIN PGP SIGNED MESSAGE-----\n"; + char buffer[strlen(SIGMSG)+1]; + FILE* gpg = fopen(FileName.c_str(), "r"); + if (gpg == NULL) + return false; + + char const * const test = fgets(buffer, sizeof(buffer), gpg); + fclose(gpg); + if (test == NULL || strcmp(buffer, SIGMSG) != 0) + return false; + + return true; +} + + // FileFd::Open - Open a file /*{{{*/ // --------------------------------------------------------------------- /* The most commonly used open mode combinations are given with Mode */ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index e752e9621..58a90e83b 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -189,6 +189,9 @@ pid_t ExecFork(std::set<int> keep_fds); void MergeKeepFdsFromConfiguration(std::set<int> &keep_fds); bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); +// check if the given file starts with a PGP cleartext signature +bool StartsWithGPGClearTextSignature(std::string const &FileName); + // File string manipulators std::string flNotDir(std::string File); std::string flNotFile(std::string File); diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index de95aa4ab..e61a82f8c 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -153,18 +153,6 @@ static int parsenetrc_string (char *host, std::string &login, std::string &passw return retcode; } -// for some unknown reason this method is exported so keep a compatible interface for now … -int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL) -{ - std::string login_string, password_string; - int const ret = parsenetrc_string(host, login_string, password_string, netrcfile); - if (ret < 0) - return ret; - strncpy(login, login_string.c_str(), LOGINSIZE - 1); - strncpy(password, password_string.c_str(), PASSWORDSIZE - 1); - return ret; -} - void maybe_add_auth (URI &Uri, string NetRCFile) { diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h index 6feb5b726..7349126c4 100644 --- a/apt-pkg/contrib/netrc.h +++ b/apt-pkg/contrib/netrc.h @@ -25,9 +25,5 @@ class URI; -// kill this export on the next ABI break - strongly doubt its in use anyway -// outside of the apt itself, its really a internal interface -__deprecated int parsenetrc (char *host, char *login, char *password, char *filename); - void maybe_add_auth (URI &Uri, std::string NetRCFile); #endif diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index ce55ccd1f..f5fb2da4a 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -17,6 +17,7 @@ #include <apt-pkg/strutl.h> #include <apt-pkg/configuration.h> #include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/hashes.h> using std::max; /*}}}*/ @@ -114,64 +115,86 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List) { List.erase(List.begin(),List.end()); + + // map from the Hashsum field to the hashsum function, + // unfortunately this is not a 1:1 mapping from + // Hashes::SupporedHashes as e.g. Files is a historic name for the md5 + const std::pair<const char*, const char*> SourceHashFields[] = { + std::make_pair( "Checksums-Sha512", "SHA512"), + std::make_pair( "Checksums-Sha256", "SHA256"), + std::make_pair( "Checksums-Sha1", "SHA1"), + std::make_pair( "Files", "MD5Sum"), // historic Name + }; - string Files = Sect.FindS("Files"); - if (Files.empty() == true) - return false; + for (unsigned int i=0; + i < sizeof(SourceHashFields)/sizeof(SourceHashFields[0]); + i++) + { + string Files = Sect.FindS(SourceHashFields[i].first); + if (Files.empty() == true) + continue; - // Stash the / terminated directory prefix - string Base = Sect.FindS("Directory"); - if (Base.empty() == false && Base[Base.length()-1] != '/') - Base += '/'; + // Stash the / terminated directory prefix + string Base = Sect.FindS("Directory"); + if (Base.empty() == false && Base[Base.length()-1] != '/') + Base += '/'; - std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions(); + std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions(); - // Iterate over the entire list grabbing each triplet - const char *C = Files.c_str(); - while (*C != 0) - { - pkgSrcRecords::File F; - string Size; - - // Parse each of the elements - if (ParseQuoteWord(C,F.MD5Hash) == false || - ParseQuoteWord(C,Size) == false || - ParseQuoteWord(C,F.Path) == false) - return _error->Error("Error parsing file record"); - - // Parse the size and append the directory - F.Size = atoi(Size.c_str()); - F.Path = Base + F.Path; - - // Try to guess what sort of file it is we are getting. - string::size_type Pos = F.Path.length()-1; - while (1) - { - string::size_type Tmp = F.Path.rfind('.',Pos); - if (Tmp == string::npos) - break; - if (F.Type == "tar") { - // source v3 has extension 'debian.tar.*' instead of 'diff.*' - if (string(F.Path, Tmp+1, Pos-Tmp) == "debian") - F.Type = "diff"; - break; - } - F.Type = string(F.Path,Tmp+1,Pos-Tmp); + // Iterate over the entire list grabbing each triplet + const char *C = Files.c_str(); + while (*C != 0) + { + pkgSrcRecords::File F; + string Size; + + // Parse each of the elements + std::string RawHash; + if (ParseQuoteWord(C, RawHash) == false || + ParseQuoteWord(C, Size) == false || + ParseQuoteWord(C, F.Path) == false) + return _error->Error("Error parsing '%s' record", + SourceHashFields[i].first); + // assign full hash string + F.Hash = HashString(SourceHashFields[i].second, RawHash).toStr(); + // API compat hack + if(SourceHashFields[i].second == "MD5Sum") + F.MD5Hash = RawHash; + + // Parse the size and append the directory + F.Size = atoi(Size.c_str()); + F.Path = Base + F.Path; + + // Try to guess what sort of file it is we are getting. + string::size_type Pos = F.Path.length()-1; + while (1) + { + string::size_type Tmp = F.Path.rfind('.',Pos); + if (Tmp == string::npos) + break; + if (F.Type == "tar") { + // source v3 has extension 'debian.tar.*' instead of 'diff.*' + if (string(F.Path, Tmp+1, Pos-Tmp) == "debian") + F.Type = "diff"; + break; + } + F.Type = string(F.Path,Tmp+1,Pos-Tmp); + + if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() || + F.Type == "tar") + { + Pos = Tmp-1; + continue; + } - if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() || - F.Type == "tar") - { - Pos = Tmp-1; - continue; - } - - break; - } + break; + } - List.push_back(F); + List.push_back(F); + } + break; } - - return true; + return (List.size() > 0); } /*}}}*/ // SrcRecordParser::~SrcRecordParser - Destructor /*{{{*/ diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 91893c4e1..b975754b0 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -498,7 +498,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) void pkgDPkgPM::DoStdin(int master) { unsigned char input_buf[256] = {0,}; - ssize_t len = read(0, input_buf, sizeof(input_buf)); + ssize_t len = read(STDIN_FILENO, input_buf, sizeof(input_buf)); if (len) FileFd::Write(master, input_buf, len); else diff --git a/apt-pkg/init.h b/apt-pkg/init.h index b6f3df753..00d361560 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -27,7 +27,7 @@ class Configuration; // Non-ABI-Breaks should only increase RELEASE number. // See also buildlib/libversion.mak #define APT_PKG_MAJOR 4 -#define APT_PKG_MINOR 12 +#define APT_PKG_MINOR 13 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 67a2a709d..80493c37b 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -51,8 +51,8 @@ pkgCache::Header::Header() /* Whenever the structures change the major version should be bumped, whenever the generator changes the minor version should be bumped. */ - MajorVersion = 8; - MinorVersion = 1; + MajorVersion = 9; + MinorVersion = 0; Dirty = false; HeaderSz = sizeof(pkgCache::Header); diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index c31c5f30b..7c01258f1 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -136,7 +136,7 @@ class pkgCache /*{{{*/ /** \brief priority of a package version Zero is used for unparsable or absent Priority fields. */ - enum VerPriority {Important=1,Required=2,Standard=3,Optional=4,Extra=5}; + enum VerPriority {Required=1,Important=2,Standard=3,Optional=4,Extra=5}; enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4}; enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3}; enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2, diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index ed69d0d72..796d2e1bd 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -32,6 +32,7 @@ class pkgSrcRecords struct File { std::string MD5Hash; + std::string Hash; unsigned long Size; std::string Path; std::string Type; diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc index 44a766c84..be2e07f43 100644 --- a/apt-private/private-list.cc +++ b/apt-private/private-list.cc @@ -52,9 +52,6 @@ struct PackageSortAlphabetic /*{{{*/ return (l_name < r_name); } }; - /*}}}*/ -class PackageNameMatcher : public Matcher /*{{{*/ -{ #ifdef PACKAGE_MATCHER_ABI_COMPAT #define PackageMatcher PackageNameMatchesFnmatch #endif @@ -64,16 +61,11 @@ class PackageNameMatcher : public Matcher /*{{{*/ for(int i=0; patterns[i] != NULL; ++i) { std::string pattern = patterns[i]; -#ifdef PACKAGE_MATCHER_ABI_COMPAT - APT::CacheFilter::PackageNameMatchesFnmatch *cachefilter = NULL; - cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern); -#else APT::CacheFilter::PackageMatcher *cachefilter = NULL; if(_config->FindB("APT::Cmd::Use-Regexp", false) == true) cachefilter = new APT::CacheFilter::PackageNameMatchesRegEx(pattern); else cachefilter = new APT::CacheFilter::PackageNameMatchesFnmatch(pattern); -#endif filters.push_back(cachefilter); } } diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 12e385b69..6e9d3bf68 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -829,13 +829,10 @@ bool DoSource(CommandLine &CmdL) queued.insert(Last->Index().ArchiveURI(I->Path)); // check if we have a file with that md5 sum already localy - if(!I->MD5Hash.empty() && FileExists(flNotDir(I->Path))) + if(!I->Hash.empty() && FileExists(flNotDir(I->Path))) { - FileFd Fd(flNotDir(I->Path), FileFd::ReadOnly); - MD5Summation sum; - sum.AddFD(Fd.Fd(), Fd.Size()); - Fd.Close(); - if((string)sum.Result() == I->MD5Hash) + HashString hash_string = HashString(I->Hash); + if(hash_string.VerifyFile(flNotDir(I->Path))) { ioprintf(c1out,_("Skipping already downloaded file '%s'\n"), flNotDir(I->Path).c_str()); @@ -844,7 +841,7 @@ bool DoSource(CommandLine &CmdL) } new pkgAcqFile(&Fetcher,Last->Index().ArchiveURI(I->Path), - I->MD5Hash,I->Size, + I->Hash,I->Size, Last->Index().SourceInfo(*Last,*I),Src); } } diff --git a/debian/apt.install.in b/debian/apt.install.in index ac12060ce..76d51e8dd 100644 --- a/debian/apt.install.in +++ b/debian/apt.install.in @@ -1,5 +1,5 @@ -bin/apt-* usr/bin/ +bin/apt* usr/bin/ bin/methods/* usr/lib/apt/methods/ scripts/dselect/* usr/lib/dpkg/methods/apt/ usr/share/locale/*/*/apt.mo -bin/libapt-private.so.* usr/lib/@DEB_HOST_MULTIARCH@/
\ No newline at end of file +bin/libapt-private.so.* usr/lib/@DEB_HOST_MULTIARCH@/ diff --git a/debian/changelog b/debian/changelog index a3dd9af41..59049b166 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +apt (0.9.16~exp1) UNRELEASED; urgency=low + + [ Michael Vogt ] + * lp:~mvo/apt/webserver-simulate-broken-with-fix346386: + - fix invalid InRelease file download checking and add regression + test to server broken files to the buildin test webserver + * stop exporting the accidently exported parsenetrc() symbol + * [ABI-Break] lp:~mvo/apt/source-hashes: + - use sha{512,256,1} for deb-src when available LP: #1098738 + * [ABI-Break] remove the PACKAGE_MATCHER_ABI_COMPAT defines + + -- Michael Vogt <mvo@debian.org> Thu, 27 Feb 2014 22:44:26 +0100 + apt (0.9.15.4) unstable; urgency=low [ Michael Vogt ] diff --git a/debian/control b/debian/control index 0c1341bb9..0f16c16f1 100644 --- a/debian/control +++ b/debian/control @@ -37,7 +37,7 @@ Description: commandline package manager * apt-config as an interface to the configuration settings * apt-key as an interface to manage authentication keys -Package: libapt-pkg4.12 +Package: libapt-pkg4.13 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} diff --git a/debian/libapt-pkg4.12.install.in b/debian/libapt-pkg4.13.install.in index 56bed39d3..56bed39d3 100644 --- a/debian/libapt-pkg4.12.install.in +++ b/debian/libapt-pkg4.13.install.in diff --git a/debian/libapt-pkg4.12.symbols b/debian/libapt-pkg4.13.symbols index 17b9f69fa..9b62606ce 100644 --- a/debian/libapt-pkg4.12.symbols +++ b/debian/libapt-pkg4.13.symbols @@ -1,4 +1,4 @@ -libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER# +libapt-pkg.so.4.13 libapt-pkg4.13 #MINVER# * Build-Depends-Package: libapt-pkg-dev TFRewritePackageOrder@Base 0.8.0 TFRewriteSourceOrder@Base 0.8.0 diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver new file mode 100755 index 000000000..0622941ce --- /dev/null +++ b/test/integration/skip-aptwebserver @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver + +rm -rf rootdir/var/lib/apt/lists +aptget update -qq +testequal 'Hit http://localhost stable InRelease +Hit http://localhost stable/main Sources +Hit http://localhost stable/main amd64 Packages +Hit http://localhost stable/main Translation-en +Reading package lists...' aptget update + +mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial +aptget update + diff --git a/test/integration/test-debsrc-hashes b/test/integration/test-debsrc-hashes new file mode 100755 index 000000000..5e917232b --- /dev/null +++ b/test/integration/test-debsrc-hashes @@ -0,0 +1,77 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is +# checking the best available hash (as it should), this will trigger +# a hash mismatch. + +cat > aptarchive/Sources <<EOF +Package: pkg-md5-ok +Binary: pkg-md5-ok +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz + +Package: pkg-sha256-ok +Binary: pkg-sha256-ok +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz +Checksums-Sha256: + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc + e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz + +Package: pkg-sha256-bad +Binary: pkg-sha256-bad +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: i386 +Files: + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc + d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha1: + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc + da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz +Checksums-Sha256: + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.dsc + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.tar.gz +EOF + +# create fetchable files +for x in "pkg-md5-ok" "pkg-sha256-ok" "pkg-sha256-bad"; do + touch aptarchive/${x}_1.0.dsc + touch aptarchive/${x}_1.0.tar.gz +done + +testok() { + msgtest "Test for hash ok of" "$*" + $* 2>&1 | grep "Download complete" > /dev/null && msgpass || msgfail +} + +testmismatch() { + msgtest "Test for hash mismatch of" "$*" + $* 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail +} + +setupaptarchive +changetowebserver +aptget update -qq + +testok aptget source -d pkg-md5-ok +testok aptget source -d pkg-sha256-ok +testmismatch aptget source -d pkg-sha256-bad diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile index 8dc014b98..4633b78ce 100644 --- a/test/interactive-helper/makefile +++ b/test/interactive-helper/makefile @@ -39,7 +39,7 @@ include $(PROGRAM_H) #SOURCE = rpmver.cc #include $(PROGRAM_H) -# Program for testing udevcdrom +# very simple webserver for APT testing PROGRAM=aptwebserver SLIBS = -lapt-pkg -lpthread LIB_MAKES = apt-pkg/makefile |