Forráskód Böngészése

Beautified URI printing to not include passwords
Author: jgg
Date: 1999-10-17 07:30:23 GMT
Beautified URI printing to not include passwords

Arch Librarian 22 éve
szülő
commit
54cf15cb90
4 módosított fájl, 29 hozzáadás és 21 törlés
  1. 2 2
      apt-pkg/acquire-item.cc
  2. 18 8
      apt-pkg/contrib/strutl.cc
  3. 7 11
      apt-pkg/sourcelist.cc
  4. 2 0
      debian/changelog

+ 2 - 2
apt-pkg/acquire-item.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: acquire-item.cc,v 1.37 1999/09/01 07:01:14 jgg Exp $
+// $Id: acquire-item.cc,v 1.38 1999/10/17 07:30:23 jgg Exp $
 /* ######################################################################
 
    Acquire Item - Item to acquire
@@ -136,7 +136,7 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,const pkgSourceList::Item *Location)
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(Location->PackagesURI());
 
-   // Create the item 
+   // Create the item
    Desc.URI = Location->PackagesURI() + ".gz";
    Desc.Description = Location->PackagesInfo();
    Desc.Owner = this;

+ 18 - 8
apt-pkg/contrib/strutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: strutl.cc,v 1.29 1999/08/28 01:49:08 jgg Exp $
+// $Id: strutl.cc,v 1.30 1999/10/17 07:30:23 jgg Exp $
 /* ######################################################################
 
    String Util - Some usefull string functions.
@@ -326,11 +326,14 @@ string SubstVar(string Str,string Subst,string Contents)
    file name should be unique and never occur again for a different file */
 string URItoFileName(string URI)
 {
-   string::const_iterator I = URI.begin() + URI.find(':') + 1;
-   for (; I < URI.end() && *I == '/'; I++);
-
+   // Nuke 'sensitive' items
+   ::URI U(URI);
+   U.User = string();
+   U.Password = string();
+   U.Access = "";
+   
    // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
-   URI = QuoteString(string(I,URI.end() - I),"\\|{}[]<>\"^~_=!@#$%^&*");
+   URI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*");
    string::iterator J = URI.begin();
    for (; J != URI.end(); J++)
       if (*J == '/') 
@@ -809,17 +812,24 @@ void URI::CopyFrom(string U)
 /* */
 URI::operator string()
 {
-   string Res = Access + ':';
+   string Res;
+   
+   if (Access.empty() == false)
+      Res = Access + ':';
+   
    if (Host.empty() == false)
    {
-      Res += "//";
+      if (Access.empty() == false)
+	 Res += "//";
+      
       if (User.empty() == false)
       {
-	 Res += "//" + User;
+	 Res +=  User;
 	 if (Password.empty() == false)
 	    Res += ":" + Password;
 	 Res += "@";
       }
+      
       Res += Host;
       if (Port != 0)
       {

+ 7 - 11
apt-pkg/sourcelist.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: sourcelist.cc,v 1.16 1999/09/30 06:30:34 jgg Exp $
+// $Id: sourcelist.cc,v 1.17 1999/10/17 07:30:23 jgg Exp $
 /* ######################################################################
 
    List of Sources
@@ -370,15 +370,11 @@ string pkgSourceList::Item::SourceInfo(string Pkg,string Ver,string Comp) const
 /* */
 string pkgSourceList::Item::SiteOnly(string URI) const
 {
-   unsigned int Pos = URI.find(':');
-   if (Pos == string::npos || Pos + 3 > URI.length())
-      return URI;
-   if (URI[Pos + 1] != '/' || URI[Pos + 2] != '/')
-      return URI;
-
-   Pos = URI.find('/',Pos + 3);
-   if (Pos == string::npos)
-      return URI;
-   return string(URI,0,Pos);
+   ::URI U(URI);
+   U.User = string();
+   U.Password = string();
+   U.Path = string();
+   U.Port = 0;
+   return U;
 }
 									/*}}}*/

+ 2 - 0
debian/changelog

@@ -10,6 +10,8 @@ apt (0.3.13.1) unstable; urgency=low
   * Added APT::Clean-Installed option. Closes: #45973
   * Moves the free space check to after the calculated size is printed.
     Closes: #46639, #47498
+  * mipsel arch Closes: #47614
+  * Beautified URI printing to not include passwords Closes: #46857
   
  -- Jason Gunthorpe <jgg@debian.org>  Fri,  3 Sep 1999 09:04:28 -0700