commit 25678627017ea2f943c430374d66f9d1026639bf
Author: Ján Kupec
Date: Tue Jan 27 14:02:39 2009 +0100
Adapted authetication callback for non-curl URLs (bnc #460970)
---
src/callbacks/media.h | 81 ++++++++++++++++++++++++-------------------------
1 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/src/callbacks/media.h b/src/callbacks/media.h
index 9a463d0..0cd9b6e 100644
--- a/src/callbacks/media.h
+++ b/src/callbacks/media.h
@@ -64,7 +64,7 @@ namespace ZmartRecipients
const std::vectorstd::string & devices,
unsigned int & index)
{
- /*std::cout << "detected devices: ";
+ /*std::cout << "detected devices: ";
for (std::vectorstd::string::const_iterator it = devices.begin();
it != devices.end(); ++it)
std::cout << *it << " ";
@@ -75,7 +75,7 @@ namespace ZmartRecipients
if (is_changeable_media(url) && error == MediaChangeReport::WRONG)
{
//cerr << endl; // may be in the middle of RepoReport or ProgressReport \todo check this
-
+
std::string request = boost::str(boost::format(
// TranslatorExplanation translate letters 'y' and 'n' to whathever is appropriate for your language.
// Try to check what answers does zypper accept (it always accepts y/n at least)
@@ -84,7 +84,7 @@ namespace ZmartRecipients
_("Please insert medium [%s] #%d and type 'y' to continue or 'n' to cancel the operation."))
% label % mediumNr);
if (read_bool_answer(PROMPT_YN_MEDIA_CHANGE, request, false))
- return MediaChangeReport::RETRY;
+ return MediaChangeReport::RETRY;
else
return MediaChangeReport::ABORT;
}
@@ -131,7 +131,7 @@ namespace ZmartRecipients
if (out.verbosity() < Out::HIGH &&
(
- // don't show download info unless show_media_progress_hack is used
+ // don't show download info unless show_media_progress_hack is used
!Zypper::instance()->runtimeData().show_media_progress_hack ||
// don't report download of the media file (bnc #330614)
zypp::Pathname(uri.getPathName()).basename() == "media"
@@ -213,49 +213,48 @@ namespace ZmartRecipients
}
// curl authentication
- zypp::media::CurlAuthData * auth_data_ptr =
+ zypp::media::CurlAuthData * curl_auth_data =
dynamic_castzypp::media::CurlAuthData* (&auth_data);
- if (auth_data_ptr)
- {
-
- // user name
-
- std::string username;
- // expect the input from machine on stdin
- if (Zypper::instance()->globalOpts().machine_readable)
- {
- Zypper::instance()->out().prompt(
- PROMPT_AUTH_USERNAME, _("User Name"), PromptOptions(), description);
- std::cin >> username;
- }
- // input from human using readline
- else
- {
- std::cout << description << std::endl;
- username = get_text(_("User Name") + std::string(": "), auth_data.username());
- }
- auth_data_ptr->setUsername(username);
- // password
-
+ if (curl_auth_data)
+ curl_auth_data->setAuthType("basic,digest");
+
+ // user name
+
+ std::string username;
+ // expect the input from machine on stdin
+ if (Zypper::instance()->globalOpts().machine_readable)
+ {
Zypper::instance()->out().prompt(
- PROMPT_AUTH_PASSWORD, _("Password"), PromptOptions());
+ PROMPT_AUTH_USERNAME, _("User Name"), PromptOptions(), description);
+ std::cin >> username;
+ }
+ // input from human using readline
+ else
+ {
+ std::cout << description << std::endl;
+ username = get_text(_("User Name") + std::string(": "), auth_data.username());
+ }
+ if (username.empty())
+ return false;
+ auth_data.setUsername(username);
- std::string password;
- // expect the input from machine on stdin
- if (Zypper::instance()->globalOpts().machine_readable)
- std::cin >> password;
- else
- password = get_password();
- if (password.empty()) return false;
- auth_data_ptr->setPassword(password);
+ // password
- auth_data_ptr->setAuthType("basic,digest");
+ Zypper::instance()->out().prompt(
+ PROMPT_AUTH_PASSWORD, _("Password"), PromptOptions());
- return true;
- }
+ std::string password;
+ // expect the input from machine on stdin
+ if (Zypper::instance()->globalOpts().machine_readable)
+ std::cin >> password;
+ else
+ password = get_password();
+ if (password.empty())
+ return false;
+ auth_data.setPassword(password);
- return false;
+ return true;
}
};
@@ -286,7 +285,7 @@ class MediaCallbacks {
}
};
-#endif
+#endif
// Local Variables:
// mode: c++
// c-basic-offset: 2
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org