Author: jkupec
Date: Sat Sep 27 23:35:42 2008
New Revision: 11187
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11187&view=rev
Log:
- fixed endless loop when CM returns bad password
- CM now correctly updates password of existing credentials
Modified:
trunk/libzypp/zypp/media/CredentialManager.cc
trunk/libzypp/zypp/media/CredentialManager.h
trunk/libzypp/zypp/media/MediaCurl.cc
Modified: trunk/libzypp/zypp/media/CredentialManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/CredentialManager.cc?rev=11187&r1=11186&r2=11187&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/CredentialManager.cc (original)
+++ trunk/libzypp/zypp/media/CredentialManager.cc Sat Sep 27 23:35:42 2008
@@ -299,8 +299,15 @@
{
AuthData_Ptr c_ptr;
c_ptr.reset(new AuthData(cred)); // FIX for child classes if needed
- if (_pimpl->_credsGlobal.insert(c_ptr).second)
+ pair ret = _pimpl->_credsGlobal.insert(c_ptr);
+ if (ret.second)
_pimpl->_globalDirty = true;
+ else if ((*ret.first)->password() != cred.password())
+ {
+ _pimpl->_credsGlobal.erase(ret.first);
+ _pimpl->_credsGlobal.insert(c_ptr);
+ _pimpl->_globalDirty = true;
+ }
}
@@ -308,8 +315,15 @@
{
AuthData_Ptr c_ptr;
c_ptr.reset(new AuthData(cred)); // FIX for child classes if needed
- if (_pimpl->_credsUser.insert(c_ptr).second)
+ pair ret = _pimpl->_credsUser.insert(c_ptr);
+ if (ret.second)
_pimpl->_userDirty = true;
+ else if ((*ret.first)->password() != cred.password())
+ {
+ _pimpl->_credsUser.erase(ret.first);
+ _pimpl->_credsUser.insert(c_ptr);
+ _pimpl->_userDirty = true;
+ }
}
Modified: trunk/libzypp/zypp/media/CredentialManager.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/CredentialManager.h?rev=11187&r1=11186&r2=11187&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/CredentialManager.h (original)
+++ trunk/libzypp/zypp/media/CredentialManager.h Sat Sep 27 23:35:42 2008
@@ -51,8 +51,6 @@
{
if (lhs->username() < rhs->username())
return true;
- if (lhs->password() < rhs->password())
- return true;
if (lhs->url() != rhs->url())
return true;
return false;
Modified: trunk/libzypp/zypp/media/MediaCurl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaCurl.cc?rev=11187&r1=11186&r2=11187&view=diff
==============================================================================
--- trunk/libzypp/zypp/media/MediaCurl.cc (original)
+++ trunk/libzypp/zypp/media/MediaCurl.cc Sat Sep 27 23:35:42 2008
@@ -1591,7 +1591,7 @@
// get stored credentials
AuthData_Ptr cmcred = cm.getCred(_url);
- if (cmcred)
+ if (cmcred && firstTry)
{
credentials.reset(new CurlAuthData(*cmcred));
DBG << "got stored credentials:" << endl << *credentials << endl;
@@ -1599,6 +1599,9 @@
// if not found, ask user
else
{
+ // reset credentials from CM (they're wrong, obviously)
+ cmcred.reset();
+
CurlAuthData_Ptr curlcred;
curlcred.reset(new CurlAuthData());
callback::SendReport<AuthenticationReport> auth_report;
@@ -1607,12 +1610,9 @@
if (!_url.getUsername().empty() && firstTry)
curlcred->setUsername(_url.getUsername());
- string prompt_msg;
- if (!firstTry)
- prompt_msg = _("Invalid user name or password.");
- else // first prompt
- prompt_msg = boost::str(boost::format(
- _("Authentication required for '%s'")) % _url.asString());
+ string prompt_msg = boost::str(boost::format(
+ //!\todo add comma to the message for the next release
+ _("Authentication required for '%s'")) % _url.asString());
// set available authentication types from the exception
// might be needed in prompt
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org