19#include <zypp-core/KVMap> 
   20#include <zypp-media/Mount> 
   21#include <zypp-media/auth/AuthData> 
   22#include <zypp-media/auth/CredentialManager> 
   48      if ( spath_r.
empty() )
 
   52      std::string::size_type sep = share.find( 
'/', 1 );
 
   53      if ( sep == std::string::npos )
 
   54        share = share.erase( 0, 1 ); 
 
   56        share = share.substr( 1, sep-1 );
 
   59      while ( (sep = share.find( 
"%2f" )) != std::string::npos ) {
 
   60        share.replace( sep, 3, 
"/" );
 
 
   76      if ( spath_r.
empty() )
 
   80      std::string::size_type sep = striped.find( 
'/', 1 );
 
   81      if ( sep == std::string::npos )
 
   84      return striped.substr( sep );
 
 
  102                        const Pathname & attach_point_hint_r )
 
  107        MIL << 
"MediaCIFS::MediaCIFS(" << url_r << 
", " << attach_point_hint_r << 
")" << endl;
 
 
  131      if(
_url.getHost().empty())
 
  136      std::string path = 
"//";
 
  146        DBG << 
"Using a shared media " 
  168      std::string username = 
_url.getUsername();
 
  169      std::string password = 
_url.getPassword();
 
  171      if ( ! options.
has( 
"rw" ) ) {
 
  176      std::string workgroup = 
_url.getQueryParam(
"workgroup");
 
  177      if ( workgroup.empty() )
 
  178        workgroup = 
_url.getQueryParam(
"domain");
 
  179      if ( !workgroup.empty() )
 
  180        options[
"domain"] = workgroup;
 
  184      Mount::Options::iterator toEnv;
 
  185      toEnv = options.find(
"username");
 
  186      if ( toEnv != options.end() ) {
 
  187        if ( username.empty() )
 
  188          username = toEnv->second;
 
  189        options.erase( toEnv );
 
  192      toEnv = options.find(
"user"); 
 
  193      if ( toEnv != options.end() ) {
 
  194        if ( username.empty() )
 
  195          username = toEnv->second;
 
  196        options.erase( toEnv );
 
  201      toEnv = options.find(
"password");
 
  202      if ( toEnv != options.end() ) {
 
  203        if ( password.empty() )
 
  204          password = toEnv->second;
 
  205        options.erase( toEnv );
 
  208      toEnv = options.find(
"pass"); 
 
  209      if ( toEnv != options.end() ) {
 
  210        if ( password.empty() )
 
  211          password = toEnv->second;
 
  212        options.erase( toEnv );
 
  215      if ( username.empty() || password.empty() )
 
  220          username = c->username();
 
  221          password = c->password();
 
  225      bool firstTry = 
true;
 
  226      bool authRequired = 
false;
 
  239        if ( !username.empty() )
 
  240          environment[
"USER"] = username;
 
  241        if ( !password.empty() )
 
  242          environment[
"PASSWD"] = password;
 
  248        if ( !username.empty() || !password.empty() )
 
  252          outs << 
"username=" <<  username << endl;
 
  253          outs << 
"password=" <<  password << endl;
 
  262          if ( options.
has( 
"noguest" ) )
 
  263            options.erase( 
"noguest" );
 
  275          mount.
mount( path, mountpoint, 
"cifs",
 
  292      while ( authRequired );
 
  297      bool mountsucceeded = 
false;
 
  298      while( !(mountsucceeded=
isAttached()) && --limit)
 
  301      if ( !mountsucceeded )
 
  313          "Unable to verify that the media was mounted",
 
 
  379                               const Pathname & dirname, 
bool dots )
 const 
 
  393                               const Pathname & dirname, 
bool dots )
 const 
 
  416      if (!
_url.getUsername().empty() && firstTry)
 
  417        smbcred->setUsername(
_url.getUsername());
 
  420        smbcred->setUsername(cmcred->username());
 
  427        _(
"Authentication required for '%s'"), 
_url.asString().c_str());
 
  430      if (auth_report->prompt(
_url, prompt_msg, *smbcred))
 
  432        DBG << 
"callback answer: retry" << endl
 
  433            << 
"AuthData: " << *smbcred << endl;
 
  435        if (smbcred->valid())
 
  450        DBG << 
"callback answer: cancel" << endl;
 
  459        cmcred->setUrl(
_url);
 
 
static ZConfig & instance()
Singleton ctor.
const std::string & asString() const
String representation.
bool empty() const
Test for an empty path.
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Provide a new empty temporary file and delete it when no longer needed.
Automaticaly deletes files or directories when no longer needed.
std::list< DirEntry > DirContent
Returned by readdir.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Easy-to use interface to the ZYPP dependency resolver.
std::string asString(const Patch::Category &obj)
std::string asString() const
bool has(const std::string &key_r) const
Test whether key is set.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.