_error->Warning("No valid records were found.");
if (NotFound + WrongSize > 10)
- _error->Warning("Alot of entries were discarded, something may be wrong.\n");
+ _error->Warning("A lot of entries were discarded, something may be wrong.\n");
return true;
{
const indexRecords::checkSum *Record = MetaIndex->Lookup(file);
+ // we skip non-existing files in the verifcation to support a cdrom
+ // with no Packages file (just a Package.gz), see LP: #255545
+ // (non-existing files are not considered a error)
+ if(!FileExists(prefix+file))
+ {
+ _error->Warning(_("Skipping nonexistent file %s"), string(prefix+file).c_str());
+ return true;
+ }
+
if (!Record)
{
- _error->Warning("Can't find authentication record for: %s",file.c_str());
+ _error->Warning(_("Can't find authentication record for: %s"), file.c_str());
return false;
}
- MD5Summation sum;
- FileFd Fd(prefix+file, FileFd::ReadOnly);
- sum.AddFD(Fd.Fd(), Fd.Size());
- Fd.Close();
- string MD5 = (string)sum.Result();
-
- if (Record->MD5Hash != MD5)
+ if (!Record->Hash.VerifyFile(prefix+file))
{
- _error->Warning("MD5 mismatch for: %s",file.c_str());
+ _error->Warning(_("Hash mismatch for: %s"),file.c_str());
return false;
}
if(_config->FindB("Debug::aptcdrom",false))
{
cout << "File: " << prefix+file << endl;
- cout << "Expected MD5sum: " << Record->MD5Hash << endl;
- cout << "got: " << MD5 << endl << endl;
+ cout << "Expected Hash " << Record->Hash.toStr() << endl;
}
return true;
}
-
-bool SigVerify::CopyMetaIndex(string CDROM, string CDName,
+ /*}}}*/
+bool SigVerify::CopyMetaIndex(string CDROM, string CDName, /*{{{*/
string prefix, string file)
{
char S[400];
return true;
}
-
-bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
+ /*}}}*/
+bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList, /*{{{*/
vector<string> PkgList,vector<string> SrcList)
{
if (SigList.size() == 0)
// a Release.gpg without a Release should never happen
if(!FileExists(*I+"Release"))
+ {
+ delete MetaIndex;
continue;
+ }
// verify the gpg signature of "Release"
// Open the Release file and add it to the MetaIndex
if(!MetaIndex->Load(*I+"Release"))
{
- _error->Error(MetaIndex->ErrorText.c_str());
+ _error->Error("%s",MetaIndex->ErrorText.c_str());
return false;
}
if(!Verify(prefix,*I, MetaIndex)) {
// something went wrong, don't copy the Release.gpg
// FIXME: delete any existing gpg file?
+ _error->Discard();
continue;
}
}
return true;
}
-
-
-bool TranslationsCopy::CopyTranslations(string CDROM,string Name,vector<string> &List,
- pkgCdromStatus *log)
+ /*}}}*/
+bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
+ vector<string> &List, pkgCdromStatus *log)
{
OpProgress *Progress = NULL;
if (List.size() == 0)
_error->Warning("No valid records were found.");
if (NotFound + WrongSize > 10)
- _error->Warning("Alot of entries were discarded, something may be wrong.\n");
+ _error->Warning("A lot of entries were discarded, something may be wrong.\n");
return true;
}
+ /*}}}*/