28 #include <sys/types.h>
29 #include <sys/mount.h>
48 if ( spath_r.empty() )
51 string share( spath_r.absolutename().asString() );
53 if ( sep == string::npos )
54 share = share.erase( 0, 1 );
56 share = share.substr( 1, sep-1 );
59 while ( (sep = share.find(
"%2f" )) != string::npos ) {
60 share.replace( sep, 3,
"/" );
76 if ( spath_r.empty() )
79 string striped( spath_r.absolutename().asString() );
81 if ( sep == string::npos )
84 return striped.substr( sep );
101 MediaCIFS::MediaCIFS(
const Url & url_r,
102 const Pathname & attach_point_hint_r )
107 MIL <<
"MediaCIFS::MediaCIFS(" << url_r <<
", " << attach_point_hint_r <<
")" << endl;
146 DBG <<
"Using a shared media "
162 if( mountpoint.empty())
174 if ( ! options.has(
"rw" ) ) {
180 if ( workgroup.empty() )
182 if ( !workgroup.empty() )
183 options[
"domain"] = workgroup;
187 Mount::Options::iterator toEnv;
188 toEnv = options.find(
"username");
189 if ( toEnv != options.end() ) {
190 if ( username.empty() )
191 username = toEnv->second;
192 options.erase( toEnv );
195 toEnv = options.find(
"user");
196 if ( toEnv != options.end() ) {
197 if ( username.empty() )
198 username = toEnv->second;
199 options.erase( toEnv );
204 toEnv = options.find(
"password");
205 if ( toEnv != options.end() ) {
206 if ( password.empty() )
207 password = toEnv->second;
208 options.erase( toEnv );
211 toEnv = options.find(
"pass");
212 if ( toEnv != options.end() ) {
213 if ( password.empty() )
214 password = toEnv->second;
215 options.erase( toEnv );
218 if ( username.empty() || password.empty() )
223 username = c->username();
224 password = c->password();
228 bool firstTry =
true;
229 bool authRequired =
false;
242 if ( !username.empty() )
243 environment[
"USER"] = username;
244 if ( !password.empty() )
245 environment[
"PASSWD"] = password;
251 if ( !username.empty() || !password.empty() )
255 outs <<
"username=" << username << endl;
256 outs <<
"password=" << password << endl;
265 if ( options.has(
"noguest" ) )
266 options.erase(
"noguest" );
278 mount.
mount( path, mountpoint,
"cifs",
279 options.asString(), environment );
295 while ( authRequired );
301 while( !(mountsucceeded=
isAttached()) && --limit)
304 if ( !mountsucceeded )
316 "Unable to verify that the media was mounted",
382 const Pathname & dirname,
bool dots )
const
396 const Pathname & dirname,
bool dots )
const
423 smbcred->setUsername(cmcred->username());
430 _(
"Authentication required for '%s'"),
_url.
asString().c_str());
433 if (auth_report->prompt(
_url, prompt_msg, *smbcred))
435 DBG <<
"callback answer: retry" << endl
436 <<
"AuthData: " << *smbcred << endl;
438 if (smbcred->valid())
453 DBG <<
"callback answer: cancel" << endl;
462 cmcred->setUrl(
_url);
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
const std::string & asString() const
String representation.
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
Provide a new empty temporary file and delete it when no longer needed.
std::string asString() const
Returns a default string representation of the Url object.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
std::list< DirEntry > DirContent
Returned by readdir.
#define _(MSG)
Return translated text.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
std::string asString(const Patch::SeverityFlag &obj)
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
std::string form(const char *format,...)
Printf style construction of std::string.
Automaticaly deletes files or directories when no longer needed.
A map of (key,value) strings.
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.