+++ /dev/null
-diff -Nur apt-0.3.19cnc50.orig/apt-pkg/init.cc apt-0.3.19cnc50/apt-pkg/init.cc
---- apt-0.3.19cnc50.orig/apt-pkg/init.cc Tue Jun 26 05:51:24 2001
-+++ apt-0.3.19cnc50/apt-pkg/init.cc Tue Aug 14 23:59:37 2001
-@@ -26,7 +26,7 @@
- Cnf.Set("APT::Architecture",ARCHITECTURE);
-
- // State
-- Cnf.Set("Dir::State","/var/state/apt/");
-+ Cnf.Set("Dir::State","/var/lib/apt/");
- Cnf.Set("Dir::State::lists","lists/");
-
- /* These really should be jammed into a generic 'Local Database' engine
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-cache.8 apt-0.3.19cnc50/doc/apt-cache.8
---- apt-0.3.19cnc50.orig/doc/apt-cache.8 Thu Jan 4 22:26:14 2001
-+++ apt-0.3.19cnc50/doc/apt-cache.8 Tue Aug 14 23:55:55 2001
-@@ -71,7 +71,7 @@
-
- Versions:
-
--2\&.1-12(/var/state/apt/lists/debian\&.midco\&.net_debian_dists_slink_main_binary-i386_Packages),
-+2\&.1-12(/var/lib/apt/lists/debian\&.midco\&.net_debian_dists_slink_main_binary-i386_Packages),
-
- Reverse Depends:
-
-@@ -283,11 +283,11 @@
- locations to fetch packages from
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- storage area for state information for each package resource specified in
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- storage area for state information in transit
- .PP
- .SH "SEE ALSO"
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-cache.8.yo apt-0.3.19cnc50/doc/apt-cache.8.yo
---- apt-0.3.19cnc50.orig/doc/apt-cache.8.yo Thu Aug 10 14:42:39 2000
-+++ apt-0.3.19cnc50/doc/apt-cache.8.yo Tue Aug 14 23:56:18 2001
-@@ -57,7 +57,7 @@
-
- Versions:
-
--2.1-12(/var/state/apt/lists/debian.midco.net_debian_dists_slink_main_binary-i386_Packages),
-+2.1-12(/var/lib/apt/lists/debian.midco.net_debian_dists_slink_main_binary-i386_Packages),
-
- Reverse Depends:
-
-@@ -256,10 +256,10 @@
- it() /etc/apt/sources.list
- locations to fetch packages from
-
-- it() /var/state/apt/lists/
-+ it() /var/lib/apt/lists/
- storage area for state information for each package resource specified in
-
-- it() /var/state/apt/lists/partial/
-+ it() /var/lib/apt/lists/partial/
- storage area for state information in transit
- )
-
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-cdrom.8 apt-0.3.19cnc50/doc/apt-cdrom.8
---- apt-0.3.19cnc50.orig/doc/apt-cdrom.8 Thu Oct 26 18:22:51 2000
-+++ apt-0.3.19cnc50/doc/apt-cdrom.8 Tue Aug 14 23:56:55 2001
-@@ -27,7 +27,7 @@
- directory you will be prompted for a descriptive title\&.
- .IP
- APT uses a CDROM ID to track which disc is currently in the drive and
--maintains a database of these IDs in \fB/var/state/apt/cdroms\&.list\fP
-+maintains a database of these IDs in \fB/var/lib/apt/cdroms\&.list\fP
- .IP
- .PP
- .SH "OPTIONS"
-@@ -95,15 +95,15 @@
- locations to fetch packages from
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- storage area for state information for each package resource specified in
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- storage area for state information in transit
- .IP
- .IP o
--/var/state/apt/cdroms\&.list
-+/var/lib/apt/cdroms\&.list
- list of cdrom IDs and names\&.
- .PP
- .SH "SEE ALSO"
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-cdrom.8.yo apt-0.3.19cnc50/doc/apt-cdrom.8.yo
---- apt-0.3.19cnc50.orig/doc/apt-cdrom.8.yo Thu Aug 10 14:42:39 2000
-+++ apt-0.3.19cnc50/doc/apt-cdrom.8.yo Tue Aug 14 23:57:14 2001
-@@ -29,7 +29,7 @@
- directory you will be prompted for a descriptive title.
-
- APT uses a CDROM ID to track which disc is currently in the drive and
--maintains a database of these IDs in bf(/var/state/apt/cdroms.list)
-+maintains a database of these IDs in bf(/var/lib/apt/cdroms.list)
-
- enddit()
-
-@@ -93,13 +93,13 @@
- it() /etc/apt/sources.list
- locations to fetch packages from
-
-- it() /var/state/apt/lists/
-+ it() /var/lib/apt/lists/
- storage area for state information for each package resource specified in
-
-- it() /var/state/apt/lists/partial/
-+ it() /var/lib/apt/lists/partial/
- storage area for state information in transit
-
-- it() /var/state/apt/cdroms.list
-+ it() /var/lib/apt/cdroms.list
- list of cdrom IDs and names.
- )
-
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-get.8 apt-0.3.19cnc50/doc/apt-get.8
---- apt-0.3.19cnc50.orig/doc/apt-get.8 Wed Nov 1 22:32:28 2000
-+++ apt-0.3.19cnc50/doc/apt-get.8 Tue Aug 14 23:57:34 2001
-@@ -252,7 +252,7 @@
- .IP "\fB--list-cleanup\fP"
- This option defaults to on, use \fB--no-list-cleanup\fP to turn it off\&.
- When on apt-get will automatically manage the contents of
--/var/state/apt/lists to ensure that obsolete files are erased\&. The only
-+/var/lib/apt/lists to ensure that obsolete files are erased\&. The only
- reason to turn it off is if you frequently change your source list\&.
- Configuration Item: \fBAPT::Get::List-Cleanup\fP
- .IP
-@@ -299,12 +299,12 @@
- storage area for package files in transit
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- storage area for state information for each package resource specified in
- the source list
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- storage area for state information in transit
- .PP
- .SH "SEE ALSO"
-diff -Nur apt-0.3.19cnc50.orig/doc/apt-get.8.yo apt-0.3.19cnc50/doc/apt-get.8.yo
---- apt-0.3.19cnc50.orig/doc/apt-get.8.yo Thu Aug 10 14:42:39 2000
-+++ apt-0.3.19cnc50/doc/apt-get.8.yo Tue Aug 14 23:57:50 2001
-@@ -235,7 +235,7 @@
- dit(bf(--list-cleanup))
- This option defaults to on, use bf(--no-list-cleanup) to turn it off.
- When on apt-get will automatically manage the contents of
--/var/state/apt/lists to ensure that obsolete files are erased. The only
-+/var/lib/apt/lists to ensure that obsolete files are erased. The only
- reason to turn it off is if you frequently change your source list.
- Configuration Item: bf(APT::Get::List-Cleanup)
-
-@@ -274,11 +274,11 @@
- it() /var/cache/apt/archives/partial/
- storage area for package files in transit
-
-- it() /var/state/apt/lists/
-+ it() /var/lib/apt/lists/
- storage area for state information for each package resource specified in
- the source list
-
-- it() /var/state/apt/lists/partial/
-+ it() /var/lib/apt/lists/partial/
- storage area for state information in transit
- )
-
-diff -Nur apt-0.3.19cnc50.orig/doc/examples/configure-index apt-0.3.19cnc50/doc/examples/configure-index
---- apt-0.3.19cnc50.orig/doc/examples/configure-index Thu Jan 4 22:26:14 2001
-+++ apt-0.3.19cnc50/doc/examples/configure-index Tue Aug 14 23:59:24 2001
-@@ -137,7 +137,7 @@
- Dir
- {
- // Location of the state dir
-- State "/var/state/apt/"
-+ State "/var/lib/apt/"
- {
- lists "lists/";
- xstatus "xstatus";
-diff -Nur apt-0.3.19cnc50.orig/doc/files.sgml apt-0.3.19cnc50/doc/files.sgml
---- apt-0.3.19cnc50.orig/doc/files.sgml Thu Aug 10 14:42:39 2000
-+++ apt-0.3.19cnc50/doc/files.sgml Tue Aug 14 23:58:13 2001
-@@ -41,7 +41,7 @@
- <p>
- The var directory structure is as follows:
- <example>
-- /var/state/apt/
-+ /var/lib/apt/
- lists/
- partial/
- xstatus
-@@ -66,7 +66,7 @@
- </example>
-
- <p>
--As is specified in the FHS 2.0 /var/state/apt is used for application
-+As is specified in the FHS 2.2 /var/lib/apt is used for application
- data that is not expected to be user modified. /var/cache/apt is used
- for regeneratable data and is where the package cache and downloaded .debs
- go.
-@@ -183,10 +183,10 @@
-
- <example>
- http://www.debian.org/archive/dists/stable/binary-i386/Packages
--/var/state/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-+/var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-
- cdrom:Debian 1.3/debian/Packages
--/var/state/apt/info/Debian%201.3_debian_Packages
-+/var/lib/apt/info/Debian%201.3_debian_Packages
- </example>
-
- <p>
-diff -Nur apt-0.3.19cnc50.orig/doc/pt_BR/apt-cache.8 apt-0.3.19cnc50/doc/pt_BR/apt-cache.8
---- apt-0.3.19cnc50.orig/doc/pt_BR/apt-cache.8 Mon Nov 27 19:01:01 2000
-+++ apt-0.3.19cnc50/doc/pt_BR/apt-cache.8 Tue Aug 14 23:58:34 2001
-@@ -71,7 +71,7 @@
-
- Versões:
-
--2\&.1-12(/var/state/apt/lists/debian\&.midco\&.net_debian_dists_slink_main_binary-i386_Packages),
-+2\&.1-12(/var/lib/apt/lists/debian\&.midco\&.net_debian_dists_slink_main_binary-i386_Packages),
-
- Retro-Dependências:
-
-@@ -290,12 +290,12 @@
- locais de onde obter os pacotes
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- área de armazenamento para exibir informação para cada recurso de pacote
- especificado em
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- área de armazenamento para exibir informação de estado em trânsito
- .PP
- .SH "CONSULTE TAMBÉM"
-diff -Nur apt-0.3.19cnc50.orig/doc/pt_BR/apt-cdrom.8 apt-0.3.19cnc50/doc/pt_BR/apt-cdrom.8
---- apt-0.3.19cnc50.orig/doc/pt_BR/apt-cdrom.8 Mon Nov 27 19:01:01 2000
-+++ apt-0.3.19cnc50/doc/pt_BR/apt-cdrom.8 Tue Aug 14 23:58:54 2001
-@@ -31,7 +31,7 @@
- .IP
- APT usa uma identificação de CDROM para rastrear qual disco está
- atualmente no drive e mantém uma base de dados destes IDs em
--\fB/var/state/apt/cdroms\&.list\fP
-+\fB/var/lib/apt/cdroms\&.list\fP
- .IP
- .PP
- .SH "OPÇÕES"
-@@ -98,16 +98,16 @@
- locais da onde obter pacotes
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- área de armazenamento para informação de estado para cada tipo de recurso de
- pacote especificado em
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- área de armazenamento para informação de estado em trânsito
- .IP
- .IP o
--/var/state/apt/cdroms\&.list
-+/var/lib/apt/cdroms\&.list
- lista de IDs de CDROMs e nomes\&.
- .PP
- .SH "CONSULTE TAMBÉM"
-diff -Nur apt-0.3.19cnc50.orig/doc/pt_BR/apt-get.8 apt-0.3.19cnc50/doc/pt_BR/apt-get.8
---- apt-0.3.19cnc50.orig/doc/pt_BR/apt-get.8 Mon Nov 27 19:01:01 2000
-+++ apt-0.3.19cnc50/doc/pt_BR/apt-get.8 Tue Aug 14 23:59:16 2001
-@@ -254,7 +254,7 @@
- .IP "\fB--list-cleanup\fP"
- Esta opção é habilitada por padrão, use \fB--no-list-cleanup\fP para
- desabilitá-la\&. Quando habilitada o apt-get irá gerenciar
--automaticamente os conteúdos de /var/state/apt/lists para
-+automaticamente os conteúdos de /var/lib/apt/lists para
- certificar-se de que os arquivos obsoletos serão apagados\&. A única
- razão para desativá-la é se você altera sua lista-fonte com freqüência\&.
- Item de configuração: \fBAPT::Get::List-Cleanup\fP
-@@ -307,12 +307,12 @@
- área de armazenagem para arquivos de pacotes em trânsito
- .IP
- .IP o
--/var/state/apt/lists/
-+/var/lib/apt/lists/
- área de armazenagem para informação de estado para cada recurso de
- pacote especificado na lista de fontes
- .IP
- .IP o
--/var/state/apt/lists/partial/
-+/var/lib/apt/lists/partial/
- área de armazenagem para informação de estado em trânsito
- .PP
- .SH "SEE ALSO"
-diff -Nur apt-0.3.19cnc50.orig/docs/files.html/ch1.html apt-0.3.19cnc50/docs/files.html/ch1.html
---- apt-0.3.19cnc50.orig/docs/files.html/ch1.html Mon Oct 2 22:04:53 2000
-+++ apt-0.3.19cnc50/docs/files.html/ch1.html Tue Aug 14 23:55:08 2001
-@@ -42,7 +42,7 @@
- The var directory structure is as follows:
-
- <pre>
-- /var/state/apt/
-+ /var/lib/apt/
- lists/
- partial/
- xstatus
-@@ -67,7 +67,7 @@
- </pre>
-
- <p>
--As is specified in the FHS 2.0 /var/state/apt is used for application data that
-+As is specified in the FHS 2.2 /var/lib/apt is used for application data that
- is not expected to be user modified. /var/cache/apt is used for regeneratable
- data and is where the package cache and downloaded .debs go.
- </p>
-diff -Nur apt-0.3.19cnc50.orig/docs/files.html/ch2.html apt-0.3.19cnc50/docs/files.html/ch2.html
---- apt-0.3.19cnc50.orig/docs/files.html/ch2.html Mon Oct 2 22:04:53 2000
-+++ apt-0.3.19cnc50/docs/files.html/ch2.html Tue Aug 14 23:55:26 2001
-@@ -174,10 +174,10 @@
-
- <pre>
- http://www.debian.org/archive/dists/stable/binary-i386/Packages
-- /var/state/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-+ /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-
- cdrom:Debian 1.3/debian/Packages
-- /var/state/apt/info/Debian%201.3_debian_Packages
-+ /var/lib/apt/info/Debian%201.3_debian_Packages
- </pre>
-
- <p>
-diff -Nur apt-0.3.19cnc50.orig/docs/files.text apt-0.3.19cnc50/docs/files.text
---- apt-0.3.19cnc50.orig/docs/files.text Mon Oct 2 22:04:53 2000
-+++ apt-0.3.19cnc50/docs/files.text Tue Aug 14 23:54:36 2001
-@@ -68,12 +68,12 @@
-
- The var directory structure is as follows:
-
-- /var/state/apt/
-- lists/
-- partial/
-- xstatus
-- userstatus
-- cdroms.list
-+ /var/lib/apt/
-+ lists/
-+ partial/
-+ xstatus
-+ userstatus
-+ cdroms.list
- /var/cache/apt/
- pkgcache.bin
- srcpkgcache.bin
-@@ -91,7 +91,7 @@
- gzip
- copy
-
-- As is specified in the FHS 2.0 /var/state/apt is used for application
-+ As is specified in the FHS 2.2 /var/lib/apt is used for application
- data that is not expected to be user modified. /var/cache/apt is used
- for regeneratable data and is where the package cache and downloaded
- .debs go.
-@@ -202,10 +202,10 @@
- representation from the ascii character set. Examples:
-
- http://www.debian.org/archive/dists/stable/binary-i386/Packages
--/var/state/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-+/var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
-
- cdrom:Debian 1.3/debian/Packages
--/var/state/apt/info/Debian%201.3_debian_Packages
-+/var/lib/apt/info/Debian%201.3_debian_Packages
-
- The other alternative that was considered was to use a deep directory
- structure but this poses two problems, it makes it very difficult to
+++ /dev/null
---- apt-0.5.5cnc4.1/apt-pkg/acquire-item.cc.orig 2003-03-08 00:11:34.000000000 +0100
-+++ apt-0.5.5cnc4.1/apt-pkg/acquire-item.cc 2003-06-19 22:59:35.000000000 +0200
-@@ -27,6 +27,7 @@
- #include <apt-pkg/repository.h>
- #include <apt-pkg/md5.h>
- #include <iostream>
-+#include <cassert>
- using namespace std;
-
- #include <apti18n.h>
---- apt-0.5.5cnc4.1/apt-pkg/rpm/rpmsrcrecords.cc.orig 2003-03-08 00:12:41.000000000 +0100
-+++ apt-0.5.5cnc4.1/apt-pkg/rpm/rpmsrcrecords.cc 2003-06-19 23:01:29.000000000 +0200
-@@ -30,6 +30,8 @@
- #include <rpm/rpmds.h>
- #endif
-
-+#include <cassert>
-+
- // SrcRecordParser::rpmSrcRecordParser - Constructor /*{{{*/
- // ---------------------------------------------------------------------
- /* */
---- apt-0.5.5cnc4.1/apt-pkg/rpm/rpmversion.cc.orig 2003-03-08 00:12:34.000000000 +0100
-+++ apt-0.5.5cnc4.1/apt-pkg/rpm/rpmversion.cc 2003-06-19 23:02:00.000000000 +0200
-@@ -31,6 +31,8 @@
- #include <rpm/rpmds.h>
- #endif
-
-+#include <cassert>
-+
- rpmVersioningSystem rpmVS;
-
- // rpmVS::rpmVersioningSystem - Constructor /*{{{*/
+++ /dev/null
-diff -urN apt-0.3.19cnc55.org/apt-pkg/acquire-method.cc apt-0.3.19cnc55/apt-pkg/acquire-method.cc
---- apt-0.3.19cnc55.org/apt-pkg/acquire-method.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/acquire-method.cc Tue Mar 12 17:18:31 2002
-@@ -27,6 +27,8 @@
- #include <stdarg.h>
- #include <stdio.h>
- #include <unistd.h>
-+#include <iostream>
-+using namespace std;
- /*}}}*/
-
- // AcqMethod::pkgAcqMethod - Constructor /*{{{*/
-@@ -85,7 +87,7 @@
- void pkgAcqMethod::Fail(string Err,bool Transient)
- {
- // Strip out junk from the error messages
-- for (char *I = Err.begin(); I != Err.end(); I++)
-+ for (string::iterator I = Err.begin(); I != Err.end(); I++)
- {
- if (*I == '\r')
- *I = ' ';
-@@ -285,10 +287,10 @@
- {
- ::Configuration &Cnf = *_config;
-
-- const char *I = Message.begin();
-+ const char *I = Message.data();
-
- unsigned int Length = strlen("Config-Item");
-- for (; I + Length < Message.end(); I++)
-+ for (; I + Length < Message.data()+Message.size(); I++)
- {
- // Not a config item
- if (I[Length] != ':' || stringcasecmp(I,I+Length,"Config-Item") != 0)
-@@ -296,11 +298,11 @@
-
- I += Length + 1;
-
-- for (; I < Message.end() && *I == ' '; I++);
-+ for (; I < Message.data()+Message.size() && *I == ' '; I++);
- const char *Equals = I;
-- for (; Equals < Message.end() && *Equals != '='; Equals++);
-+ for (; Equals < Message.data()+Message.size() && *Equals != '='; Equals++);
- const char *End = Equals;
-- for (; End < Message.end() && *End != '\n'; End++);
-+ for (; End < Message.data()+Message.size() && *End != '\n'; End++);
- if (End == Equals)
- return false;
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/acquire-worker.cc apt-0.3.19cnc55/apt-pkg/acquire-worker.cc
---- apt-0.3.19cnc55.org/apt-pkg/acquire-worker.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/acquire-worker.cc Tue Mar 12 17:18:31 2002
-@@ -131,7 +131,7 @@
- // Setup the FDs
- dup2(Pipes[1],STDOUT_FILENO);
- dup2(Pipes[2],STDIN_FILENO);
-- dup2(((filebuf *)clog.rdbuf())->fd(),STDERR_FILENO);
-+// dup2(((filebuf *)clog.rdbuf())->fd(),STDERR_FILENO);
- SetCloseExec(STDOUT_FILENO,false);
- SetCloseExec(STDIN_FILENO,false);
- SetCloseExec(STDERR_FILENO,false);
-@@ -465,7 +465,7 @@
- int Res;
- do
- {
-- Res = write(OutFd,OutQueue.begin(),OutQueue.length());
-+ Res = write(OutFd,OutQueue.data(),OutQueue.length());
- }
- while (Res < 0 && errno == EINTR);
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/acquire-worker.h apt-0.3.19cnc55/apt-pkg/acquire-worker.h
---- apt-0.3.19cnc55.org/apt-pkg/acquire-worker.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/acquire-worker.h Tue Mar 12 17:18:38 2002
-@@ -21,10 +21,10 @@
- // Interfacing to the method process
- class pkgAcquire::Worker
- {
-- friend pkgAcquire;
-+ friend class pkgAcquire;
-
- protected:
-- friend Queue;
-+ friend class Queue;
-
- /* Linked list starting at a Queue and a linked list starting
- at Acquire */
-diff -urN apt-0.3.19cnc55.org/apt-pkg/acquire.cc apt-0.3.19cnc55/apt-pkg/acquire.cc
---- apt-0.3.19cnc55.org/apt-pkg/acquire.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/acquire.cc Tue Mar 12 17:18:31 2002
-@@ -365,7 +365,7 @@
- I->Shutdown(false);
-
- // Shut down the items
-- for (Item **I = Items.begin(); I != Items.end(); I++)
-+ for (vector<Item *>::iterator I = Items.begin(); I != Items.end(); I++)
- (*I)->Finished();
-
- if (_error->PendingError())
-diff -urN apt-0.3.19cnc55.org/apt-pkg/acquire.h apt-0.3.19cnc55/apt-pkg/acquire.h
---- apt-0.3.19cnc55.org/apt-pkg/acquire.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/acquire.h Tue Mar 12 17:18:38 2002
-@@ -34,6 +34,7 @@
-
- #include <vector>
- #include <string>
-+using namespace std;
-
- #ifdef __GNUG__
- #pragma interface "apt-pkg/acquire.h"
-@@ -52,8 +53,8 @@
- class Worker;
- struct MethodConfig;
- struct ItemDesc;
-- friend Item;
-- friend Queue;
-+ friend class Item;
-+ friend class Queue;
-
- protected:
-
-@@ -100,8 +101,8 @@
- // Simple iteration mechanism
- inline Worker *WorkersBegin() {return Workers;};
- Worker *WorkerStep(Worker *I);
-- inline Item **ItemsBegin() {return Items.begin();};
-- inline Item **ItemsEnd() {return Items.end();};
-+ inline Item **ItemsBegin() {return &*Items.begin();};
-+ inline Item **ItemsEnd() {return &*Items.end();};
-
- // Iterate over queued Item URIs
- class UriIterator;
-@@ -132,8 +133,8 @@
- // List of possible items queued for download.
- class pkgAcquire::Queue
- {
-- friend pkgAcquire;
-- friend pkgAcquire::UriIterator;
-+ friend class pkgAcquire;
-+ friend class pkgAcquire::UriIterator;
- Queue *Next;
-
- public:
-diff -urN apt-0.3.19cnc55.org/apt-pkg/algorithms.cc apt-0.3.19cnc55/apt-pkg/algorithms.cc
---- apt-0.3.19cnc55.org/apt-pkg/algorithms.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/algorithms.cc Tue Mar 12 17:21:54 2002
-@@ -20,7 +20,7 @@
- #include <apt-pkg/algorithms.h>
- #include <apt-pkg/error.h>
- #include <apt-pkg/configuration.h>
--#include <iostream.h>
-+#include <iostream>
- /*}}}*/
- #include <i18n.h>
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/cdromutl.h apt-0.3.19cnc55/apt-pkg/contrib/cdromutl.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/cdromutl.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/cdromutl.h Tue Mar 12 17:18:38 2002
-@@ -11,6 +11,7 @@
- #define PKGLIB_ACQUIRE_METHOD_H
-
- #include <string>
-+using namespace std;
-
- #ifdef __GNUG__
- #pragma interface "apt-pkg/cdromutl.h"
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/configuration.cc apt-0.3.19cnc55/apt-pkg/contrib/configuration.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/configuration.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/configuration.cc Tue Mar 12 17:19:51 2002
-@@ -20,7 +20,8 @@
- #include <apt-pkg/strutl.h>
-
- #include <stdio.h>
--#include <fstream.h>
-+#include <fstream>
-+#include <iostream>
- /*}}}*/
-
- Configuration *_config = new Configuration;
-@@ -84,7 +85,7 @@
- if (Len != 0)
- {
- for (; I != 0; Last = &I->Next, I = I->Next)
-- if ((Res = stringcasecmp(I->Tag.begin(),I->Tag.end(),S,S + Len)) == 0)
-+ if ((Res = stringcasecmp(I->Tag.data(),I->Tag.data()+I->Tag.size(),S,S + Len)) == 0)
- break;
- }
- else
-@@ -429,7 +430,7 @@
- unsigned Depth)
- {
- // Open the stream for reading
-- ifstream F(FName.c_str(),ios::in | ios::nocreate);
-+ ifstream F(FName.c_str(),ios::in);
- if (!F != 0)
- return _error->Errno("ifstream::ifstream","Opening configuration file %s",FName.c_str());
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/configuration.h apt-0.3.19cnc55/apt-pkg/contrib/configuration.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/configuration.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/configuration.h Tue Mar 12 17:18:38 2002
-@@ -33,6 +33,7 @@
- #endif
-
- #include <string>
-+using namespace std;
-
- class Configuration
- {
-@@ -70,7 +71,7 @@
- string FindFile(const char *Name,const char *Default = 0) const;
- string FindDir(const char *Name,const char *Default = 0) const;
- int FindI(const char *Name,int Default = 0) const;
-- int FindI(string Name,bool Default = 0) const {return FindI(Name.c_str(),Default);};
-+ int FindI(string Name,bool Default = 0) const {return FindI(Name.c_str(),int (Default));};
- bool FindB(const char *Name,bool Default = false) const;
- bool FindB(string Name,bool Default = false) const {return FindB(Name.c_str(),Default);};
- string FindAny(const char *Name,const char *Default = 0) const;
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/error.cc apt-0.3.19cnc55/apt-pkg/contrib/error.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/error.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/error.cc Tue Mar 12 17:18:31 2002
-@@ -26,6 +26,9 @@
- #include <stdarg.h>
- #include <unistd.h>
-
-+#include <iostream>
-+using namespace std;
-+
- #include "config.h"
- /*}}}*/
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/error.h apt-0.3.19cnc55/apt-pkg/contrib/error.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/error.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/error.h Tue Mar 12 17:18:38 2002
-@@ -45,6 +45,7 @@
- #endif
-
- #include <string>
-+using namespace std;
-
- class GlobalError
- {
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/fileutl.cc apt-0.3.19cnc55/apt-pkg/contrib/fileutl.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/fileutl.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/fileutl.cc Tue Mar 12 17:18:31 2002
-@@ -28,6 +28,8 @@
- #include <sys/wait.h>
- #include <signal.h>
- #include <errno.h>
-+#include <iostream>
-+using namespace std;
- /*}}}*/
-
- // CopyFile - Buffered copy of a file /*{{{*/
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/fileutl.h apt-0.3.19cnc55/apt-pkg/contrib/fileutl.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/fileutl.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/fileutl.h Tue Mar 12 17:18:38 2002
-@@ -26,6 +26,7 @@
- #endif
-
- #include <string>
-+using namespace std;
-
- class FileFd
- {
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/i18n.h apt-0.3.19cnc55/apt-pkg/contrib/i18n.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/i18n.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/i18n.h Tue Mar 12 17:18:31 2002
-@@ -46,8 +46,8 @@
- # define bindtextdomain(Domain, Directory) /* empty */
- # undef textdomain
- # define textdomain(Domain) /* empty */
--# undef setlocale
--# define setlocale(cat, log)
-+//# undef setlocale
-+//# define setlocale(cat, log)
- # define _(a) a
- #endif
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/md5.cc apt-0.3.19cnc55/apt-pkg/contrib/md5.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/md5.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/md5.cc Tue Mar 12 17:18:31 2002
-@@ -191,7 +191,7 @@
- /* Converts the hex string into a set of chars */
- bool MD5SumValue::Set(string Str)
- {
-- return Hex2Num(Str.begin(),Str.end(),Sum,sizeof(Sum));
-+ return Hex2Num(Str.data(),Str.data()+Str.size(),Sum,sizeof(Sum));
- }
- /*}}}*/
- // MD5SumValue::Value - Convert the number into a string /*{{{*/
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/md5.h apt-0.3.19cnc55/apt-pkg/contrib/md5.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/md5.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/md5.h Tue Mar 12 17:18:38 2002
-@@ -28,12 +28,13 @@
- #endif
-
- #include <string>
-+using namespace std;
-
- class MD5Summation;
-
- class MD5SumValue
- {
-- friend MD5Summation;
-+ friend class MD5Summation;
- unsigned char Sum[4*4];
-
- public:
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/mmap.h apt-0.3.19cnc55/apt-pkg/contrib/mmap.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/mmap.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/mmap.h Tue Mar 12 17:18:38 2002
-@@ -92,7 +92,7 @@
- unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
- unsigned long Allocate(unsigned long ItemSize);
- unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
-- inline unsigned long WriteString(string S) {return WriteString(S.begin(),S.size());};
-+ inline unsigned long WriteString(string S) {return WriteString(S.data(),S.size());};
- void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
-
- DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace = 2*1024*1024);
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/progress.cc apt-0.3.19cnc55/apt-pkg/contrib/progress.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/progress.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/progress.cc Tue Mar 12 17:18:31 2002
-@@ -15,6 +15,7 @@
- #include <apt-pkg/error.h>
- #include <apt-pkg/configuration.h>
- #include <stdio.h>
-+#include <iostream>
- /*}}}*/
- #include <i18n.h>
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/progress.h apt-0.3.19cnc55/apt-pkg/contrib/progress.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/progress.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/progress.h Tue Mar 12 17:18:38 2002
-@@ -27,6 +27,7 @@
-
- #include <string>
- #include <sys/time.h>
-+using namespace std;
-
- class Configuration;
- class OpProgress
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/strutl.cc apt-0.3.19cnc55/apt-pkg/contrib/strutl.cc
---- apt-0.3.19cnc55.org/apt-pkg/contrib/strutl.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/strutl.cc Tue Mar 12 17:18:31 2002
-@@ -464,22 +464,22 @@
- {
- // Look for a matching tag.
- int Length = strlen(Tag);
-- for (string::iterator I = Message.begin(); I + Length < Message.end(); I++)
-+ for (const char *I = Message.data(); I + Length < Message.data()+Message.size(); I++)
- {
- // Found the tag
- if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
- {
- // Find the end of line and strip the leading/trailing spaces
-- string::iterator J;
-+ const char *J;
- I += Length + 1;
-- for (; isspace(*I) != 0 && I < Message.end(); I++);
-- for (J = I; *J != '\n' && J < Message.end(); J++);
-+ for (; isspace(*I) != 0 && I < Message.data()+Message.size(); I++);
-+ for (J = I; *J != '\n' && J < Message.data()+Message.size(); J++);
- for (; J > I && isspace(J[-1]) != 0; J--);
-
- return string(I,J-I);
- }
-
-- for (; *I != '\n' && I < Message.end(); I++);
-+ for (; *I != '\n' && I < Message.data()+Message.size(); I++);
- }
-
- // Failed to find a match
-@@ -492,7 +492,7 @@
- // ---------------------------------------------------------------------
- /* This inspects the string to see if it is true or if it is false and
- then returns the result. Several varients on true/false are checked. */
--int StringToBool(string Text,int Default = -1)
-+int StringToBool(string Text,int Default)
- {
- char *End;
- int Res = strtol(Text.c_str(),&End,0);
-@@ -867,16 +867,16 @@
- matched against the argument */
- bool CheckDomainList(string Host,string List)
- {
-- string::const_iterator Start = List.begin();
-- for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
-+ const char *Start = List.data();
-+ for (const char *Cur = List.data(); Cur <= List.data()+List.size(); Cur++)
- {
-- if (Cur < List.end() && *Cur != ',')
-+ if (Cur < List.data()+List.size() && *Cur != ',')
- continue;
-
- // Match the end of the string..
- if ((Host.size() >= (unsigned)(Cur - Start)) &&
- Cur - Start != 0 &&
-- stringcasecmp(Host.end() - (Cur - Start),Host.end(),Start,Cur) == 0)
-+ stringcasecmp(Host.data()+Host.size() - (Cur - Start),Host.data()+Host.size(),Start,Cur) == 0)
- return true;
-
- Start = Cur + 1;
-diff -urN apt-0.3.19cnc55.org/apt-pkg/contrib/strutl.h apt-0.3.19cnc55/apt-pkg/contrib/strutl.h
---- apt-0.3.19cnc55.org/apt-pkg/contrib/strutl.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/contrib/strutl.h Tue Mar 12 17:18:38 2002
-@@ -24,7 +24,8 @@
- #include <string>
- #include <vector>
- #include <time.h>
--
-+using namespace std;
-+
- char *_strstrip(char *String);
- char *_strtabexpand(char *String,size_t Len);
- bool ParseQuoteWord(const char *&String,string &Res);
-@@ -49,11 +50,11 @@
-
- int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
- inline int stringcmp(const char *A,const char *AEnd,const char *B) {return stringcmp(A,AEnd,B,B+strlen(B));};
--inline int stringcmp(string A,const char *B) {return stringcmp(A.begin(),A.end(),B,B+strlen(B));};
-+inline int stringcmp(string A,const char *B) {return stringcmp(A.data(),A.data()+A.size(),B,B+strlen(B));};
- int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
- inline int stringcasecmp(const char *A,const char *AEnd,const char *B) {return stringcasecmp(A,AEnd,B,B+strlen(B));};
--inline int stringcasecmp(string A,const char *B) {return stringcasecmp(A.begin(),A.end(),B,B+strlen(B));};
--inline int stringcasecmp(string A,string B) {return stringcasecmp(A.begin(),A.end(),B.begin(),B.end());};
-+inline int stringcasecmp(string A,const char *B) {return stringcasecmp(A.data(),A.data()+A.size(),B,B+strlen(B));};
-+inline int stringcasecmp(string A,string B) {return stringcasecmp(A.data(),A.data()+A.size(),B.data(),B.data()+B.size());};
-
- class URI
- {
-diff -urN apt-0.3.19cnc55.org/apt-pkg/deb/deblistparser.cc apt-0.3.19cnc55/apt-pkg/deb/deblistparser.cc
---- apt-0.3.19cnc55.org/apt-pkg/deb/deblistparser.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/deb/deblistparser.cc Tue Mar 12 17:18:31 2002
-@@ -17,6 +17,7 @@
- #include <apt-pkg/crc-16.h>
-
- #include <system.h>
-+#include <ctype.h>
- /*}}}*/
-
- // ListParser::debListParser - Constructor /*{{{*/
-@@ -483,7 +484,7 @@
- if (Section.Find("Architecture",Start,Stop) == false)
- return true;
-
-- if (stringcmp(Start,Stop,Arch.begin(),Arch.end()) == 0)
-+ if (stringcmp(Start,Stop,Arch.data(),Arch.data()+Arch.size()) == 0)
- return true;
-
- if (stringcmp(Start,Stop,"all") == 0)
-diff -urN apt-0.3.19cnc55.org/apt-pkg/deb/debsrcrecords.cc apt-0.3.19cnc55/apt-pkg/deb/debsrcrecords.cc
---- apt-0.3.19cnc55.org/apt-pkg/deb/debsrcrecords.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/deb/debsrcrecords.cc Tue Mar 12 17:18:31 2002
-@@ -33,17 +33,17 @@
- return 0;
- // XXX no bounds check: exploitable?
- // Strip any leading spaces
-- string::const_iterator Start = Bins.begin();
-- for (; Start != Bins.end() && isspace(*Start) != 0; Start++);
-+ const char *Start = Bins.data();
-+ for (; Start != Bins.data()+Bins.size() && isspace(*Start) != 0; Start++);
-
-- string::const_iterator Pos = Start;
-- while (Pos != Bins.end())
-+ const char *Pos = Start;
-+ while (Pos != Bins.data()+Bins.size())
- {
- // Skip to the next ','
-- for (; Pos != Bins.end() && *Pos != ','; Pos++);
-+ for (; Pos != Bins.data()+Bins.size() && *Pos != ','; Pos++);
-
- // Back remove spaces
-- string::const_iterator End = Pos;
-+ const char *End = Pos;
- for (; End > Start && (End[-1] == ',' || isspace(End[-1]) != 0); End--);
-
- // Stash the string
-@@ -54,7 +54,7 @@
- *Buf++ = 0;
-
- // Advance pos
-- for (; Pos != Bins.end() && (*Pos == ',' || isspace(*Pos) != 0); Pos++);
-+ for (; Pos != Bins.data()+Bins.size() && (*Pos == ',' || isspace(*Pos) != 0); Pos++);
- Start = Pos;
- }
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/deb/dpkginit.cc apt-0.3.19cnc55/apt-pkg/deb/dpkginit.cc
---- apt-0.3.19cnc55.org/apt-pkg/deb/dpkginit.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/deb/dpkginit.cc Tue Mar 12 17:18:31 2002
-@@ -23,6 +23,7 @@
- #include <sys/types.h>
- #include <unistd.h>
- #include <dirent.h>
-+#include <ctype.h>
- /*}}}*/
-
- // DpkgLock::pkgDpkgLock - Constructor /*{{{*/
-diff -urN apt-0.3.19cnc55.org/apt-pkg/deb/dpkgpm.cc apt-0.3.19cnc55/apt-pkg/deb/dpkgpm.cc
---- apt-0.3.19cnc55.org/apt-pkg/deb/dpkgpm.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/deb/dpkgpm.cc Tue Mar 12 17:18:31 2002
-@@ -23,6 +23,8 @@
- #include <signal.h>
- #include <errno.h>
- #include <stdio.h>
-+#include <iostream>
-+using namespace std;
- /*}}}*/
-
- // DPkgPM::pkgDPkgPM - Constructor /*{{{*/
-@@ -200,7 +202,7 @@
-
- /* Feed the filename of each package that is pending install
- into the pipe. */
-- if (Fd.Write(I->File.begin(),I->File.length()) == false ||
-+ if (Fd.Write(I->File.data(),I->File.length()) == false ||
- Fd.Write("\n",1) == false)
- {
- kill(Process,SIGINT);
-diff -urN apt-0.3.19cnc55.org/apt-pkg/pkgcache.cc apt-0.3.19cnc55/apt-pkg/pkgcache.cc
---- apt-0.3.19cnc55.org/apt-pkg/pkgcache.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/pkgcache.cc Tue Mar 12 17:18:31 2002
-@@ -144,7 +144,7 @@
- for (const char *I = Str.begin(); I != Str.end(); I++)
- Hash = 5*Hash + tolower(*I);
- #else
-- for (const char *I = Str.begin(); I != Str.end(); I++)
-+ for (const char *I = Str.data(); I != Str.data()+Str.size(); I++)
- Hash = 5*Hash + *I;
- #endif
- return Hash % _count(HeaderP->HashTable);
-@@ -179,7 +179,7 @@
- return PkgIterator(*this,Pkg);
- #else
- if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] &&
-- stringcmp(Name.begin(),Name.end(),StrP + Pkg->Name) == 0)
-+ stringcmp(Name.data(),Name.data()+Name.size(),StrP + Pkg->Name) == 0)
- return PkgIterator(*this,Pkg);
- #endif
- }
-diff -urN apt-0.3.19cnc55.org/apt-pkg/pkgcache.h apt-0.3.19cnc55/apt-pkg/pkgcache.h
---- apt-0.3.19cnc55.org/apt-pkg/pkgcache.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/pkgcache.h Tue Mar 12 17:18:38 2002
-@@ -48,12 +48,12 @@
- class PrvIterator;
- class PkgFileIterator;
- class VerFileIterator;
-- friend PkgIterator;
-- friend VerIterator;
-- friend DepIterator;
-- friend PrvIterator;
-- friend PkgFileIterator;
-- friend VerFileIterator;
-+ friend class PkgIterator;
-+ friend class VerIterator;
-+ friend class DepIterator;
-+ friend class PrvIterator;
-+ friend class PkgFileIterator;
-+ friend class VerFileIterator;
-
- // These are all the constants used in the cache structures
- struct Dep
-diff -urN apt-0.3.19cnc55.org/apt-pkg/pkgcachegen.cc apt-0.3.19cnc55/apt-pkg/pkgcachegen.cc
---- apt-0.3.19cnc55.org/apt-pkg/pkgcachegen.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/pkgcachegen.cc Tue Mar 12 17:18:31 2002
-@@ -108,7 +108,7 @@
- int Res = 1;
- for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
- {
-- Res = _system->versionCompare(Version.begin(),Version.end(),Ver.VerStr(),
-+ Res = _system->versionCompare(Version.data(),Version.data()+Version.size(),Ver.VerStr(),
- Ver.VerStr() + strlen(Ver.VerStr()));
- if (Res >= 0) {
- break;
-@@ -158,7 +158,7 @@
- {
- for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
- {
-- Res = _system->versionCompare(Version.begin(),Version.end(),Ver.VerStr(),
-+ Res = _system->versionCompare(Version.data(),Version.data()+Version.size(),Ver.VerStr(),
- Ver.VerStr() + strlen(Ver.VerStr()));
- if (Res != 0)
- break;
-diff -urN apt-0.3.19cnc55.org/apt-pkg/pkgcachegen.h apt-0.3.19cnc55/apt-pkg/pkgcachegen.h
---- apt-0.3.19cnc55.org/apt-pkg/pkgcachegen.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/pkgcachegen.h Tue Mar 12 17:18:38 2002
-@@ -39,7 +39,7 @@
- public:
-
- class ListParser;
-- friend ListParser;
-+ friend class ListParser;
-
- protected:
-
-@@ -74,7 +74,7 @@
- class pkgCacheGenerator::ListParser
- {
- pkgCacheGenerator *Owner;
-- friend pkgCacheGenerator;
-+ friend class pkgCacheGenerator;
-
- // Some cache items
- pkgCache::VerIterator OldDepVer;
-diff -urN apt-0.3.19cnc55.org/apt-pkg/pkgrecords.h apt-0.3.19cnc55/apt-pkg/pkgrecords.h
---- apt-0.3.19cnc55.org/apt-pkg/pkgrecords.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/pkgrecords.h Tue Mar 12 17:18:38 2002
-@@ -60,7 +60,7 @@
- protected:
-
- public:
-- friend pkgRecords;
-+ friend class pkgRecords;
-
- virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmfactory.h apt-0.3.19cnc55/apt-pkg/rpm/rpmfactory.h
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmfactory.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmfactory.h Tue Mar 12 17:18:38 2002
-@@ -4,7 +4,7 @@
-
- #include <apt-pkg/systemfactory.h>
- #include <map>
--#include <slist>
-+#include <list>
- #include <vector>
-
- class RPMFactory : public SystemFactory
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmlistparser.cc apt-0.3.19cnc55/apt-pkg/rpm/rpmlistparser.cc
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmlistparser.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmlistparser.cc Tue Mar 12 17:18:31 2002
-@@ -80,7 +80,7 @@
- char *p;
-
- #ifdef DUPPACK
-- AllowedDupPackages = new slist<regex_t*>;
-+ AllowedDupPackages = new list<regex_t*>;
-
- const Configuration::Item *Top = _config->Tree("RPM::AllowedDupPkgs");
-
-@@ -108,7 +108,7 @@
- AllowedDupPackages = NULL;//akk
- #endif
-
-- HoldPackages = new slist<regex_t*>;
-+ HoldPackages = new list<regex_t*>;
-
- Top = _config->Tree("RPM::HoldPkgs");
-
-@@ -180,7 +180,7 @@
-
- if (AllowedDupPackages != NULL)
- {
-- for (slist<regex_t*>::iterator iter = AllowedDupPackages->begin();
-+ for (list<regex_t*>::iterator iter = AllowedDupPackages->begin();
- iter != AllowedDupPackages->end();
- iter++)
- {
-@@ -459,7 +459,7 @@
- {
- const char *str = Package().c_str();
-
-- for (slist<regex_t*>::iterator iter = HoldPackages->begin();
-+ for (list<regex_t*>::iterator iter = HoldPackages->begin();
- iter != HoldPackages->end();
- iter++)
- {
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmlistparser.h apt-0.3.19cnc55/apt-pkg/rpm/rpmlistparser.h
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmlistparser.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmlistparser.h Tue Mar 12 17:18:38 2002
-@@ -16,9 +16,10 @@
- #include <apt-pkg/pkgcachegen.h>
- #include <rpm/rpmlib.h>
- #include <map>
--#include <slist>
-+#include <list>
- #include <vector>
- #include <regex.h>
-+using namespace std;
-
- class rpmListParser : public pkgCacheGenerator::ListParser
- {
-@@ -33,10 +34,10 @@
- map<string,string> *multiarchs;
-
- map<string,long> *DupPackages;
-- slist<regex_t*> *AllowedDupPackages;
-+ list<regex_t*> *AllowedDupPackages;
- bool duplicated;
-
-- slist<regex_t*> *HoldPackages;
-+ list<regex_t*> *HoldPackages;
-
- bool parsing_hdlist;
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmpm.cc apt-0.3.19cnc55/apt-pkg/rpm/rpmpm.cc
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmpm.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmpm.cc Tue Mar 12 17:18:31 2002
-@@ -26,6 +26,8 @@
- #include <stdio.h>
-
- #include <string.h>
-+#include <iostream>
-+using namespace std;
-
- #include <i18n.h>
-
-@@ -208,7 +210,7 @@
-
- /* Feed the filename of each package that is pending install
- into the pipe. */
-- if (Fd.Write(I->File.begin(),I->File.length()) == false ||
-+ if (Fd.Write(I->File.data(),I->File.length()) == false ||
- Fd.Write("\n",1) == false)
- {
- kill(Process,SIGINT);
-@@ -229,7 +231,7 @@
-
- /*}}}*/
-
--bool pkgRPMPM::ExecRPM(Operation operation, slist<char*> *files, bool nodeps)
-+bool pkgRPMPM::ExecRPM(Operation operation, list<char*> *files, bool nodeps)
- {
- // Generate the argument list
- const char *Args[10000];
-@@ -330,7 +332,7 @@
- break;
- }
-
-- for (slist<char*>::iterator i = files->begin();
-+ for (list<char*>::iterator i = files->begin();
- i != files->end() && n < sizeof(Args);
- i++)
- {
-@@ -422,9 +424,9 @@
- }
-
-
--bool pkgRPMPM::Process(slist<char*> *install,
-- slist<char*> *upgrade,
-- slist<char*> *uninstall)
-+bool pkgRPMPM::Process(list<char*> *install,
-+ list<char*> *upgrade,
-+ list<char*> *uninstall)
- {
- if (_config->FindB("RPM::Check-Signatures", false) == true)
- {
-@@ -469,9 +471,9 @@
- if (RunScriptsWithPkgs("RPM::Pre-Install-Pkgs") == false)
- return false;
-
-- slist<char*> *install = new slist<char*>;
-- slist<char*> *upgrade = new slist<char*>;
-- slist<char*> *uninstall = new slist<char*>;
-+ list<char*> *install = new list<char*>;
-+ list<char*> *upgrade = new list<char*>;
-+ list<char*> *uninstall = new list<char*>;
-
- for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
- {
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmpm.h apt-0.3.19cnc55/apt-pkg/rpm/rpmpm.h
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmpm.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmpm.h Tue Mar 12 17:18:38 2002
-@@ -17,7 +17,7 @@
-
- #include <apt-pkg/packagemanager.h>
- #include <vector>
--#include <slist>
-+#include <list>
-
-
- class pkgRPMPM : public pkgPackageManager
-@@ -50,10 +50,10 @@
- virtual bool Configure(PkgIterator Pkg);
- virtual bool Remove(PkgIterator Pkg,bool Purge = false);
-
-- bool ExecRPM(Operation operation, slist<char*> *files, bool nodeps);
-- bool Process(slist<char*> *install,
-- slist<char*> *upgrade,
-- slist<char*> *uninstall);
-+ bool ExecRPM(Operation operation, list<char*> *files, bool nodeps);
-+ bool Process(list<char*> *install,
-+ list<char*> *upgrade,
-+ list<char*> *uninstall);
-
- virtual bool Go();
- virtual void Reset();
-diff -urN apt-0.3.19cnc55.org/apt-pkg/rpm/rpmversion.cc apt-0.3.19cnc55/apt-pkg/rpm/rpmversion.cc
---- apt-0.3.19cnc55.org/apt-pkg/rpm/rpmversion.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/rpm/rpmversion.cc Tue Mar 12 17:18:31 2002
-@@ -22,7 +22,7 @@
-
- int RPMFactory::versionCompare(string A,string B)
- {
-- return versionCompare(A.begin(),A.end(),B.begin(),B.end());
-+ return versionCompare(A.data(),A.data()+A.size(),B.data(),B.data()+B.size());
- }
-
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/sourcelist.cc apt-0.3.19cnc55/apt-pkg/sourcelist.cc
---- apt-0.3.19cnc55.org/apt-pkg/sourcelist.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/sourcelist.cc Tue Mar 12 17:21:01 2002
-@@ -22,7 +22,7 @@
-
- #include <i18n.h>
-
--#include <fstream.h>
-+#include <fstream>
- #include <stdio.h>
- #include <unistd.h>
- #include <errno.h>
-@@ -91,7 +91,7 @@
- bool pkgSourceList::Read(string File)
- {
- // Open the stream for reading
-- ifstream F(File.c_str(),ios::in | ios::nocreate);
-+ ifstream F(File.c_str(),ios::in);
- if (!F != 0)
- return _error->Errno("ifstream::ifstream","Opening %s",File.c_str());
-
-diff -urN apt-0.3.19cnc55.org/apt-pkg/sourcelist.h apt-0.3.19cnc55/apt-pkg/sourcelist.h
---- apt-0.3.19cnc55.org/apt-pkg/sourcelist.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/sourcelist.h Tue Mar 12 17:20:20 2002
-@@ -23,7 +23,7 @@
- #include <string>
- #include <vector>
- #include <map>
--#include <iostream.h>
-+#include <iostream>
- #include <apt-pkg/pkgcache.h>
-
- #ifdef __GNUG__
-diff -urN apt-0.3.19cnc55.org/apt-pkg/tagfile.cc apt-0.3.19cnc55/apt-pkg/tagfile.cc
---- apt-0.3.19cnc55.org/apt-pkg/tagfile.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/tagfile.cc Tue Mar 12 17:18:31 2002
-@@ -23,6 +23,8 @@
-
- #include <string>
- #include <stdio.h>
-+#include <iostream>
-+using namespace std;
- /*}}}*/
-
- // TagFile::pkgTagFile - Constructor /*{{{*/
-diff -urN apt-0.3.19cnc55.org/apt-pkg/version.cc apt-0.3.19cnc55/apt-pkg/version.cc
---- apt-0.3.19cnc55.org/apt-pkg/version.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/apt-pkg/version.cc Tue Mar 12 17:18:31 2002
-@@ -50,7 +50,7 @@
-
- int SystemFactory::versionCompare(string A,string B)
- {
-- return versionCompare(A.begin(),A.end(),B.begin(),B.end());
-+ return versionCompare(A.data(),A.data()+A.size(),B.data(),B.data()+B.size());
- }
-
- /*}}}*/
-diff -urN apt-0.3.19cnc55.org/cmdline/apt-cache.cc apt-0.3.19cnc55/cmdline/apt-cache.cc
---- apt-0.3.19cnc55.org/cmdline/apt-cache.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/cmdline/apt-cache.cc Tue Mar 12 17:24:41 2002
-@@ -38,7 +38,7 @@
-
- #include <i18n.h>
-
--#include <iostream.h>
-+#include <iostream>
- #include <unistd.h>
- #include <errno.h>
- #include <regex.h>
-diff -urN apt-0.3.19cnc55.org/cmdline/apt-cdrom.cc apt-0.3.19cnc55/cmdline/apt-cdrom.cc
---- apt-0.3.19cnc55.org/cmdline/apt-cdrom.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/cmdline/apt-cdrom.cc Tue Mar 12 17:31:04 2002
-@@ -34,6 +34,7 @@
- #include <unistd.h>
- #include <stdio.h>
- /*}}}*/
-+using namespace std;
-
- #define PACKAGES "pkglist"
- #define SOURCES "srclist"
-@@ -514,7 +515,8 @@
- string File = _config->FindFile("Dir::Etc::sourcelist");
-
- // Open the stream for reading
-- ifstream F(File.c_str(),ios::in | ios::nocreate);
-+ ifstream F((FileExists(File)?File.c_str():"/dev/null"),
-+ ios::in );
- if (!F != 0)
- return _error->Errno("ifstream::ifstream","Opening %s",File.c_str());
-
-diff -urN apt-0.3.19cnc55.org/cmdline/apt-get.cc apt-0.3.19cnc55/cmdline/apt-get.cc
---- apt-0.3.19cnc55.org/cmdline/apt-get.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/cmdline/apt-get.cc Tue Mar 12 17:28:13 2002
-@@ -54,7 +54,7 @@
-
- #include "acqprogress.h"
-
--#include <fstream.h>
-+#include <fstream>
- #include <termios.h>
- #include <sys/ioctl.h>
- #include <sys/stat.h>
-@@ -66,11 +66,11 @@
- #include <regex.h>
- #include <sys/wait.h>
- /*}}}*/
-+using namespace std;
-
--
--ostream c0out;
--ostream c1out;
--ostream c2out;
-+ostream c0out(0);
-+ostream c1out(0);
-+ostream c2out(0);
- ofstream devnull("/dev/null");
- unsigned int ScreenWidth = 80;
-
-@@ -1202,7 +1202,7 @@
- // Populate it with the source selection
- for (I = List.begin(); I != List.end(); I++)
- {
-- new pkgAcqIndex(&Fetcher,I);
-+ new pkgAcqIndex(&Fetcher,&*I);
- if (_error->PendingError() == true)
- return false;
- }
-diff -urN apt-0.3.19cnc55.org/cmdline/rpmindexcopy.cc apt-0.3.19cnc55/cmdline/rpmindexcopy.cc
---- apt-0.3.19cnc55.org/cmdline/rpmindexcopy.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/cmdline/rpmindexcopy.cc Tue Mar 12 17:31:30 2002
-@@ -7,7 +7,7 @@
- #include <apt-pkg/tagfile.h>
-
-
--#include <iostream.h>
-+#include <iostream>
- #include <unistd.h>
- #include <sys/stat.h>
- #include <stdio.h>
-diff -urN apt-0.3.19cnc55.org/methods/cdrom.cc apt-0.3.19cnc55/methods/cdrom.cc
---- apt-0.3.19cnc55.org/methods/cdrom.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/methods/cdrom.cc Tue Mar 12 17:18:31 2002
-@@ -17,6 +17,8 @@
- #include <utime.h>
- #include <sys/stat.h>
- #include <unistd.h>
-+#include <iostream>
-+using namespace std;
- /*}}}*/
-
- class CDROMMethod : public pkgAcqMethod
-diff -urN apt-0.3.19cnc55.org/methods/gpg.cc apt-0.3.19cnc55/methods/gpg.cc
---- apt-0.3.19cnc55.org/methods/gpg.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/methods/gpg.cc Tue Mar 12 17:18:31 2002
-@@ -8,6 +8,7 @@
- #include <utime.h>
- #include <stdio.h>
- #include <sys/wait.h>
-+#include <ctype.h>
-
-
- class GPGMethod : public pkgAcqMethod
-diff -urN apt-0.3.19cnc55.org/tools/cached_md5.cc apt-0.3.19cnc55/tools/cached_md5.cc
---- apt-0.3.19cnc55.org/tools/cached_md5.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/tools/cached_md5.cc Tue Mar 12 17:40:00 2002
-@@ -38,10 +38,10 @@
- #include <dirent.h>
- #include <errno.h>
- #include <fcntl.h>
-+#include <string.h>
- #include <rpm/rpmlib.h>
- #include <rpm/misc.h>
- #include <stdlib.h>
--#include <string.h>
- #include <sys/stat.h>
- #include <unistd.h>
- #include <assert.h>
-diff -urN apt-0.3.19cnc55.org/tools/cached_md5.h apt-0.3.19cnc55/tools/cached_md5.h
---- apt-0.3.19cnc55.org/tools/cached_md5.h Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/tools/cached_md5.h Tue Mar 12 17:39:18 2002
-@@ -16,6 +16,8 @@
- #include <string>
- #include <map>
-
-+using namespace std;
-+
- class CachedMD5
- {
- string filename;
-diff -urN apt-0.3.19cnc55.org/tools/genpkglist.cc apt-0.3.19cnc55/tools/genpkglist.cc
---- apt-0.3.19cnc55.org/tools/genpkglist.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/tools/genpkglist.cc Tue Mar 12 17:38:11 2002
-@@ -74,6 +74,7 @@
- #include <assert.h>
-
- #include <map>
-+#include <iostream>
-
- #include <apt-pkg/error.h>
- #include <apt-pkg/tagfile.h>
-@@ -82,7 +83,7 @@
-
- #include "cached_md5.h"
-
--
-+using namespace std;
-
- #define CRPMTAG_TIMESTAMP 1012345
-
-diff -urN apt-0.3.19cnc55.org/tools/gensrclist.cc apt-0.3.19cnc55/tools/gensrclist.cc
---- apt-0.3.19cnc55.org/tools/gensrclist.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/tools/gensrclist.cc Tue Mar 12 17:49:06 2002
-@@ -47,8 +47,9 @@
- #include <unistd.h>
- #include <assert.h>
-
-+#include <iostream>
- #include <map>
--#include <slist>
-+#include <list>
-
- #include <apt-pkg/error.h>
- #include <apt-pkg/tagfile.h>
-@@ -56,7 +57,7 @@
-
- #include "cached_md5.h"
-
--
-+using namespace std;
-
-
-
-@@ -105,7 +106,7 @@
- }
- }
-
--bool readRPMTable(char *file, map<string, slist<char*>* > &table)
-+bool readRPMTable(char *file, map<string, list<char*>* > &table)
- {
- FILE *indexf;
- char buf[512];
-@@ -129,14 +130,14 @@
- srpm = string(buf);
-
- if (table.find(srpm) != table.end()) {
-- slist<char*> *list = table[srpm];
-+ list<char*> *xlist = table[srpm];
-
-- list->push_front(strdup(f));
-+ xlist->push_front(strdup(f));
- } else {
-- slist<char*> *list = new slist<char*>;
-+ list<char*> *xlist = new list<char*>;
-
-- list->push_front(strdup(f));
-- table[srpm] = list;
-+ xlist->push_front(strdup(f));
-+ table[srpm] = xlist;
- }
- }
-
-@@ -175,7 +176,7 @@
- char *directory;
- char *index;
- CachedMD5 *md5cache;
-- map<string, slist<char*>* > rpmTable; // table that maps srpm -> generated rpm
-+ map<string, list<char*>* > rpmTable; // table that maps srpm -> generated rpm
- bool mapi = false;
- bool progressBar = false;
- bool flatStructure = false;
-@@ -329,24 +330,24 @@
- foundInIndex = false;
- {
- int count = 0;
-- char **list = NULL;
-- slist<char*> *rpmlist = rpmTable[string(dirEntries[entry_cur]->d_name)];
-+ char **xlist = NULL;
-+ list<char*> *rpmlist = rpmTable[string(dirEntries[entry_cur]->d_name)];
-
- if (rpmlist) {
-- list = new char *[rpmlist->size()];
-+ xlist = new char *[rpmlist->size()];
-
- foundInIndex = true;
-
-- for (slist<char*>::const_iterator i = rpmlist->begin();
-+ for (list<char*>::const_iterator i = rpmlist->begin();
- i != rpmlist->end();
- i++) {
-- list[count++] = *i;
-+ xlist[count++] = *i;
- }
- }
-
- if (count) {
- headerAddEntry(newHeader, CRPMTAG_BINARY,
-- RPM_STRING_ARRAY_TYPE, list, count);
-+ RPM_STRING_ARRAY_TYPE, xlist, count);
- }
- }
- if (foundInIndex || !mapi)
-diff -urN apt-0.3.19cnc55.org/tools/hdlist2pkglist.cc apt-0.3.19cnc55/tools/hdlist2pkglist.cc
---- apt-0.3.19cnc55.org/tools/hdlist2pkglist.cc Tue Mar 12 18:04:10 2002
-+++ apt-0.3.19cnc55/tools/hdlist2pkglist.cc Tue Mar 12 17:50:29 2002
-@@ -36,21 +36,24 @@
- #include <dirent.h>
- #include <errno.h>
- #include <fcntl.h>
-+#include <string.h>
- #include <rpmlib.h>
- #include <rpm/misc.h>
- #include <stdlib.h>
--#include <string.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <assert.h>
-
- #include <map>
-+#include <iostream>
-
- #include <apt-pkg/error.h>
- #include <apt-pkg/tagfile.h>
- #include <apt-pkg/rpminit.h>
-
-+using namespace std;
-+
- // from rpmlib
- extern "C" {
- extern int mdfile(const char *fn, unsigned char *digest);
+++ /dev/null
-diff -Nur apt-0.5.4cnc7.orig/tools/cached_md5.cc apt-0.5.4cnc7/tools/cached_md5.cc
---- apt-0.5.4cnc7.orig/tools/cached_md5.cc Sat Jul 27 01:16:34 2002
-+++ apt-0.5.4cnc7/tools/cached_md5.cc Tue Dec 10 16:59:14 2002
-@@ -25,13 +25,15 @@
-
- extern const char *__progname;
-
-+extern string cache_dir;
-+
- CachedMD5::CachedMD5(string DirName)
- {
- string fname = DirName;
- for (string::iterator i = fname.begin(); i != fname.end(); ++i)
- if ('/' == *i)
- *i = '_';
-- CacheFileName = _config->FindDir("Dir::Cache", "/var/cache/apt") + '/' +
-+ CacheFileName = cache_dir + '/' +
- __progname + '/' + fname + ".md5cache";
-
- FILE *f = fopen(CacheFileName.c_str(), "r");
-diff -Nur apt-0.5.4cnc7.orig/tools/genpkglist.cc apt-0.5.4cnc7/tools/genpkglist.cc
---- apt-0.5.4cnc7.orig/tools/genpkglist.cc Sat Jul 27 01:22:48 2002
-+++ apt-0.5.4cnc7/tools/genpkglist.cc Tue Dec 10 17:04:04 2002
-@@ -340,6 +340,7 @@
- cerr << "options:" << endl;
- cerr << " --index <file> file to write srpm index data to" << endl;
- cerr << " --info <file> file to read update info from" << endl;
-+ cerr << " --cache-dir <dir> use named directory for md5 cache" << endl;
- cerr << " --bloat do not strip the package file list. Needed for some" << endl;
- cerr << " distributions that use non-automatically generated" << endl;
- cerr << " file dependencies" << endl;
-@@ -431,6 +432,7 @@
- // end of new stuff from glibc
- #endif /* !HAVE_SCANDIR */
-
-+string cache_dir;
-
- int main(int argc, char ** argv)
- {
-@@ -449,7 +451,12 @@
- int i;
- bool fullFileList = false;
- bool progressBar = false;
--
-+
-+ if (getenv("TMPDIR"))
-+ cache_dir = getenv("TMPDIR");
-+ else
-+ cache_dir = "/tmp";
-+
- putenv("LC_ALL=");
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--index") == 0) {
-@@ -460,6 +467,14 @@
- cout << "genpkglist: filename missing for option --index"<<endl;
- exit(1);
- }
-+ } else if (strcmp(argv[i], "--cache-dir") == 0) {
-+ i++;
-+ if (i < argc) {
-+ cache_dir = argv[i];
-+ } else {
-+ cout << "genpkglist: filename missing for option --cache-dir"<<endl;
-+ exit(1);
-+ }
- } else if (strcmp(argv[i], "--info") == 0) {
- i++;
- if (i < argc) {
-diff -Nur apt-0.5.4cnc7.orig/tools/gensrclist.cc apt-0.5.4cnc7/tools/gensrclist.cc
---- apt-0.5.4cnc7.orig/tools/gensrclist.cc Sat Jul 27 01:22:48 2002
-+++ apt-0.5.4cnc7/tools/gensrclist.cc Tue Dec 10 17:07:40 2002
-@@ -116,7 +116,7 @@
-
- void usage()
- {
-- cerr << "usage: gensrclist [<options>] <dir> <suffix> <srpm index>" << endl;
-+ cerr << "usage: gensrclist [--cache-dir <dir>] [<options>] <dir> <suffix> <srpm index>" << endl;
- cerr << "options:" << endl;
- // cerr << " --mapi ???????????????????" << endl;
- cerr << " --progress show a progress bar" << endl;
-@@ -124,6 +124,8 @@
- cerr << " are in the same directory level"<<endl;
- }
-
-+string cache_dir = "/var/cache/apt";
-+
- int main(int argc, char ** argv)
- {
- char buf[300];
-@@ -143,6 +145,13 @@
- char *arg_dir, *arg_suffix, *arg_srpmindex;
-
- putenv("LC_ALL=");
-+
-+ if (argv[1] && argv[2] && strcmp(argv[1], "--cache-dir") == 0) {
-+ cache_dir = argv[2];
-+ argv += 2;
-+ argc -= 2;
-+ }
-+
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "--mapi") == 0) {
- mapi = true;
+++ /dev/null
-diff -urN apt-0.3.19cnc55.org/tools/cached_md5.cc apt-0.3.19cnc55/tools/cached_md5.cc
---- apt-0.3.19cnc55.org/tools/cached_md5.cc Sun Feb 17 01:46:11 2002
-+++ apt-0.3.19cnc55/tools/cached_md5.cc Sun Feb 17 01:46:25 2002
-@@ -39,6 +39,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <rpm/rpmlib.h>
-+#include <rpm/misc.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/stat.h>
-diff -urN apt-0.3.19cnc55.org/tools/hdlist2pkglist.cc apt-0.3.19cnc55/tools/hdlist2pkglist.cc
---- apt-0.3.19cnc55.org/tools/hdlist2pkglist.cc Sun Feb 17 01:46:11 2002
-+++ apt-0.3.19cnc55/tools/hdlist2pkglist.cc Sun Feb 17 01:46:46 2002
-@@ -37,6 +37,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <rpmlib.h>
-+#include <rpm/misc.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/stat.h>
+++ /dev/null
-diff -ru /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/acquire-item.cc apt-0.3.19cnc53/apt-pkg/acquire-item.cc
---- /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/acquire-item.cc Mon Nov 12 14:34:00 2001
-+++ apt-0.3.19cnc53/apt-pkg/acquire-item.cc Tue Nov 13 16:26:27 2001
-@@ -480,6 +480,119 @@
-
- Item::Failed(Message,Cnf);
- }
-+
-+ /*}}}*/
-+// AcqMirrors::AcqMirrors - Constructor /*{{{*/
-+// ---------------------------------------------------------------------
-+/* The package file is added to the queue */
-+pkgAcqMirrors::pkgAcqMirrors(pkgAcquire *Owner,
-+ pkgSourceList::RepositoryItem *Location) :
-+ Item(Owner), Location(Location)
-+{
-+ Retries = _config->FindI("Acquire::Retries",0);
-+
-+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
-+ DestFile += URItoFileName(Location->MirrorsURI());
-+
-+ // If we're verifying authentication, check whether the size and
-+ // MD5 matches, if not, delete the cached files and force redownload
-+ string fname = Location->MirrorsURI();
-+ string hash;
-+ unsigned int size;
-+
-+ if (Location->MD5HashForFile(fname, hash, size)
-+ && !hash.empty() && size != 0)
-+ {
-+ string FinalFile = _config->FindDir("Dir::State::lists");
-+ FinalFile += URItoFileName(Location->MirrorsURI());
-+
-+ if (!RecheckFile(FinalFile, hash, size))
-+ {
-+ unlink(FinalFile.c_str());
-+ unlink(DestFile.c_str());
-+ }
-+ }
-+
-+ // Create the item
-+ Desc.URI = Location->MirrorsURI();
-+ Desc.Description = Location->MirrorsInfo();
-+ Desc.Owner = this;
-+
-+ Desc.ShortDesc = Location->Dist;
-+
-+ QueueURI(Desc);
-+}
-+
-+ /*}}}*/
-+// AcqMirrors::Custom600Headers - Insert custom request headers /*{{{*/
-+// ---------------------------------------------------------------------
-+/* The only header we use is the last-modified header. */
-+string pkgAcqMirrors::Custom600Headers()
-+{
-+ string Final = _config->FindDir("Dir::State::lists");
-+ Final += URItoFileName(Location->MirrorsURI());
-+
-+ struct stat Buf;
-+ if (stat(Final.c_str(),&Buf) != 0)
-+ return "\nIndex-File: true";
-+
-+ return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
-+}
-+ /*}}}*/
-+// AcqMirrors::Done - Finished a fetch /*{{{*/
-+// ---------------------------------------------------------------------
-+void pkgAcqMirrors::Done(string Message,unsigned long Size,string MD5,
-+ pkgAcquire::MethodConfig *Cfg)
-+{
-+ Item::Done(Message,Size,MD5,Cfg);
-+
-+ // The files timestamp matches
-+ if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
-+ return;
-+
-+ // Done, move it into position
-+ string FinalFile = _config->FindDir("Dir::State::lists");
-+ FinalFile += URItoFileName(Location->MirrorsURI());
-+ Rename(DestFile,FinalFile);
-+
-+ /* We restore the original name to DestFile so that the clean operation
-+ will work OK */
-+ DestFile = _config->FindDir("Dir::State::lists") + "partial/";
-+ DestFile += URItoFileName(Location->MirrorsURI());
-+}
-+
-+ /*}}}*/
-+// AcqMirrors::Failed - Failure handler /*{{{*/
-+// ---------------------------------------------------------------------
-+/* Here we try other sources */
-+void pkgAcqMirrors::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
-+{
-+ ErrorText = LookupTag(Message,"Message");
-+
-+ // This is the retry counter
-+ if (Retries != 0 &&
-+ Cnf->LocalOnly == false &&
-+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
-+ {
-+ Retries--;
-+ // wait a little before retrying
-+ sleep(1);
-+ QueueURI(Desc);
-+ return;
-+ }
-+
-+ if (Cnf->LocalOnly == true ||
-+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == false)
-+ {
-+ // Ignore this
-+ Status = StatDone;
-+ Complete = false;
-+ Dequeue();
-+ return;
-+ }
-+
-+ Item::Failed(Message,Cnf);
-+}
- /*}}}*/
- // AcqIndexRel::pkgAcqIndexRel - Constructor /*{{{*/
- // ---------------------------------------------------------------------
-@@ -660,6 +773,8 @@
- StoreFilename(StoreFilename), Vf(Version.FileList())
- {
- Retries = _config->FindI("Acquire::Retries",0);
-+ MirrorRetries = _config->FindI("Acquire::MirrorRetries",3);
-+ UsingMirror = false;
-
- if (Version.Arch() == 0)
- {
-@@ -790,8 +905,20 @@
- }
-
- // Create the item
-- Desc.URI = Location->ArchiveURI(PkgFile);
-- Desc.Description = Location->ArchiveInfo(Version);
-+ const pkgSourceList::Item *MirrorLocation = Location->NextMirror(!UsingMirror);
-+ if (MirrorLocation != NULL && MirrorRetries != 0)
-+ {
-+ UsingMirror = true;
-+ Desc.URI = MirrorLocation->ArchiveURI(PkgFile);
-+ Desc.Description = MirrorLocation->ArchiveInfo(Version);
-+ }
-+ else
-+ {
-+ /* Do not set UsingMirror to false here. Once it is used, it must
-+ * stay true, so NextMirror() (above) will reset just once */
-+ Desc.URI = Location->ArchiveURI(PkgFile);
-+ Desc.Description = Location->ArchiveInfo(Version);
-+ }
- Desc.Owner = this;
- Desc.ShortDesc = Version.ParentPkg().Name();
- QueueURI(Desc);
-@@ -866,12 +993,16 @@
- ErrorText = LookupTag(Message,"Message");
- if (QueueNext() == false)
- {
-- // This is the retry counter
-- if (Retries != 0 &&
-- Cnf->LocalOnly == false &&
-- StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
-+ if (((UsingMirror && MirrorRetries != 0) ||
-+ (Retries != 0 &&
-+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)) &&
-+ Cnf->LocalOnly == false)
- {
-- Retries--;
-+ if (UsingMirror && MirrorRetries != 0)
-+ MirrorRetries--;
-+ else
-+ Retries--;
-+
- // wait a little before retrying
- sleep(1);
- Vf = Version.FileList();
-diff -ru /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/acquire-item.h apt-0.3.19cnc53/apt-pkg/acquire-item.h
---- /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/acquire-item.h Mon Nov 12 14:34:00 2001
-+++ apt-0.3.19cnc53/apt-pkg/acquire-item.h Tue Nov 13 16:26:27 2001
-@@ -136,6 +136,9 @@
- pkgCache::VerFileIterator Vf;
- unsigned int Retries;
-
-+ bool UsingMirror;
-+ unsigned int MirrorRetries;
-+
- // Queue the next available file for download.
- bool QueueNext();
-
-@@ -175,6 +178,27 @@
-
- pkgAcqHashes(pkgAcquire *Owner,
- pkgSourceList::RepositoryItem *Location);
-+};
-+
-+// Item class for mirrors files
-+class pkgAcqMirrors : public pkgAcquire::Item
-+{
-+ protected:
-+
-+ pkgSourceList::RepositoryItem *Location;
-+ pkgAcquire::ItemDesc Desc;
-+ unsigned int Retries;
-+
-+ public:
-+
-+ virtual void Done(string Message,unsigned long Size,string Md5Hash,
-+ pkgAcquire::MethodConfig *Cnf);
-+ virtual string DescURI() {return Location->MirrorsURI();};
-+ virtual string Custom600Headers();
-+ virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-+
-+ pkgAcqMirrors(pkgAcquire *Owner,
-+ pkgSourceList::RepositoryItem *Location);
- };
-
- // Fetch a generic file to the current directory
-diff -ru /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/sourcelist.cc apt-0.3.19cnc53/apt-pkg/sourcelist.cc
---- /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/sourcelist.cc Mon Nov 12 14:34:00 2001
-+++ apt-0.3.19cnc53/apt-pkg/sourcelist.cc Tue Nov 13 16:26:27 2001
-@@ -1,3 +1,4 @@
-+
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
- // $Id$
-@@ -183,6 +184,20 @@
- List.push_back(Itm);
- }
- while (ParseQuoteWord(C, Section) == true);
-+
-+ // Parse mirrors file
-+ string MirrorsFile = _config->FindDir("Dir::State::lists");
-+ MirrorsFile += URItoFileName(Rep->MirrorsURI());
-+ static bool recursion = false;
-+ if (!recursion && FileExists(MirrorsFile) && _config->FindB("APT::Use-Mirrors",true))
-+ {
-+ recursion = true;
-+ Rep->Mirrors = new pkgSourceList();
-+ Rep->Mirrors->Read(MirrorsFile);
-+ recursion = false;
-+ } else {
-+ Rep->Mirrors = NULL;
-+ }
-
- Repositories.push_back(Rep);
-
-@@ -345,6 +360,47 @@
- }
-
-
-+string pkgSourceList::RepositoryItem::MirrorsURI()
-+{
-+ string Res;
-+ switch (Type)
-+ {
-+ case Deb:
-+ break;
-+
-+ case DebSrc:
-+ break;
-+
-+ case Rpm:
-+ case RpmSrc:
-+ Res = URI + Dist + "/base/mirrors";
-+ break;
-+ };
-+ return Res;
-+}
-+
-+string pkgSourceList::RepositoryItem::MirrorsInfo()
-+{
-+ string Res;
-+ switch (Type)
-+ {
-+ case Deb:
-+ break;
-+
-+ case DebSrc:
-+ break;
-+
-+ case Rpm:
-+ case RpmSrc:
-+ Res = SiteOnly(URI) + ' ';
-+ Res += Dist + "/";
-+ Res += "base/mirrors";
-+ break;
-+ };
-+ return Res;
-+}
-+
-+
- bool pkgSourceList::RepositoryItem::UpdateHashes(string File)
- {
- // Open the stream for reading
-@@ -721,3 +777,35 @@
- };
- return Res;
- }
-+
-+ /*}}}*/
-+// SourceList::Item::NextMirror - Returns an info line for next mirror to try /*{{{*/
-+// ---------------------------------------------------------------------
-+/* */
-+const pkgSourceList::Item *pkgSourceList::Item::NextMirror(bool reset) const
-+{
-+ pkgSourceList *Mirrors = Repository->Mirrors;
-+ if (Mirrors != NULL && !Mirrors->empty())
-+ {
-+ if (reset)
-+ {
-+ I = Mirrors->begin();
-+ I += random() % Mirrors->size();
-+ EndI = I;
-+ }
-+ while (I != EndI || reset)
-+ {
-+ if (reset)
-+ reset = false;
-+ else
-+ I++;
-+ if (I == Mirrors->end())
-+ I = Mirrors->begin();
-+ if ((*I).Section == Section)
-+ return &(*I);
-+ }
-+ }
-+ return NULL;
-+}
-+
-+
-diff -ru /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/sourcelist.h apt-0.3.19cnc53/apt-pkg/sourcelist.h
---- /home/kojima/rapt/tmp/apt-0.3.19cnc53/apt-pkg/sourcelist.h Mon Nov 12 14:34:00 2001
-+++ apt-0.3.19cnc53/apt-pkg/sourcelist.h Tue Nov 13 16:26:27 2001
-@@ -58,6 +58,8 @@
- map<string,FileData> HashIndex; // filename -> filedata
-
- VendorItem *Vendor;
-+
-+ pkgSourceList *Mirrors;
-
- string URI;
- string Dist;
-@@ -74,6 +76,9 @@
-
- string HashesURI();
- string HashesInfo();
-+
-+ string MirrorsURI();
-+ string MirrorsInfo();
-
- bool UpdateHashes(string File);
-
-@@ -89,6 +94,10 @@
- {
- RepositoryItem *Repository;
- string Section;
-+
-+ mutable vector<Item>::const_iterator I;
-+ mutable vector<Item>::const_iterator EndI;
-+
-
- inline RepositoryType Type() const { return Repository->Type; };
- inline string URI() const { return Repository->URI; };
-@@ -104,6 +113,8 @@
-
- string ArchiveInfo(pkgCache::VerIterator Ver) const;
- string ArchiveURI(string File) const;
-+
-+ const Item *NextMirror(bool reset = false) const;
- };
- typedef vector<Item>::const_iterator const_iterator;
-
-diff -ru /home/kojima/rapt/tmp/apt-0.3.19cnc53/cmdline/apt-get.cc apt-0.3.19cnc53/cmdline/apt-get.cc
---- /home/kojima/rapt/tmp/apt-0.3.19cnc53/cmdline/apt-get.cc Tue Nov 13 16:00:07 2001
-+++ apt-0.3.19cnc53/cmdline/apt-get.cc Tue Nov 13 18:39:27 2001
-@@ -1,6 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- apt-get - Cover for dpkg and rpm
-@@ -1206,6 +1217,17 @@
- if (_error->PendingError() == true)
- return false;
- }
-+
-+ // Add mirrors files
-+ if (_config->FindB("APT::Use-Mirrors",true))
-+ {
-+ for (R = List.rep_begin(); R != List.rep_end(); R++)
-+ {
-+ new pkgAcqMirrors(&Fetcher,*R);
-+ if (_error->PendingError() == true)
-+ return false;
-+ }
-+ }
-
- // Run it
- if (Fetcher.Run() == pkgAcquire::Failed)
-@@ -2045,6 +2067,8 @@
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-+
-+ srandom((unsigned int)time(NULL));
-
- // Parse the command line and initialize the package library
- CommandLine CmdL(Args,_config);
-
+++ /dev/null
-diff -urN apt-0.3.19cnc52.org/apt-pkg/acquire-method.cc apt-0.3.19cnc52/apt-pkg/acquire-method.cc
---- apt-0.3.19cnc52.org/apt-pkg/acquire-method.cc Thu Sep 6 22:20:42 2001
-+++ apt-0.3.19cnc52/apt-pkg/acquire-method.cc Sat Sep 8 13:18:36 2001
-@@ -97,7 +97,8 @@
- if (Queue != 0)
- {
- snprintf(S,sizeof(S)-50,"400 URI Failure\nURI: %s\n"
-- "Message: %s\n",Queue->Uri.c_str(),Err.c_str());
-+ "Message: %s %s\n",Queue->Uri.c_str(),Err.c_str(),
-+ FailExtra.c_str());
-
- // Dequeue
- FetchItem *Tmp = Queue;
-@@ -108,7 +109,8 @@
- }
- else
- snprintf(S,sizeof(S)-50,"400 URI Failure\nURI: <UNKNOWN>\n"
-- "Message: %s\n",Err.c_str());
-+ "Message: %s %s\n",Err.c_str(),
-+ FailExtra.c_str());
-
- // Set the transient flag
- if (Transient == true)
-diff -urN apt-0.3.19cnc52.org/apt-pkg/acquire-method.h apt-0.3.19cnc52/apt-pkg/acquire-method.h
---- apt-0.3.19cnc52.org/apt-pkg/acquire-method.h Thu Sep 6 22:20:42 2001
-+++ apt-0.3.19cnc52/apt-pkg/acquire-method.h Sat Sep 8 13:15:34 2001
-@@ -50,6 +50,7 @@
- vector<string> Messages;
- FetchItem *Queue;
- FetchItem *QueueBack;
-+ string FailExtra;
-
- // Handlers for messages
- virtual bool Configuration(string Message);
-@@ -75,6 +76,7 @@
- void Status(const char *Format,...);
-
- int Run(bool Single = false);
-+ inline void SetFailExtraMsg(string Msg) {FailExtra = Msg;};
-
- pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
- virtual ~pkgAcqMethod() {};
-diff -urN apt-0.3.19cnc52.org/apt-pkg/contrib/strutl.cc apt-0.3.19cnc52/apt-pkg/contrib/strutl.cc
---- apt-0.3.19cnc52.org/apt-pkg/contrib/strutl.cc Thu Sep 6 22:20:42 2001
-+++ apt-0.3.19cnc52/apt-pkg/contrib/strutl.cc Sat Sep 8 12:54:40 2001
-@@ -861,7 +861,29 @@
- return Hits;
- }
- /*}}}*/
--
-+// CheckDomainList - See if Host is in a , seperate list /*{{{*/
-+// ---------------------------------------------------------------------
-+/* The domain list is a comma seperate list of domains that are suffix
-+ matched against the argument */
-+bool CheckDomainList(string Host,string List)
-+{
-+ string::const_iterator Start = List.begin();
-+ for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
-+ {
-+ if (Cur < List.end() && *Cur != ',')
-+ continue;
-+
-+ // Match the end of the string..
-+ if ((Host.size() >= (unsigned)(Cur - Start)) &&
-+ Cur - Start != 0 &&
-+ stringcasecmp(Host.end() - (Cur - Start),Host.end(),Start,Cur) == 0)
-+ return true;
-+
-+ Start = Cur + 1;
-+ }
-+ return false;
-+}
-+ /*}}}*/
- // URI::CopyFrom - Copy from an object /*{{{*/
- // ---------------------------------------------------------------------
- /* This parses the URI into all of its components */
-diff -urN apt-0.3.19cnc52.org/apt-pkg/contrib/strutl.h apt-0.3.19cnc52/apt-pkg/contrib/strutl.h
---- apt-0.3.19cnc52.org/apt-pkg/contrib/strutl.h Thu Sep 6 22:20:42 2001
-+++ apt-0.3.19cnc52/apt-pkg/contrib/strutl.h Sat Sep 8 12:53:14 2001
-@@ -45,6 +45,7 @@
- unsigned int Length);
- bool TokSplitString(char Tok,char *Input,char **List,
- unsigned long ListMax);
-+bool CheckDomainList(string Host,string List);
-
- int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
- inline int stringcmp(const char *A,const char *AEnd,const char *B) {return stringcmp(A,AEnd,B,B+strlen(B));};
-diff -urN apt-0.3.19cnc52.org/methods/connect.cc apt-0.3.19cnc52/methods/connect.cc
---- apt-0.3.19cnc52.org/methods/connect.cc Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/connect.cc Tue Feb 20 08:03:18 2001
-@@ -1,6 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- Connect - Replacement connect call
-@@ -30,6 +30,18 @@
- static struct addrinfo *LastHostAddr = 0;
- static struct addrinfo *LastUsed = 0;
-
-+// RotateDNS - Select a new server from a DNS rotation /*{{{*/
-+// ---------------------------------------------------------------------
-+/* This is called during certain errors in order to recover by selecting a
-+ new server */
-+void RotateDNS()
-+{
-+ if (LastUsed != 0 && LastUsed->ai_next != 0)
-+ LastUsed = LastUsed->ai_next;
-+ else
-+ LastUsed = LastHostAddr;
-+}
-+ /*}}}*/
- // DoConnect - Attempt a connect operation /*{{{*/
- // ---------------------------------------------------------------------
- /* This helper function attempts a connection to a single address. */
-@@ -38,28 +50,44 @@
- {
- // Show a status indicator
- char Name[NI_MAXHOST];
-- Name[0] = 0;
-+ char Service[NI_MAXSERV];
-+
-+ Name[0] = 0;
-+ Service[0] = 0;
- getnameinfo(Addr->ai_addr,Addr->ai_addrlen,
-- Name,sizeof(Name),0,0,NI_NUMERICHOST);
-+ Name,sizeof(Name),Service,sizeof(Service),
-+ NI_NUMERICHOST|NI_NUMERICSERV);
- Owner->Status("Connecting to %s (%s)",Host.c_str(),Name);
--
-+
-+ /* If this is an IP rotation store the IP we are using.. If something goes
-+ wrong this will get tacked onto the end of the error message */
-+ if (LastHostAddr->ai_next != 0)
-+ {
-+ char Name2[NI_MAXHOST + NI_MAXSERV + 10];
-+ snprintf(Name2,sizeof(Name2),"[IP: %s %s]",Name,Service);
-+ Owner->SetFailExtraMsg(string(Name2));
-+ }
-+ else
-+ Owner->SetFailExtraMsg("");
-+
- // Get a socket
- if ((Fd = socket(Addr->ai_family,Addr->ai_socktype,
- Addr->ai_protocol)) < 0)
-- return _error->Errno("socket","Could not create a socket");
-+ return _error->Errno("socket","Could not create a socket for %s (f=%u t=%u p=%u)",
-+ Name,Addr->ai_family,Addr->ai_socktype,Addr->ai_protocol);
-
- SetNonBlock(Fd,true);
- if (connect(Fd,Addr->ai_addr,Addr->ai_addrlen) < 0 &&
- errno != EINPROGRESS)
- return _error->Errno("connect","Cannot initiate the connection "
-- "to %s (%s).",Host.c_str(),Name);
-+ "to %s:%s (%s).",Host.c_str(),Service,Name);
-
- /* This implements a timeout for connect by opening the connection
- nonblocking */
- if (WaitFd(Fd,true,TimeOut) == false)
-- return _error->Error("Could not connect to %s (%s), "
-- "connection timed out",Host.c_str(),Name);
--
-+ return _error->Error("Could not connect to %s:%s (%s), "
-+ "connection timed out",Host.c_str(),Service,Name);
-+
- // Check the socket for an error condition
- unsigned int Err;
- unsigned int Len = sizeof(Err);
-@@ -67,8 +95,12 @@
- return _error->Errno("getsockopt","Failed");
-
- if (Err != 0)
-- return _error->Error("Could not connect to %s (%s).",Host.c_str(),Name);
--
-+ {
-+ errno = Err;
-+ return _error->Errno("connect","Could not connect to %s:%s (%s).",Host.c_str(),
-+ Service,Name);
-+ }
-+
- return true;
- }
- /*}}}*/
-@@ -80,6 +112,13 @@
- {
- if (_error->PendingError() == true)
- return false;
-+
-+ // Convert the port name/number
-+ char ServStr[300];
-+ if (Port != 0)
-+ snprintf(ServStr,sizeof(ServStr),"%u",Port);
-+ else
-+ snprintf(ServStr,sizeof(ServStr),"%s",Service);
-
- /* We used a cached address record.. Yes this is against the spec but
- the way we have setup our rotating dns suggests that this is more
-@@ -88,59 +127,49 @@
- {
- Owner->Status("Connecting to %s",Host.c_str());
-
-- // Lookup the host
-- char S[300];
-- if (Port != 0)
-- snprintf(S,sizeof(S),"%u",Port);
-- else
-- snprintf(S,sizeof(S),"%s",Service);
--
- // Free the old address structure
- if (LastHostAddr != 0)
- {
- freeaddrinfo(LastHostAddr);
- LastHostAddr = 0;
-+ LastUsed = 0;
- }
-
- // We only understand SOCK_STREAM sockets.
- struct addrinfo Hints;
- memset(&Hints,0,sizeof(Hints));
- Hints.ai_socktype = SOCK_STREAM;
-- Hints.ai_protocol = IPPROTO_TCP; // Right?
-+ Hints.ai_protocol = 0;
-
- // Resolve both the host and service simultaneously
- while (1)
- {
- int Res;
-- if ((Res = getaddrinfo(Host.c_str(),S,&Hints,&LastHostAddr)) != 0 ||
-+ if ((Res = getaddrinfo(Host.c_str(),ServStr,&Hints,&LastHostAddr)) != 0 ||
- LastHostAddr == 0)
- {
- if (Res == EAI_NONAME || Res == EAI_SERVICE)
- {
- if (DefPort != 0)
- {
-- snprintf(S,sizeof(S),"%u",DefPort);
-+ snprintf(ServStr,sizeof(ServStr),"%u",DefPort);
- DefPort = 0;
- continue;
- }
- return _error->Error("Could not resolve '%s'",Host.c_str());
- }
-
-- return _error->Error("Something wicked happend resolving '%s/%s'",
-- Host.c_str(),S);
-+ return _error->Error("Something wicked happened resolving '%s:%s' (%i)",
-+ Host.c_str(),ServStr,Res);
- }
- break;
- }
-
-- if (LastHostAddr->ai_family == AF_UNIX)
-- return _error->Error("getaddrinfo returned a unix domain socket\n");
--
- LastHost = Host;
- LastPort = Port;
-- LastUsed = 0;
- }
-
-- // Get the printable IP address
-+ // When we have an IP rotation stay with the last IP.
- struct addrinfo *CurHost = LastHostAddr;
- if (LastUsed != 0)
- CurHost = LastUsed;
-@@ -155,14 +184,28 @@
- close(Fd);
- Fd = -1;
-
-- CurHost = CurHost->ai_next;
-- LastUsed = 0;
-+ // Ignore UNIX domain sockets
-+ do
-+ {
-+ CurHost = CurHost->ai_next;
-+ }
-+ while (CurHost != 0 && CurHost->ai_family == AF_UNIX);
-+
-+ /* If we reached the end of the search list then wrap around to the
-+ start */
-+ if (CurHost == 0 && LastUsed != 0)
-+ CurHost = LastHostAddr;
-+
-+ // Reached the end of the search cycle
-+ if (CurHost == LastUsed)
-+ break;
-+
- if (CurHost != 0)
- _error->Discard();
-- }
--
-+ }
-+
- if (_error->PendingError() == true)
-- return false;
-- return _error->Error("Unable to connect to '%s'",Host.c_str());
-+ return false;
-+ return _error->Error("Unable to connect to %s %s:",Host.c_str(),ServStr);
- }
- /*}}}*/
-diff -urN apt-0.3.19cnc52.org/methods/connect.h apt-0.3.19cnc52/methods/connect.h
---- apt-0.3.19cnc52.org/methods/connect.h Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/connect.h Tue Feb 20 08:03:18 2001
-@@ -1,6 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- Connect - Replacement connect call
-@@ -15,5 +15,6 @@
-
- bool Connect(string To,int Port,const char *Service,int DefPort,
- int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner);
-+void RotateDNS();
-
- #endif
-diff -urN apt-0.3.19cnc52.org/methods/ftp.cc apt-0.3.19cnc52/methods/ftp.cc
---- apt-0.3.19cnc52.org/methods/ftp.cc Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/ftp.cc Sat Sep 8 12:33:40 2001
-@@ -1,9 +1,9 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
-- HTTP Aquire Method - This is the FTP aquire method for APT.
-+ FTP Aquire Method - This is the FTP aquire method for APT.
-
- This is a very simple implementation that does not try to optimize
- at all. Commands are sent syncronously with the FTP server (as the
-@@ -28,6 +28,7 @@
- #include <stdio.h>
- #include <errno.h>
- #include <stdarg.h>
-+#include <iostream>
-
- // Internet stuff
- #include <netinet/in.h>
-@@ -40,6 +41,22 @@
- #include "ftp.h"
- /*}}}*/
-
-+using namespace std;
-+
-+/* This table is for the EPRT and EPSV commands, it maps the OS address
-+ family to the IETF address families */
-+struct AFMap
-+{
-+ unsigned long Family;
-+ unsigned long IETFFamily;
-+};
-+
-+#ifndef AF_INET6
-+struct AFMap AFMap[] = {{AF_INET,1},{}};
-+#else
-+struct AFMap AFMap[] = {{AF_INET,1},{AF_INET6,2},{}};
-+#endif
-+
- unsigned long TimeOut = 120;
- URI Proxy;
- string FtpMethod::FailFile;
-@@ -53,7 +70,7 @@
- DataListenFd(-1), ServerName(Srv)
- {
- Debug = _config->FindB("Debug::Acquire::Ftp",false);
-- memset(&PasvAddr,0,sizeof(PasvAddr));
-+ PasvAddr = 0;
- }
- /*}}}*/
- // FTPConn::~FTPConn - Destructor /*{{{*/
-@@ -75,7 +92,10 @@
- DataFd = -1;
- close(DataListenFd);
- DataListenFd = -1;
-- memset(&PasvAddr,0,sizeof(PasvAddr));
-+
-+ if (PasvAddr != 0)
-+ freeaddrinfo(PasvAddr);
-+ PasvAddr = 0;
- }
- /*}}}*/
- // FTPConn::Open - Open a new connection /*{{{*/
-@@ -89,7 +109,7 @@
- return true;
-
- Close();
--
-+
- // Determine the proxy setting
- if (getenv("ftp_proxy") == 0)
- {
-@@ -108,32 +128,13 @@
- else
- Proxy = getenv("ftp_proxy");
-
-- // Parse no_proxy, a , seperated list of domains
-+ // Parse no_proxy, a , separated list of domains
- if (getenv("no_proxy") != 0)
- {
-- const char *Start = getenv("no_proxy");
-- const char *ServerEnd = ServerName.Host.end();
--
-- for (const char *Cur = Start; true ; Cur++)
-- {
-- if (*Cur != ',' && *Cur != 0)
-- continue;
--
-- // match end of the string
-- if ((ServerName.Host.size() >= (Cur - Start))
-- && stringcasecmp(ServerEnd - (Cur - Start),
-- ServerEnd,Start,Cur) == 0)
-- {
-- Proxy = "";
-- break;
-- }
--
-- Start = Cur + 1;
-- if (*Cur == 0)
-- break;
-- }
-+ if (CheckDomainList(ServerName.Host,getenv("no_proxy")) == true)
-+ Proxy = "";
- }
--
-+
- // Determine what host and port to use based on the proxy settings
- int Port = 0;
- string Host;
-@@ -150,15 +151,27 @@
- Host = Proxy.Host;
- }
-
-- // Connect to the remote server
-+ /* Connect to the remote server. Since FTP is connection oriented we
-+ want to make sure we get a new server every time we reconnect */
-+ RotateDNS();
- if (Connect(Host,Port,"ftp",21,ServerFd,TimeOut,Owner) == false)
- return false;
-- socklen_t Len = sizeof(Peer);
-- if (getpeername(ServerFd,(sockaddr *)&Peer,&Len) != 0)
-+
-+ // Login must be before getpeername otherwise dante won't work.
-+ Owner->Status("Logging in");
-+ bool Res = Login();
-+
-+ // Get the remote server's address
-+ PeerAddrLen = sizeof(PeerAddr);
-+ if (getpeername(ServerFd,(sockaddr *)&PeerAddr,&PeerAddrLen) != 0)
- return _error->Errno("getpeername","Unable to determine the peer name");
-
-- Owner->Status("Logging in");
-- return Login();
-+ // Get the local machine's address
-+ ServerAddrLen = sizeof(ServerAddr);
-+ if (getsockname(ServerFd,(sockaddr *)&ServerAddr,&ServerAddrLen) != 0)
-+ return _error->Errno("getsockname","Unable to determine the local name");
-+
-+ return Res;
- }
- /*}}}*/
- // FTPConn::Login - Login to the remote server /*{{{*/
-@@ -172,11 +185,7 @@
-
- // Setup the variables needed for authentication
- string User = "anonymous";
-- string Pass;
-- if (0) //akk
-- Pass = "apt_get_ftp_2.0@debian.linux.user";
-- else
-- Pass = "apt_get_ftp_2.0@conectiva.linux.user";
-+ string Pass = "apt_get_ftp_2.0@pld.linux.user";
-
- // Fill in the user/pass
- if (ServerName.User.empty() == false)
-@@ -209,7 +218,7 @@
- if (_config->Exists("Acquire::FTP::Passive::" + ServerName.Host) == true)
- TryPassive = _config->FindB("Acquire::FTP::Passive::" + ServerName.Host,true);
- else
-- TryPassive = _config->FindB("Acquire::FTP::Passive",true);
-+ TryPassive = _config->FindB("Acquire::FTP::Passive",true);
- }
- else
- {
-@@ -266,6 +275,12 @@
- }
- }
-
-+ // Force the use of extended commands
-+ if (_config->Exists("Acquire::FTP::ForceExtended::" + ServerName.Host) == true)
-+ ForceExtended = _config->FindB("Acquire::FTP::ForceExtended::" + ServerName.Host,true);
-+ else
-+ ForceExtended = _config->FindB("Acquire::FTP::ForceExtended",false);
-+
- // Binary mode
- if (WriteMsg(Tag,Msg,"TYPE I") == false)
- return false;
-@@ -313,6 +328,8 @@
-
- // Suck it back
- int Res = read(ServerFd,Buffer + Len,sizeof(Buffer) - Len);
-+ if (Res == 0)
-+ _error->Error("Server closed the connection");
- if (Res <= 0)
- {
- _error->Errno("read","Read error");
-@@ -439,10 +456,19 @@
- // ---------------------------------------------------------------------
- /* Try to enter passive mode, the return code does not indicate if passive
- mode could or could not be established, only if there was a fatal error.
-- Borrowed mostly from lftp. We have to enter passive mode every time
-- we make a data connection :| */
-+ We have to enter passive mode every time we make a data connection :| */
- bool FTPConn::GoPasv()
- {
-+ /* The PASV command only works on IPv4 sockets, even though it could
-+ in theory suppory IPv6 via an all zeros reply */
-+ if (((struct sockaddr *)&PeerAddr)->sa_family != AF_INET ||
-+ ForceExtended == true)
-+ return ExtGoPasv();
-+
-+ if (PasvAddr != 0)
-+ freeaddrinfo(PasvAddr);
-+ PasvAddr = 0;
-+
- // Try to enable pasv mode
- unsigned int Tag;
- string Msg;
-@@ -452,41 +478,139 @@
- // Unsupported function
- string::size_type Pos = Msg.find('(');
- if (Tag >= 400 || Pos == string::npos)
-- {
-- memset(&PasvAddr,0,sizeof(PasvAddr));
- return true;
-- }
-
- // Scan it
- unsigned a0,a1,a2,a3,p0,p1;
- if (sscanf(Msg.c_str() + Pos,"(%u,%u,%u,%u,%u,%u)",&a0,&a1,&a2,&a3,&p0,&p1) != 6)
-+ return true;
-+
-+ /* Some evil servers return 0 to mean their addr. We can actually speak
-+ to these servers natively using IPv6 */
-+ if (a0 == 0 && a1 == 0 && a2 == 0 && a3 == 0)
- {
-- memset(&PasvAddr,0,sizeof(PasvAddr));
-+ // Get the IP in text form
-+ char Name[NI_MAXHOST];
-+ char Service[NI_MAXSERV];
-+ getnameinfo((struct sockaddr *)&PeerAddr,PeerAddrLen,
-+ Name,sizeof(Name),Service,sizeof(Service),
-+ NI_NUMERICHOST|NI_NUMERICSERV);
-+
-+ struct addrinfo Hints;
-+ memset(&Hints,0,sizeof(Hints));
-+ Hints.ai_socktype = SOCK_STREAM;
-+ Hints.ai_family = ((struct sockaddr *)&PeerAddr)->sa_family;
-+ Hints.ai_flags |= AI_NUMERICHOST;
-+
-+ // Get a new passive address.
-+ char Port[100];
-+ snprintf(Port,sizeof(Port),"%u",(p0 << 8) + p1);
-+ if (getaddrinfo(Name,Port,&Hints,&PasvAddr) != 0)
-+ return true;
- return true;
- }
-
-- // lftp used this horrid byte order manipulation.. Ik.
-- PasvAddr.sin_family = AF_INET;
-- unsigned char *a;
-- unsigned char *p;
-- a = (unsigned char *)&PasvAddr.sin_addr;
-- p = (unsigned char *)&PasvAddr.sin_port;
-+ struct addrinfo Hints;
-+ memset(&Hints,0,sizeof(Hints));
-+ Hints.ai_socktype = SOCK_STREAM;
-+ Hints.ai_family = AF_INET;
-+ Hints.ai_flags |= AI_NUMERICHOST;
-+
-+ // Get a new passive address.
-+ char Port[100];
-+ snprintf(Port,sizeof(Port),"%u",(p0 << 8) + p1);
-+ char Name[100];
-+ snprintf(Name,sizeof(Name),"%u.%u.%u.%u",a0,a1,a2,a3);
-+ if (getaddrinfo(Name,Port,&Hints,&PasvAddr) != 0)
-+ return true;
-+ return true;
-+}
-+ /*}}}*/
-+// FTPConn::ExtGoPasv - Enter Extended Passive mode /*{{{*/
-+// ---------------------------------------------------------------------
-+/* Try to enter extended passive mode. See GoPasv above and RFC 2428 */
-+bool FTPConn::ExtGoPasv()
-+{
-+ if (PasvAddr != 0)
-+ freeaddrinfo(PasvAddr);
-+ PasvAddr = 0;
-
-- // Some evil servers return 0 to mean their addr
-- if (a0 == 0 && a1 == 0 && a2 == 0 && a3 == 0)
-+ // Try to enable pasv mode
-+ unsigned int Tag;
-+ string Msg;
-+ if (WriteMsg(Tag,Msg,"EPSV") == false)
-+ return false;
-+
-+ // Unsupported function
-+ string::size_type Pos = Msg.find('(');
-+ if (Tag >= 400 || Pos == string::npos)
-+ return true;
-+
-+ // Scan it
-+ string::const_iterator List[4];
-+ unsigned Count = 0;
-+ Pos++;
-+ for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++)
- {
-- PasvAddr.sin_addr = Peer.sin_addr;
-+ if (*I != Msg[Pos])
-+ continue;
-+ if (Count >= 4)
-+ return true;
-+ List[Count++] = I;
-+ }
-+ if (Count != 4)
-+ return true;
-+
-+ // Break it up ..
-+ unsigned long Proto = 0;
-+ unsigned long Port = 0;
-+ string IP;
-+ IP = string(List[1]+1,List[2]);
-+ Port = atoi(string(List[2]+1,List[3]).c_str());
-+ if (IP.empty() == false)
-+ Proto = atoi(string(List[0]+1,List[1]).c_str());
-+
-+ if (Port == 0)
-+ return false;
-+
-+ // String version of the port
-+ char PStr[100];
-+ snprintf(PStr,sizeof(PStr),"%lu",Port);
-+
-+ // Get the IP in text form
-+ struct addrinfo Hints;
-+ memset(&Hints,0,sizeof(Hints));
-+ Hints.ai_socktype = SOCK_STREAM;
-+ Hints.ai_flags |= AI_NUMERICHOST;
-+
-+ /* The RFC defined case, connect to the old IP/protocol using the
-+ new port. */
-+ if (IP.empty() == true)
-+ {
-+ // Get the IP in text form
-+ char Name[NI_MAXHOST];
-+ char Service[NI_MAXSERV];
-+ getnameinfo((struct sockaddr *)&PeerAddr,PeerAddrLen,
-+ Name,sizeof(Name),Service,sizeof(Service),
-+ NI_NUMERICHOST|NI_NUMERICSERV);
-+ IP = Name;
-+ Hints.ai_family = ((struct sockaddr *)&PeerAddr)->sa_family;
- }
- else
- {
-- a[0] = a0;
-- a[1] = a1;
-- a[2] = a2;
-- a[3] = a3;
-+ // Get the family..
-+ Hints.ai_family = 0;
-+ for (unsigned J = 0; AFMap[J].Family != 0; J++)
-+ if (AFMap[J].IETFFamily == Proto)
-+ Hints.ai_family = AFMap[J].Family;
-+ if (Hints.ai_family == 0)
-+ return true;
- }
-
-- p[0] = p0;
-- p[1] = p1;
-+ // Get a new passive address.
-+ int Res;
-+ if ((Res = getaddrinfo(IP.c_str(),PStr,&Hints,&PasvAddr)) != 0)
-+ return true;
-
- return true;
- }
-@@ -547,34 +671,35 @@
- return false;
-
- // Oops, didn't work out, don't bother trying again.
-- if (PasvAddr.sin_port == 0)
-+ if (PasvAddr == 0)
- TryPassive = false;
- }
-
- // Passive mode?
-- if (PasvAddr.sin_port != 0)
-+ if (PasvAddr != 0)
- {
- // Get a socket
-- if ((DataFd = socket(AF_INET,SOCK_STREAM,0)) < 0)
-+ if ((DataFd = socket(PasvAddr->ai_family,PasvAddr->ai_socktype,
-+ PasvAddr->ai_protocol)) < 0)
- return _error->Errno("socket","Could not create a socket");
-
- // Connect to the server
- SetNonBlock(DataFd,true);
-- if (connect(DataFd,(sockaddr *)&PasvAddr,sizeof(PasvAddr)) < 0 &&
-+ if (connect(DataFd,PasvAddr->ai_addr,PasvAddr->ai_addrlen) < 0 &&
- errno != EINPROGRESS)
- return _error->Errno("socket","Could not create a socket");
-
- /* This implements a timeout for connect by opening the connection
- nonblocking */
-- if (WaitFd(ServerFd,true,TimeOut) == false)
-+ if (WaitFd(DataFd,true,TimeOut) == false)
- return _error->Error("Could not connect data socket, connection timed out");
- unsigned int Err;
- unsigned int Len = sizeof(Err);
-- if (getsockopt(ServerFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0)
-+ if (getsockopt(DataFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0)
- return _error->Errno("getsockopt","Failed");
- if (Err != 0)
-- return _error->Error("Could not connect.");
--
-+ return _error->Error("Could not connect passive socket.");
-+
- return true;
- }
-
-@@ -582,43 +707,91 @@
- close(DataListenFd);
- DataListenFd = -1;
-
-- // Get a socket
-- if ((DataListenFd = socket(AF_INET,SOCK_STREAM,0)) < 0)
-+ // Get the information for a listening socket.
-+ struct addrinfo *BindAddr = 0;
-+ struct addrinfo Hints;
-+ memset(&Hints,0,sizeof(Hints));
-+ Hints.ai_socktype = SOCK_STREAM;
-+ Hints.ai_flags |= AI_PASSIVE;
-+ Hints.ai_family = ((struct sockaddr *)&ServerAddr)->sa_family;
-+ int Res;
-+ if ((Res = getaddrinfo(0,"0",&Hints,&BindAddr)) != 0)
-+ return _error->Error("getaddrinfo was unable to get a listening socket");
-+
-+ // Construct the socket
-+ if ((DataListenFd = socket(BindAddr->ai_family,BindAddr->ai_socktype,
-+ BindAddr->ai_protocol)) < 0)
-+ {
-+ freeaddrinfo(BindAddr);
- return _error->Errno("socket","Could not create a socket");
-+ }
-
- // Bind and listen
-- sockaddr_in Addr;
-- memset(&Addr,0,sizeof(Addr));
-- if (bind(DataListenFd,(sockaddr *)&Addr,sizeof(Addr)) < 0)
-+ if (bind(DataListenFd,BindAddr->ai_addr,BindAddr->ai_addrlen) < 0)
-+ {
-+ freeaddrinfo(BindAddr);
- return _error->Errno("bind","Could not bind a socket");
-+ }
-+ freeaddrinfo(BindAddr);
- if (listen(DataListenFd,1) < 0)
- return _error->Errno("listen","Could not listen on the socket");
- SetNonBlock(DataListenFd,true);
-
- // Determine the name to send to the remote
-- sockaddr_in Addr2;
-- socklen_t Jnk = sizeof(Addr);
-- if (getsockname(DataListenFd,(sockaddr *)&Addr,&Jnk) < 0)
-- return _error->Errno("getsockname","Could not determine the socket's name");
-- Jnk = sizeof(Addr2);
-- if (getsockname(ServerFd,(sockaddr *)&Addr2,&Jnk) < 0)
-+ struct sockaddr_storage Addr;
-+ socklen_t AddrLen = sizeof(Addr);
-+ if (getsockname(DataListenFd,(sockaddr *)&Addr,&AddrLen) < 0)
- return _error->Errno("getsockname","Could not determine the socket's name");
--
-- // This bit ripped from qftp
-- unsigned long badr = ntohl(*(unsigned long *)&Addr2.sin_addr);
-- unsigned long bp = ntohs(Addr.sin_port);
-
-- // Send the port command
-+ // Reverse the address. We need the server address and the data port.
-+ char Name[NI_MAXHOST];
-+ char Service[NI_MAXSERV];
-+ char Service2[NI_MAXSERV];
-+ getnameinfo((struct sockaddr *)&Addr,AddrLen,
-+ Name,sizeof(Name),Service,sizeof(Service),
-+ NI_NUMERICHOST|NI_NUMERICSERV);
-+ getnameinfo((struct sockaddr *)&ServerAddr,ServerAddrLen,
-+ Name,sizeof(Name),Service2,sizeof(Service2),
-+ NI_NUMERICHOST|NI_NUMERICSERV);
-+
-+ // Send off an IPv4 address in the old port format
-+ if (((struct sockaddr *)&Addr)->sa_family == AF_INET &&
-+ ForceExtended == false)
-+ {
-+ // Convert the dots in the quad into commas
-+ for (char *I = Name; *I != 0; I++)
-+ if (*I == '.')
-+ *I = ',';
-+ unsigned long Port = atoi(Service);
-+
-+ // Send the port command
-+ unsigned int Tag;
-+ string Msg;
-+ if (WriteMsg(Tag,Msg,"PORT %s,%d,%d",
-+ Name,
-+ (int)(Port >> 8) & 0xff, (int)(Port & 0xff)) == false)
-+ return false;
-+ if (Tag >= 400)
-+ return _error->Error("Unable to send PORT command");
-+ return true;
-+ }
-+
-+ // Construct an EPRT command
-+ unsigned Proto = 0;
-+ for (unsigned J = 0; AFMap[J].Family != 0; J++)
-+ if (AFMap[J].Family == ((struct sockaddr *)&Addr)->sa_family)
-+ Proto = AFMap[J].IETFFamily;
-+ if (Proto == 0)
-+ return _error->Error("Unkonwn address family %u (AF_*)",
-+ ((struct sockaddr *)&Addr)->sa_family);
-+
-+ // Send the EPRT command
- unsigned int Tag;
- string Msg;
-- if (WriteMsg(Tag,Msg,"PORT %d,%d,%d,%d,%d,%d",
-- (int) (badr >> 24) & 0xff, (int) (badr >> 16) & 0xff,
-- (int) (badr >> 8) & 0xff, (int) badr & 0xff,
-- (int) (bp >> 8) & 0xff, (int) bp & 0xff) == false)
-+ if (WriteMsg(Tag,Msg,"EPRT |%u|%s|%s|",Proto,Name,Service) == false)
- return false;
- if (Tag >= 400)
-- return _error->Error("Unable to send port command");
--
-+ return _error->Error("EPRT failed, server said: %s",Msg.c_str());
- return true;
- }
- /*}}}*/
-@@ -629,7 +802,7 @@
- bool FTPConn::Finalize()
- {
- // Passive mode? Do nothing
-- if (PasvAddr.sin_port != 0)
-+ if (PasvAddr != 0)
- return true;
-
- // Close any old socket..
-@@ -906,18 +1079,20 @@
-
- int main(int argc,const char *argv[])
- {
-- /* See if we should become the http client - we do this for http
-+ /* See if we should be come the http client - we do this for http
- proxy urls */
- if (getenv("ftp_proxy") != 0)
- {
- URI Proxy = string(getenv("ftp_proxy"));
-
-+ // Run the HTTP method
- if (Proxy.Access == "http")
- {
- // Copy over the environment setting
- char S[300];
- snprintf(S,sizeof(S),"http_proxy=%s",getenv("ftp_proxy"));
- putenv(S);
-+ putenv("no_proxy=");
-
- // Run the http method
- string Path = flNotFile(argv[0]) + "/http";
-diff -urN apt-0.3.19cnc52.org/methods/ftp.h apt-0.3.19cnc52/methods/ftp.h
---- apt-0.3.19cnc52.org/methods/ftp.h Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/ftp.h Sat Sep 8 12:35:01 2001
-@@ -1,5 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
--// Description /*{{{*/// $Id$
-+// Description /*{{{*/// $Id$
-+// $Id$
- /* ######################################################################
-
- FTP Aquire Method - This is the FTP aquire method for APT.
-@@ -17,12 +18,20 @@
- int DataFd;
- int DataListenFd;
- URI ServerName;
-+ bool ForceExtended;
- bool TryPassive;
- bool Debug;
--
-- struct sockaddr_in PasvAddr;
-- struct sockaddr_in Peer;
-
-+ struct addrinfo *PasvAddr;
-+
-+ // Generic Peer Address
-+ struct sockaddr_storage PeerAddr;
-+ socklen_t PeerAddrLen;
-+
-+ // Generic Server Address (us)
-+ struct sockaddr_storage ServerAddr;
-+ socklen_t ServerAddrLen;
-+
- // Private helper functions
- bool ReadLine(string &Text);
- bool Login();
-@@ -41,6 +50,7 @@
- bool Open(pkgAcqMethod *Owner);
- void Close();
- bool GoPasv();
-+ bool ExtGoPasv();
-
- // Query
- bool Size(const char *Path,unsigned long &Size);
-diff -urN apt-0.3.19cnc52.org/methods/http.cc apt-0.3.19cnc52/methods/http.cc
---- apt-0.3.19cnc52.org/methods/http.cc Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/http.cc Sat Sep 8 12:41:18 2001
-@@ -1,20 +1,18 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- HTTP Aquire Method - This is the HTTP aquire method for APT.
-
- It uses HTTP/1.1 and many of the fancy options there-in, such as
-- pipelining, range, if-range and so on. It accepts on the command line
-- a list of url destination pairs and writes to stdout the status of the
-- operation as defined in the APT method spec.
--
-- It is based on a doubly buffered select loop. All the requests are
-+ pipelining, range, if-range and so on.
-+
-+ It is based on a doubly buffered select loop. A groupe of requests are
- fed into a single output buffer that is constantly fed out the
- socket. This provides ideal pipelining as in many cases all of the
- requests will fit into a single packet. The input socket is buffered
-- the same way and fed into the fd for the file.
-+ the same way and fed into the fd for the file (may be a pipe in future).
-
- This double buffering provides fairly substantial transfer rates,
- compared to wget the http method is about 4% faster. Most importantly,
-@@ -39,6 +37,8 @@
- #include <signal.h>
- #include <stdio.h>
- #include <errno.h>
-+#include <string.h>
-+#include <iostream>
-
- // Internet stuff
- #include <netdb.h>
-@@ -48,6 +48,7 @@
- #include "http.h"
-
- /*}}}*/
-+using namespace std;
-
- string HttpMethod::FailFile;
- int HttpMethod::FailFd = -1;
-@@ -140,7 +141,7 @@
- unsigned long Sz = LeftRead();
- if (OutQueue.length() - StrPos < Sz)
- Sz = OutQueue.length() - StrPos;
-- memcpy(Buf + (InP%Size),OutQueue.begin() + StrPos,Sz);
-+ memcpy(Buf + (InP%Size),OutQueue.c_str() + StrPos,Sz);
-
- // Advance
- StrPos += Sz;
-@@ -258,9 +259,6 @@
- // ServerState::Open - Open a connection to the server /*{{{*/
- // ---------------------------------------------------------------------
- /* This opens a connection to the server. */
--string LastHost;
--int LastPort = 0;
--struct addrinfo *LastHostAddr = 0;
- bool ServerState::Open()
- {
- // Use the already open connection if possible.
-@@ -270,7 +268,8 @@
- Close();
- In.Reset();
- Out.Reset();
--
-+ Persistent = true;
-+
- // Determine the proxy setting
- if (getenv("http_proxy") == 0)
- {
-@@ -289,32 +288,13 @@
- else
- Proxy = getenv("http_proxy");
-
-- // Parse no_proxy, a , seperated list of domains
-+ // Parse no_proxy, a , separated list of domains
- if (getenv("no_proxy") != 0)
- {
-- const char *Start = getenv("no_proxy");
-- const char *ServerEnd = ServerName.Host.end();
--
-- for (const char *Cur = Start; true ; Cur++)
-- {
-- if (*Cur != ',' && *Cur != 0)
-- continue;
--
-- // match end of the string
-- if ((ServerName.Host.size() >= (Cur - Start))
-- && stringcasecmp(ServerEnd - (Cur - Start),
-- ServerEnd,Start,Cur) == 0)
-- {
-- Proxy = "";
-- break;
-- }
--
-- Start = Cur + 1;
-- if (*Cur == 0)
-- break;
-- }
-+ if (CheckDomainList(ServerName.Host,getenv("no_proxy")) == true)
-+ Proxy = "";
- }
--
-+
- // Determine what host and port to use based on the proxy settings
- int Port = 0;
- string Host;
-@@ -380,14 +360,23 @@
- {
- string::const_iterator J = I;
- for (; J != Data.end() && *J != '\n' && *J != '\r';J++);
-- if (HeaderLine(string(I,J-I)) == false)
-+ if (HeaderLine(string(I,J)) == false)
- return 2;
- I = J;
- }
-+
-+ // 100 Continue is a Nop...
-+ if (Result == 100)
-+ continue;
-+
-+ // Tidy up the connection persistance state.
-+ if (Encoding == Closes && HaveContent == true)
-+ Persistent = false;
-+
- return 0;
- }
- while (Owner->Go(false,this) == true);
--
-+
- return 1;
- }
- /*}}}*/
-@@ -513,7 +502,7 @@
- string Tag = string(Line,0,Pos);
- string Val = string(Line,Pos2);
-
-- if (stringcasecmp(Tag.begin(),Tag.begin()+4,"HTTP") == 0)
-+ if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0)
- {
- // Evil servers return no version
- if (Line[4] == '/')
-@@ -529,7 +518,19 @@
- if (sscanf(Line.c_str(),"HTTP %u %[^\n]",&Result,Code) != 2)
- return _error->Error("The http server sent an invalid reply header");
- }
--
-+
-+ /* Check the HTTP response header to get the default persistance
-+ state. */
-+ if (Major < 1)
-+ Persistent = false;
-+ else
-+ {
-+ if (Major == 1 && Minor <= 0)
-+ Persistent = false;
-+ else
-+ Persistent = true;
-+ }
-+
- return true;
- }
-
-@@ -569,11 +570,19 @@
- {
- HaveContent = true;
- if (stringcasecmp(Val,"chunked") == 0)
-- Encoding = Chunked;
--
-+ Encoding = Chunked;
- return true;
- }
-
-+ if (stringcasecmp(Tag,"Connection:") == 0)
-+ {
-+ if (stringcasecmp(Val,"close") == 0)
-+ Persistent = false;
-+ if (stringcasecmp(Val,"keep-alive") == 0)
-+ Persistent = true;
-+ return true;
-+ }
-+
- if (stringcasecmp(Tag,"Last-Modified:") == 0)
- {
- if (StrToTime(Val,Date) == false)
-@@ -660,10 +669,11 @@
- Req += string("Proxy-Authorization: Basic ") +
- Base64Encode(Proxy.User + ":" + Proxy.Password) + "\r\n";
-
-- if (0)//akk
-- Req += "User-Agent: Debian APT-HTTP/1.2\r\n\r\n";
-- else
-- Req += "User-Agent: Conectiva APT-HTTP/1.2\r\n\r\n";
-+ if (Uri.User.empty() == false || Uri.Password.empty() == false)
-+ Req += string("Authorization: Basic ") +
-+ Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
-+
-+ Req += "User-Agent: PLD APT-HTTP/1.2\r\n\r\n";
-
- if (Debug == true)
- cerr << Req << endl;
-@@ -686,10 +696,12 @@
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
-
-- // Add the server
-- if (Srv->Out.WriteSpace() == true && Srv->ServerFd != -1)
-+ /* Add the server. We only send more requests if the connection will
-+ be persisting */
-+ if (Srv->Out.WriteSpace() == true && Srv->ServerFd != -1
-+ && Srv->Persistent == true)
- FD_SET(Srv->ServerFd,&wfds);
-- if (Srv->In.ReadSpace() == true && Srv->ServerFd != -1)
-+ if (Srv->In.ReadSpace() == true && Srv->ServerFd != -1)
- FD_SET(Srv->ServerFd,&rfds);
-
- // Add the file
-@@ -714,7 +726,11 @@
- tv.tv_usec = 0;
- int Res = 0;
- if ((Res = select(MaxFd+1,&rfds,&wfds,0,&tv)) < 0)
-+ {
-+ if (errno == EINTR)
-+ return true;
- return _error->Errno("select","Select failed");
-+ }
-
- if (Res == 0)
- {
-@@ -1007,7 +1023,15 @@
- delete Server;
- Server = new ServerState(Queue->Uri,this);
- }
--
-+
-+ /* If the server has explicitly said this is the last connection
-+ then we pre-emptively shut down the pipeline and tear down
-+ the connection. This will speed up HTTP/1.0 servers a tad
-+ since we don't have to wait for the close sequence to
-+ complete */
-+ if (Server->Persistent == false)
-+ Server->Close();
-+
- // Reset the pipeline
- if (Server->ServerFd == -1)
- QueueBack = Queue;
-@@ -1035,6 +1059,7 @@
- {
- _error->Error("Bad header Data");
- Fail(true);
-+ RotateDNS();
- continue;
- }
-
-@@ -1053,6 +1078,7 @@
- FailCounter = 0;
- }
-
-+ RotateDNS();
- continue;
- }
- };
-@@ -1070,6 +1096,11 @@
- // Run the data
- bool Result = Server->RunData();
-
-+ /* If the server is sending back sizeless responses then fill in
-+ the size now */
-+ if (Res.Size == 0)
-+ Res.Size = File->Size();
-+
- // Close the file, destroy the FD object and timestamp it
- FailFd = -1;
- delete File;
-@@ -1090,7 +1121,7 @@
- }
- else
- Fail(true);
--
-+
- break;
- }
-
-@@ -1112,6 +1143,7 @@
- case 5:
- {
- Fail();
-+ RotateDNS();
- Server->Close();
- break;
- }
-diff -urN apt-0.3.19cnc52.org/methods/http.h apt-0.3.19cnc52/methods/http.h
---- apt-0.3.19cnc52.org/methods/http.h Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/http.h Sat Sep 8 12:42:54 2001
-@@ -1,5 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
--// Description /*{{{*/// $Id$
-+// Description /*{{{*/// $Id$
-+// $Id$
- /* ######################################################################
-
- HTTP Aquire Method - This is the HTTP aquire method for APT.
-@@ -12,6 +13,11 @@
-
- #define MAXLEN 360
-
-+#include <iostream>
-+
-+using std::cout;
-+using std::endl;
-+
- class HttpMethod;
-
- class CircleBuf
-@@ -87,6 +93,9 @@
- bool HaveContent;
- enum {Chunked,Stream,Closes} Encoding;
- enum {Header, Data} State;
-+ bool Persistent;
-+
-+ // This is a Persistent attribute of the server itself.
- bool Pipeline;
-
- HttpMethod *Owner;
-@@ -130,7 +139,7 @@
- static void SigTerm(int);
-
- public:
-- friend ServerState;
-+ friend class ServerState;
-
- FileFd *File;
- ServerState *Server;
-diff -urN apt-0.3.19cnc52.org/methods/rfc2553emu.cc apt-0.3.19cnc52/methods/rfc2553emu.cc
---- apt-0.3.19cnc52.org/methods/rfc2553emu.cc Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/rfc2553emu.cc Tue Feb 20 08:03:18 2001
-@@ -1,6 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- RFC 2553 Emulation - Provides emulation for RFC 2553 getaddrinfo,
-@@ -36,20 +36,6 @@
- const char *End;
- char **CurAddr;
-
-- Addr = gethostbyname(nodename);
-- if (Addr == 0)
-- {
-- if (h_errno == TRY_AGAIN)
-- return EAI_AGAIN;
-- if (h_errno == NO_RECOVERY)
-- return EAI_FAIL;
-- return EAI_NONAME;
-- }
--
-- // No A records
-- if (Addr->h_addr_list[0] == 0)
-- return EAI_NONAME;
--
- // Try to convert the service as a number
- Port = htons(strtol(servname,(char **)&End,0));
- Proto = SOCK_STREAM;
-@@ -86,10 +72,32 @@
- hints->ai_socktype != 0)
- return EAI_SERVICE;
- }
-+
-+ // Hostname lookup, only if this is not a listening socket
-+ if (hints != 0 && (hints->ai_flags & AI_PASSIVE) != AI_PASSIVE)
-+ {
-+ Addr = gethostbyname(nodename);
-+ if (Addr == 0)
-+ {
-+ if (h_errno == TRY_AGAIN)
-+ return EAI_AGAIN;
-+ if (h_errno == NO_RECOVERY)
-+ return EAI_FAIL;
-+ return EAI_NONAME;
-+ }
-+
-+ // No A records
-+ if (Addr->h_addr_list[0] == 0)
-+ return EAI_NONAME;
-+
-+ CurAddr = Addr->h_addr_list;
-+ }
-+ else
-+ CurAddr = (char **)&End; // Fake!
-
- // Start constructing the linked list
- *res = 0;
-- for (CurAddr = Addr->h_addr_list; *CurAddr != 0; CurAddr++)
-+ for (; *CurAddr != 0; CurAddr++)
- {
- // New result structure
- *Result = (struct addrinfo *)calloc(sizeof(**Result),1);
-@@ -124,8 +132,15 @@
- // Set the address
- ((struct sockaddr_in *)(*Result)->ai_addr)->sin_family = AF_INET;
- ((struct sockaddr_in *)(*Result)->ai_addr)->sin_port = Port;
-- ((struct sockaddr_in *)(*Result)->ai_addr)->sin_addr = *(in_addr *)(*CurAddr);
--
-+
-+ if (hints != 0 && (hints->ai_flags & AI_PASSIVE) != AI_PASSIVE)
-+ ((struct sockaddr_in *)(*Result)->ai_addr)->sin_addr = *(in_addr *)(*CurAddr);
-+ else
-+ {
-+ // Already zerod by calloc.
-+ break;
-+ }
-+
- Result = &(*Result)->ai_next;
- }
-
-@@ -202,9 +217,9 @@
- {
- struct servent *Ent;
- if ((flags & NI_DATAGRAM) == NI_DATAGRAM)
-- Ent = getservbyport(sin->sin_port,"udp");
-+ Ent = getservbyport(ntohs(sin->sin_port),"udp");
- else
-- Ent = getservbyport(sin->sin_port,"tcp");
-+ Ent = getservbyport(ntohs(sin->sin_port),"tcp");
-
- if (Ent != 0)
- strncpy(serv,Ent->s_name,servlen);
-@@ -220,7 +235,7 @@
- // Resolve as a plain numberic
- if ((flags & NI_NUMERICSERV) == NI_NUMERICSERV)
- {
-- snprintf(serv,servlen,"%u",sin->sin_port);
-+ snprintf(serv,servlen,"%u",ntohs(sin->sin_port));
- }
- }
-
-diff -urN apt-0.3.19cnc52.org/methods/rfc2553emu.h apt-0.3.19cnc52/methods/rfc2553emu.h
---- apt-0.3.19cnc52.org/methods/rfc2553emu.h Thu Sep 6 22:20:43 2001
-+++ apt-0.3.19cnc52/methods/rfc2553emu.h Sun Jun 18 08:04:45 2000
-@@ -1,6 +1,6 @@
- // -*- mode: cpp; mode: fold -*-
- // Description /*{{{*/
--// $Id$
-+// $Id$
- /* ######################################################################
-
- RFC 2553 Emulation - Provides emulation for RFC 2553 getaddrinfo,
-@@ -74,6 +74,11 @@
- #define EAI_MEMORY -11
- #endif
-
-+ /* If we don't have getaddrinfo then we probably don't have
-+ sockaddr_storage either (same RFC) so we definately will not be
-+ doing any IPv6 stuff. Do not use the members of this structure to
-+ retain portability, cast to a sockaddr. */
-+ #define sockaddr_storage sockaddr_in
- #endif
-
- // getnameinfo support (glibc2.0 has getaddrinfo only)
-@@ -97,6 +102,12 @@
- #define NI_DATAGRAM (1<<4)
- #endif
-
-+ #define sockaddr_storage sockaddr_in
-+#endif
-+
-+// Glibc 2.0.7 misses this one
-+#ifndef AI_NUMERICHOST
-+#define AI_NUMERICHOST 0
- #endif
-
- #endif
+++ /dev/null
---- apt-0.3.19cnc52/buildlib/defaults.mak~ Wed Aug 1 23:31:58 2001
-+++ apt-0.3.19cnc52/buildlib/defaults.mak Wed Aug 15 03:09:45 2001
-@@ -164,16 +164,3 @@
- endif
- endif
-
--# Automatic -j support
--ifeq ($(NUM_PROCS),1)
-- PARALLEL_RUN=no
--endif
--
--ifndef PARALLEL_RUN
-- PARALLEL_RUN=yes
-- .EXPORT: PARALLEL_RUN
-- # handle recursion
-- ifneq ($(NUM_PROCS),)
-- MAKEFLAGS += -j $(NUM_PROCS)
-- endif
--endif
+++ /dev/null
-diff -urN apt-0.3.19cnc38.org/apt-pkg/rpm/rpmlistparser.cc apt-0.3.19cnc38/apt-pkg/rpm/rpmlistparser.cc
---- apt-0.3.19cnc38.org/apt-pkg/rpm/rpmlistparser.cc Thu Apr 19 00:38:38 2001
-+++ apt-0.3.19cnc38/apt-pkg/rpm/rpmlistparser.cc Thu Apr 19 00:38:54 2001
-@@ -348,7 +348,6 @@
- unsigned short rpmListParser::VersionHash()
- {
- int Sections[] ={
-- RPMTAG_REQUIRENAME,
- RPMTAG_OBSOLETENAME,
- RPMTAG_CONFLICTNAME,
- 0