Author: dmacvicar Date: Wed Nov 26 17:11:55 2008 New Revision: 11806 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11806&view=rev Log: bnc#446188 - SHA1SUMS.key is not imported by zypp as known key Modified: trunk/libzypp/tests/zypp/Fetcher_test.cc trunk/libzypp/zypp/Fetcher.cc Modified: trunk/libzypp/tests/zypp/Fetcher_test.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tests/zypp/Fetcher_test.cc?rev=11806&r1=11805&r2=11806&view=diff ============================================================================== --- trunk/libzypp/tests/zypp/Fetcher_test.cc (original) +++ trunk/libzypp/tests/zypp/Fetcher_test.cc Wed Nov 26 17:11:55 2008 @@ -30,6 +30,30 @@ } } +BOOST_AUTO_TEST_CASE(fetcher_enqueuedir_autoindex_untrustedkey) +{ + MediaSetAccess media( ( DATADIR).asUrl(), "/" ); + // do the test by trusting the SHA1SUMS file signature key + { + filesystem::TmpDir dest; + + // add the key as untrusted, which is the same as not adding it and + // let autodiscovery to add it + + Fetcher fetcher; + fetcher.setOptions( Fetcher::AutoAddIndexes ); + fetcher.enqueueDir(OnMediaLocation("/complexdir"), true); + BOOST_CHECK_THROW( fetcher.start( dest.path(), media ), Exception); + + BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir2").isExist() ); + BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir2/subdir2-file1.txt").isExist() ); + BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file1.txt").isExist() ); + BOOST_CHECK( ! PathInfo(dest.path() + "/complexdir/subdir1/subdir1-file2.txt").isExist() ); + + fetcher.reset(); + } +} + BOOST_AUTO_TEST_CASE(fetcher_enqueuedir_autoindex) { MediaSetAccess media( ( DATADIR).asUrl(), "/" ); Modified: trunk/libzypp/zypp/Fetcher.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Fetcher.cc?rev=11806&r1=11805&r2=11806&view=diff ============================================================================== --- trunk/libzypp/zypp/Fetcher.cc (original) +++ trunk/libzypp/zypp/Fetcher.cc Wed Nov 26 17:11:55 2008 @@ -21,6 +21,7 @@ #include "zypp/base/DefaultIntegral.h" #include "zypp/base/String.h" #include "zypp/Fetcher.h" +#include "zypp/ZYppFactory.h" #include "zypp/CheckSum.h" #include "zypp/base/UserRequestException.h" #include "zypp/parser/susetags/ContentFileReader.h" @@ -695,6 +696,12 @@ fetcher.start( dest_dir, media ); fetcher.reset(); + // try to import the key + if ( PathInfo(dest_dir + keyloc.filename()).isExist() ) + getZYpp()->keyRing()->importKey(PublicKey(dest_dir + keyloc.filename()), false); + else + WAR << "No public key specified by user for index '" << keyloc.filename() << "'"<< endl; + // now the index itself fetcher.enqueue( idxloc, FileChecker(sigchecker) ); fetcher.start( dest_dir, media ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org