Apply apt-0.5.15cnc6-alt-vendor.patch

Added in commit 3cda23c:
0.5.15cnc6-alt15

- apt-pkg/sourcelist.cc:
  Added support for multiple fingerprints for the same vendor name
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2014-05-16 21:04:22 +04:00
parent afc2d58e1c
commit d0ebd8ce44
5 changed files with 60 additions and 203 deletions

View File

@ -1,175 +0,0 @@
diff -ur apt-0.5.15lorg2.orig/apt-pkg/acquire-item.cc apt-0.5.15lorg2.vendor/apt-pkg/acquire-item.cc
--- apt-0.5.15lorg2.orig/apt-pkg/acquire-item.cc 2006-03-20 20:30:36 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/acquire-item.cc 2006-03-20 20:31:00 +0300
@@ -476,14 +476,29 @@
return;
}
- // Match fingerprint of Release file
- if (Repository->FingerPrint != FingerPrint)
- {
- Status = StatError;
- ErrorText = _("Signature fingerprint of Release file does not match (expected ")
- +Repository->FingerPrint+_(", got ")+FingerPrint+")";
- return;
- }
+ bool found = false;
+ for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
+ I != Repository->FingerPrint.end(); I++)
+ {
+ // Match fingerprint of Release file
+ if ((*I) == FingerPrint)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ Status = StatError;
+ ErrorText = _("Signature fingerprint of Release file does not match (expected ");
+ for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
+ I != Repository->FingerPrint.end(); I++)
+ ErrorText += "\n"+(*I);
+ ErrorText += _(", got ")+FingerPrint+")";
+ return;
+ }
+
}
// Done, move it into position
diff -ur apt-0.5.15lorg2.orig/apt-pkg/repository.h apt-0.5.15lorg2.vendor/apt-pkg/repository.h
--- apt-0.5.15lorg2.orig/apt-pkg/repository.h 2006-01-17 02:10:47 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/repository.h 2006-03-20 20:32:17 +0300
@@ -33,7 +33,7 @@
string URI;
string Dist;
- string FingerPrint;
+ vector<string> FingerPrint;
string RootURI;
bool Acquire;
diff -ur apt-0.5.15lorg2.orig/apt-pkg/sourcelist.cc apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.cc
--- apt-0.5.15lorg2.orig/apt-pkg/sourcelist.cc 2006-02-06 22:11:06 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.cc 2006-03-20 20:31:00 +0300
@@ -150,7 +150,7 @@
{
for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
delete *I;
- for (vector<Vendor const *>::const_iterator I = VendorList.begin();
+ for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
}
@@ -174,38 +174,54 @@
if (ReadConfigFile(Cnf,CnfFile,true) == false)
return false;
- for (vector<Vendor const *>::const_iterator I = VendorList.begin();
+ for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
VendorList.erase(VendorList.begin(),VendorList.end());
-
+
// Process 'simple-key' type sections
const Configuration::Item *Top = Cnf.Tree("simple-key");
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
{
Configuration Block(Top);
- Vendor *Vendor;
+ Vendor *Vendor = 0;
+ string Group = Block.Find("Group");
+ bool New = true;
- Vendor = new pkgSourceList::Vendor;
-
- Vendor->VendorID = Top->Tag;
- Vendor->FingerPrint = Block.Find("Fingerprint");
- Vendor->Description = Block.Find("Name");
+ for (vector<pkgSourceList::Vendor *>::iterator I = VendorList.begin();
+ I != VendorList.end(); I++)
+ {
+ if ((*I)->VendorID == Group)
+ {
+ Vendor = *I;
+ New = false;
+ break;
+ }
+ }
+
+ if (!Vendor)
+ {
+ Vendor = new pkgSourceList::Vendor;
+
+ Vendor->Description = Block.Find("Name");
+ Vendor->VendorID = Top->Tag;
+ }
+ string FingerPrint = Block.Find("Fingerprint");
// CNC:2002-08-15
- char *buffer = new char[Vendor->FingerPrint.length()+1];
+ char *buffer = new char[FingerPrint.length()+1];
char *p = buffer;;
- for (string::const_iterator I = Vendor->FingerPrint.begin();
- I != Vendor->FingerPrint.end(); I++)
+ for (string::const_iterator I = FingerPrint.begin();
+ I != FingerPrint.end(); I++)
{
if (*I != ' ' && *I != '\t')
*p++ = *I;
}
*p = 0;
- Vendor->FingerPrint = buffer;
+ Vendor->FingerPrint.push_back(string(buffer));
delete [] buffer;
- if (Vendor->FingerPrint.empty() == true ||
+ if (Vendor->FingerPrint.size() == 0 ||
Vendor->Description.empty() == true)
{
_error->Error(_("Vendor block %s is invalid"), Vendor->VendorID.c_str());
@@ -213,7 +229,8 @@
continue;
}
- VendorList.push_back(Vendor);
+ if (New)
+ VendorList.push_back(Vendor);
}
/* XXX Process 'group-key' type sections
@@ -355,7 +372,7 @@
return _error->Error(_("Malformed line %u in source list %s (vendor id)"),CurLine,File.c_str());
VendorID = string(VendorID,1,VendorID.size()-2);
- for (vector<Vendor const *>::const_iterator iter = VendorList.begin();
+ for (vector<Vendor *>::iterator iter = VendorList.begin();
iter != VendorList.end(); iter++)
{
if ((*iter)->VendorID == VendorID)
diff -ur apt-0.5.15lorg2.orig/apt-pkg/sourcelist.h apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.h
--- apt-0.5.15lorg2.orig/apt-pkg/sourcelist.h 2006-01-17 02:10:47 +0300
+++ apt-0.5.15lorg2.vendor/apt-pkg/sourcelist.h 2006-03-20 20:31:00 +0300
@@ -48,7 +48,7 @@
struct Vendor
{
string VendorID;
- string FingerPrint;
+ vector<string> FingerPrint;
string Description;
/* Lets revisit these..
@@ -87,8 +87,8 @@
protected:
vector<pkgIndexFile *> SrcList;
- vector<Vendor const *> VendorList;
-
+ vector<Vendor *> VendorList;
+
public:
bool ReadMainList();

View File

@ -483,14 +483,29 @@ void pkgAcqIndexRel::Done(string Message,unsigned long Size,string MD5,
return;
}
bool found = false;
for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
I != Repository->FingerPrint.end(); I++)
{
// Match fingerprint of Release file
if (Repository->FingerPrint != FingerPrint)
if ((*I) == FingerPrint)
{
found = true;
break;
}
}
if (!found)
{
Status = StatError;
ErrorText = _("Signature fingerprint of Release file does not match (expected ")
+Repository->FingerPrint+_(", got ")+FingerPrint+")";
ErrorText = _("Signature fingerprint of Release file does not match (expected ");
for (vector<string>::const_iterator I = Repository->FingerPrint.begin();
I != Repository->FingerPrint.end(); I++)
ErrorText += "\n"+(*I);
ErrorText += _(", got ")+FingerPrint+")";
return;
}
}
// Done, move it into position

View File

@ -33,7 +33,7 @@ class pkgRepository
string URI;
string Dist;
string FingerPrint;
vector<string> FingerPrint;
string RootURI;
bool Acquire;

View File

@ -150,7 +150,7 @@ pkgSourceList::~pkgSourceList()
{
for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
delete *I;
for (vector<Vendor const *>::const_iterator I = VendorList.begin();
for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
}
@ -174,7 +174,7 @@ bool pkgSourceList::ReadVendors()
if (ReadConfigFile(Cnf,CnfFile,true) == false)
return false;
for (vector<Vendor const *>::const_iterator I = VendorList.begin();
for (vector<Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
delete *I;
VendorList.erase(VendorList.begin(),VendorList.end());
@ -184,28 +184,44 @@ bool pkgSourceList::ReadVendors()
for (Top = (Top == 0?0:Top->Child); Top != 0; Top = Top->Next)
{
Configuration Block(Top);
Vendor *Vendor;
Vendor *Vendor = 0;
string Group = Block.Find("Group");
bool New = true;
for (vector<pkgSourceList::Vendor *>::iterator I = VendorList.begin();
I != VendorList.end(); I++)
{
if ((*I)->VendorID == Group)
{
Vendor = *I;
New = false;
break;
}
}
if (!Vendor)
{
Vendor = new pkgSourceList::Vendor;
Vendor->VendorID = Top->Tag;
Vendor->FingerPrint = Block.Find("Fingerprint");
Vendor->Description = Block.Find("Name");
Vendor->VendorID = Top->Tag;
}
string FingerPrint = Block.Find("Fingerprint");
// CNC:2002-08-15
char *buffer = new char[Vendor->FingerPrint.length()+1];
char *buffer = new char[FingerPrint.length()+1];
char *p = buffer;;
for (string::const_iterator I = Vendor->FingerPrint.begin();
I != Vendor->FingerPrint.end(); I++)
for (string::const_iterator I = FingerPrint.begin();
I != FingerPrint.end(); I++)
{
if (*I != ' ' && *I != '\t')
*p++ = *I;
}
*p = 0;
Vendor->FingerPrint = buffer;
Vendor->FingerPrint.push_back(string(buffer));
delete [] buffer;
if (Vendor->FingerPrint.empty() == true ||
if (Vendor->FingerPrint.size() == 0 ||
Vendor->Description.empty() == true)
{
_error->Error(_("Vendor block %s is invalid"), Vendor->VendorID.c_str());
@ -213,6 +229,7 @@ bool pkgSourceList::ReadVendors()
continue;
}
if (New)
VendorList.push_back(Vendor);
}
@ -355,7 +372,7 @@ bool pkgSourceList::ReadAppend(string File)
return _error->Error(_("Malformed line %u in source list %s (vendor id)"),CurLine,File.c_str());
VendorID = string(VendorID,1,VendorID.size()-2);
for (vector<Vendor const *>::const_iterator iter = VendorList.begin();
for (vector<Vendor *>::iterator iter = VendorList.begin();
iter != VendorList.end(); iter++)
{
if ((*iter)->VendorID == VendorID)

View File

@ -48,7 +48,7 @@ class pkgSourceList
struct Vendor
{
string VendorID;
string FingerPrint;
vector<string> FingerPrint;
string Description;
/* Lets revisit these..
@ -87,7 +87,7 @@ class pkgSourceList
protected:
vector<pkgIndexFile *> SrcList;
vector<Vendor const *> VendorList;
vector<Vendor *> VendorList;
public: