Secure download of license file on repo refresh (bnc #372386)
authorMichael Andres <ma@suse.de>
Fri, 17 Oct 2008 16:33:22 +0000 (16:33 +0000)
committerMichael Andres <ma@suse.de>
Fri, 17 Oct 2008 16:33:22 +0000 (16:33 +0000)
package/libzypp.changes
zypp/parser/susetags/ContentFileReader.cc
zypp/parser/susetags/RepoIndex.h
zypp/repo/susetags/Downloader.cc

index 820cdbb..de60083 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Fri Oct 17 18:31:47 CEST 2008 - ma@suse.de
+
+- Secure download of license file on repo refresh (bnc #372386)
+- revision 11398
+
+-------------------------------------------------------------------
 Fri Oct 17 17:26:25 CEST 2008 - ma@suse.de
 
 - Call 'repo2solv.sh -o' instead of using output redirection. (bnc #420046)
index fcbdf22..d5f6497 100644 (file)
@@ -21,8 +21,6 @@
 #include "zypp/parser/susetags/ContentFileReader.h"
 #include "zypp/parser/susetags/RepoIndex.h"
 
-#include "zypp/ZConfig.h"
-
 using std::endl;
 #undef  ZYPP_BASE_LOGGER_LOGGROUP
 #define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
@@ -176,7 +174,7 @@ namespace zypp
       void ContentFileReader::parse( const InputStream & input_r,
                                     const ProgressData::ReceiverFnc & fnc_r )
       {
-       MIL << "Start parsing " << input_r << endl;
+       MIL << "Start parsing content repoindex" << input_r << endl;
        if ( ! input_r.stream() )
        {
          std::ostringstream s;
@@ -191,8 +189,6 @@ namespace zypp
        if ( ! ticks.toMin() )
          userRequestedAbort( 0 );
 
-       Arch sysarch( ZConfig::instance().systemArchitecture() );
-
        iostr::EachLine line( input_r );
        for( ; line; line.next() )
        {
@@ -217,10 +213,6 @@ namespace zypp
          //
          // ReppoIndex related data:
          //
-         else if ( key == "DEFAULTBASE" )
-         {
-           _pimpl->repoindex().defaultBase = Arch(value);
-         }
          else if ( key == "DESCRDIR" )
          {
            _pimpl->repoindex().descrdir = value;
@@ -229,10 +221,6 @@ namespace zypp
          {
            _pimpl->repoindex().datadir = value;
          }
-         else if ( key == "FLAGS" )
-         {
-           str::split( value, std::back_inserter( _pimpl->repoindex().flags ) );
-         }
          else if ( key == "KEY" )
          {
            if ( _pimpl->setFileCheckSum( _pimpl->repoindex().signingKeys, value ) )
@@ -240,19 +228,6 @@ namespace zypp
              ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [KEY algorithm checksum filename]", *line ) ) );
            }
          }
-         else if ( key == "LANGUAGE" )
-         {
-           _pimpl->repoindex().language;
-         }
-         else if ( key == "LINGUAS" )
-         {
-           std::set<std::string> strval;
-           str::split( value, std::inserter( strval, strval.end() ) );
-           for ( std::set<std::string>::const_iterator it = strval.begin(); it != strval.end(); ++it )
-           {
-             _pimpl->repoindex().languages.push_back( Locale(*it) );
-           }
-         }
          else if ( key == "META" )
          {
            if ( _pimpl->setFileCheckSum( _pimpl->repoindex().metaFileChecksums, value ) )
@@ -267,12 +242,10 @@ namespace zypp
              ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Expected [algorithm checksum filename]", *line ) ) );
            }
          }
-         else if ( key == "TIMEZONE" )
+          else
          {
-           _pimpl->repoindex().timezone = value;
-         }
-         else
-         { WAR << errPrefix( line.lineNo(), "Unknown tag", *line ) << endl; }
+            DBG << errPrefix( line.lineNo(), "ignored", *line ) << endl;
+          }
 
 
          if ( ! ticks.set( input_r.stream().tellg() ) )
index 391a262..1abe432 100644 (file)
@@ -47,15 +47,10 @@ namespace zypp
       */
       class RepoIndex : public base::ReferenceCounted, private base::NonCopyable
       {
+        friend class ContentFileReader;
        public:
          typedef std::map<std::string, CheckSum> FileChecksumMap;
 
-         Locale                 language;
-         std::string            timezone;
-         Arch                   defaultBase;
-         std::list<Locale>      languages;
-         std::list<std::string> flags;
-
          Pathname descrdir;
          Pathname datadir;
 
index cdb4736..ce17dfc 100644 (file)
@@ -106,9 +106,7 @@ void Downloader::download( MediaSetAccess &media,
   //_datadir  = _repoIndex->datadir;  // path below reporoot
 
 
-  for ( RepoIndex::FileChecksumMap::const_iterator it = _repoindex->metaFileChecksums.begin();
-        it != _repoindex->metaFileChecksums.end();
-        ++it )
+  for_( it, _repoindex->metaFileChecksums.begin(), _repoindex->metaFileChecksums.end() )
   {
     // omit unwanted translations
     if ( str::hasPrefix( it->first, "packages" ) )
@@ -183,10 +181,21 @@ void Downloader::download( MediaSetAccess &media,
     this->enqueueDigested(location);
   }
 
-  for ( RepoIndex::FileChecksumMap::const_iterator it = _repoindex->signingKeys.begin();
-        it != _repoindex->signingKeys.end();
-        ++it )
+  for_( it, _repoindex->mediaFileChecksums.begin(), _repoindex->mediaFileChecksums.end() )
   {
+    // Repo adopts license files listed in HASH
+    if ( it->first != "license.tar.gz" )
+      continue;
+
+    MIL << "adding job " << it->first << endl;
+    OnMediaLocation location( repoInfo().path() + it->first, 1 );
+    location.setChecksum( it->second );
+    this->enqueueDigested(location);
+  }
+
+  for_( it, _repoindex->signingKeys.begin(),_repoindex->signingKeys.end() )
+  {
+    MIL << "adding job " << it->first << endl;
     OnMediaLocation location( repoInfo().path() + it->first, 1 );
     location.setChecksum( it->second );
     this->enqueueDigested(location);