-------------------------------------------------------------------
+Tue Dec 18 12:28:22 CET 2007 - aschnell@suse.de
+
+- fixed password handling in URLs (bug #347273)
+
+-------------------------------------------------------------------
Mon Dec 17 13:47:44 CET 2007 - ma@suse.de
- Fixed default text locale detection not to use static variables. (#346872)
void replace_test(const string &dir)
{
- RepoVariablesStringReplacer replacer;
-
- BOOST_CHECK_EQUAL(replacer("http://foo/$arch/bar"),
+ /* check RepoVariablesStringReplacer */
+
+ RepoVariablesStringReplacer replacer1;
+
+ BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar"),
"http://foo/"+ ZConfig::instance().systemArchitecture().asString() + "/bar");
getZYpp()->setArchitecture(Arch("i686"));
- BOOST_CHECK_EQUAL(replacer("http://foo/$arch/bar/$basearch"),
+ BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar/$basearch"),
"http://foo/i686/bar/i386");
+
+ /* check RepoVariablesUrlReplacer */
+
+ RepoVariablesUrlReplacer replacer2;
+
+ BOOST_CHECK_EQUAL(replacer2(Url("ftp://user:secret@site.org/$arch/")).asCompleteString(),
+ "ftp://user:secret@site.org/i686/");
+
+ BOOST_CHECK_EQUAL(replacer2(Url("http://user:my$arch@site.org/$basearch/")).asCompleteString(),
+ "http://user:my$arch@site.org/i386/");
+
+ BOOST_CHECK_EQUAL(replacer2(Url("http://site.org/update/?arch=$arch")).asCompleteString(),
+ "http://site.org/update/?arch=i686");
}
test_suite*
cout << "RepoVariables_test:"
" path to directory with test data required as parameter. Using " << datadir << endl;
//return (test_suite *)0;
-
+
}
else
{
datadir = argv[1];
}
-
+
test_suite* test= BOOST_TEST_SUITE("RepoVariables");
-
+
std::string const params[] = { datadir };
test->add(BOOST_PARAM_TEST_CASE(&replace_test,
(std::string const*)params, params+1));
{
return alias();
}
-
+
repo::RepoVariablesStringReplacer replacer;
return replacer(_pimpl->name);
}
if ( !store.isCached(info.alias()) )
return;
-
+
MIL << info.alias() << " cleaning cache..." << endl;
data::RecordId id = store.lookupRepository(info.alias());
-
+
CombinedProgressData subprogrcv(progress);
-
+
store.cleanRepository(id, subprogrcv);
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Reads RepoInfo's from a repo file.
*
static shared_ptr<Impl> _nullimpl( new Impl );
return _nullimpl;
}
-
+
private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
/** clone for RWCOW_pointer */
}
////////////////////////////////////////////////////////////////////////////
-
+
RepoStatus RepoManager::metadataStatus( const RepoInfo &info ) const
{
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
ERR << "refresh check failed for " << url << endl;
ZYPP_RETHROW(e);
}
-
+
return true; // default
}
{
ZYPP_CAUGHT(e);
ERR << "Trying another url..." << endl;
-
+
// remember the exception caught for the *first URL*
// if all other URLs fail, the rexception will be thrown with the
// cause of the problem of the first URL remembered
MIL << info.alias() << " cache rebuild is forced" << endl;
}
}
-
+
needs_cleaning = true;
}
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
return repo::RepoType::RPMMD;
if ( access.doesFileExist("/content") )
return repo::RepoType::YAST2;
-
+
// if it is a local url of type dir
if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
{
return repo::RepoType::NONE;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
//progress.sendTo( progressrcv );
progress.name(str::form(_("Reading repository '%s' cache"), info.name().c_str()));
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
if ( ! store.isCached( info.alias() ) )
MIL << "Repository " << info.alias() << " is cached" << endl;
data::RecordId id = store.lookupRepository(info.alias());
-
+
CombinedProgressData subprogrcv(progress);
-
+
repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
opts.readingResolvablesProgress = subprogrcv;
repo::cached::RepoImpl::Ptr repoimpl =
callback::SendReport<ProgressReport> report;
progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
progress.name(str::form(_("Removing repository '%s'"), info.name().c_str()));
-
+
MIL << "Going to delete repo " << info.alias() << endl;
std::list<RepoInfo> repos = knownRepositories();
/**
* \file zypp/Url.cc
*/
+
#include <zypp/Url.h>
#include <zypp/base/Gettext.h>
#include <zypp/base/String.h>
{
return (lhs.asCompleteString() == rhs.asCompleteString());
}
-
+
bool operator!=( const Url &lhs, const Url &rhs )
{
return (lhs.asCompleteString() != rhs.asCompleteString());
}
-
+
////////////////////////////////////////////////////////////////////
} // namespace zypp
//////////////////////////////////////////////////////////////////////
#define ZYPP_REPO_TYPE_H_
#include <iosfwd>
-#include<string>
+#include <string>
namespace zypp
{
{
namespace repo
{
-
+
RepoVariablesStringReplacer::RepoVariablesStringReplacer()
{}
std::string RepoVariablesStringReplacer::operator()( const std::string &value ) const
{
string newvalue(value);
-
+
// $arch
newvalue = str::gsub( newvalue,
"$arch",
ZConfig::instance().systemArchitecture().asString() );
// $basearch
-
+
Arch::CompatSet cset( Arch::compatSet( ZConfig::instance().systemArchitecture() ) );
Arch::CompatSet::const_iterator it = cset.end();
--it;
// now at noarch
--it;
-
+
Arch basearch = *it;
if ( basearch == Arch_noarch )
{
RepoVariablesUrlReplacer::~RepoVariablesUrlReplacer()
{}
-
+/*
+ * Replaces '$arch' and '$basearch' in the path and query part of the URL
+ * with the global ZYpp values. Examples:
+ *
+ * ftp://user:secret@site.net/$arch/ -> ftp://user:secret@site.net/i686/
+ * http://site.net/?basearch=$basearch -> http://site.net/?basearch=i386
+ */
Url RepoVariablesUrlReplacer::operator()( const Url &value ) const
{
+ Url newurl = value;
RepoVariablesStringReplacer replacer;
- string transformed = replacer(value.asString());
- Url newurl;
- try {
- newurl = Url(transformed);
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // just return what we got
- return value;
- }
+ newurl.setPathData(replacer(value.getPathData()));
+ newurl.setQueryString(replacer(value.getQueryString()));
+
return newurl;
}
#define ZYPP_REPO_VARIABLES_H_
#include <iosfwd>
-#include<string>
+#include <string>
#include "zypp/Url.h"
struct RepoVariablesStringReplacer : public std::unary_function<std::string, std::string>
{
RepoVariablesStringReplacer();
-
+
std::string operator()( const std::string &value ) const;
~RepoVariablesStringReplacer();
struct RepoVariablesUrlReplacer : public std::unary_function<Url, Url>
{
RepoVariablesUrlReplacer();
-
+
Url operator()( const Url &url ) const;
-
+
~RepoVariablesUrlReplacer();
};
-
+
} // ns repo
} // ns zypp
{
struct in6_addr ip;
std::string temp( host.substr(1, host.size()-2));
-
+
return inet_pton(AF_INET6, temp.c_str(), &ip) > 0;
}
else