17#include <zypp-core/base/Logger.h>
18#include <zypp-core/base/InputStream>
19#include <zypp-core/parser/IniDict>
20#include <zypp-core/fs/PathInfo.h>
24#undef ZYPP_BASE_LOGGER_LOGGROUP
25#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
52 struct CredentialFileReaderImpl :
public parser::IniParser
56 struct StopParsing {};
58 CredentialFileReaderImpl(
const Pathname & input_r,
const ProcessCredentials & callback_r )
74 virtual void beginParse()
78 virtual void consume(
const std::string & section_r )
84 _secret->setUrl( Url(section_r) );
86 catch (
const url::UrlException & )
88 ERR <<
"Ignore invalid URL '" << section_r <<
"' in file " <<
_input << endl;
93 virtual void consume(
const std::string & section_r,
const std::string & key_r,
const std::string & value_r )
95 if ( !
_secret && section_r.empty() )
100 if ( key_r ==
"username" )
101 _secret->setUsername( value_r );
102 else if ( key_r ==
"password" )
103 _secret->setPassword( value_r );
105 _secret->extraValues()[key_r] = value_r;
111 virtual void endParse()
119 throw( StopParsing() );
122 ERR <<
"Ignore invalid credentials for URL '" <<
_secret->url() <<
"' in file " <<
_input << endl;
142 { CredentialFileReaderImpl( crfile_r, callback_r ); }
Wrapper class for stat/lstat.
const ProcessCredentials & _callback
Easy-to use interface to the ZYPP dependency resolver.