mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kio: do not store the cached authorization after retrieving it
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
37cfd2fd46
commit
3c1f8483d9
1 changed files with 10 additions and 0 deletions
|
@ -575,15 +575,20 @@ bool SlaveBase::openPasswordDialog(AuthInfo& info, const QString &errorMsg)
|
||||||
Q_ASSERT(passwdstore);
|
Q_ASSERT(passwdstore);
|
||||||
|
|
||||||
if (!passwdstore->isOpen() && passwdstore->openStore()) {
|
if (!passwdstore->isOpen() && passwdstore->openStore()) {
|
||||||
|
kDebug(7019) << "opening store for authorization" << info.url.prettyUrl();
|
||||||
if (checkCachedAuthentication(info)) {
|
if (checkCachedAuthentication(info)) {
|
||||||
|
// do not store the authorization, it was just pulled from the cache
|
||||||
|
info.keepPassword = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaData(QLatin1String("no-auth-prompt")).compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) {
|
if (metaData(QLatin1String("no-auth-prompt")).compare(QLatin1String("true"), Qt::CaseInsensitive) == 0) {
|
||||||
|
kDebug(7019) << "not asking for authorization" << info.url.prettyUrl();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kDebug(7019) << "asking for authorization" << info.url.prettyUrl();
|
||||||
const qlonglong windowId = metaData(QLatin1String("window-id")).toLongLong();
|
const qlonglong windowId = metaData(QLatin1String("window-id")).toLongLong();
|
||||||
QWidget *windowWidget = QWidget::find(windowId);
|
QWidget *windowWidget = QWidget::find(windowId);
|
||||||
|
|
||||||
|
@ -934,21 +939,26 @@ bool SlaveBase::checkCachedAuthentication(AuthInfo &info)
|
||||||
if (!passwdstore->isOpen() && !passwdstore->cacheOnly()) {
|
if (!passwdstore->isOpen() && !passwdstore->cacheOnly()) {
|
||||||
// let it fail the first time, if authorization is really required openPasswordDialog()
|
// let it fail the first time, if authorization is really required openPasswordDialog()
|
||||||
// will open the store and call this method
|
// will open the store and call this method
|
||||||
|
kDebug(7019) << "initial cache check rejected" << info.url.prettyUrl();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qlonglong windowId = metaData(QLatin1String("window-id")).toLongLong();
|
const qlonglong windowId = metaData(QLatin1String("window-id")).toLongLong();
|
||||||
QByteArray authkey = authInfoKey(info);
|
QByteArray authkey = authInfoKey(info);
|
||||||
QString passwd = passwdstore->getPasswd(authkey, windowId);
|
QString passwd = passwdstore->getPasswd(authkey, windowId);
|
||||||
if (!passwd.isEmpty()) {
|
if (!passwd.isEmpty()) {
|
||||||
|
kDebug(7019) << "using first cached authorization" << info.url.prettyUrl();
|
||||||
info = authInfoFromData(passwd.toLatin1());
|
info = authInfoFromData(passwd.toLatin1());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
authkey = authInfoKey2(info);
|
authkey = authInfoKey2(info);
|
||||||
passwd = passwdstore->getPasswd(authkey, windowId);
|
passwd = passwdstore->getPasswd(authkey, windowId);
|
||||||
if (!passwd.isEmpty()) {
|
if (!passwd.isEmpty()) {
|
||||||
|
kDebug(7019) << "using second cached authorization" << info.url.prettyUrl();
|
||||||
info = authInfoFromData(passwd.toLatin1());
|
info = authInfoFromData(passwd.toLatin1());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
kDebug(7019) << "no cached authorization" << info.url.prettyUrl();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue