mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kutils: force the cache only option of KPasswdStore to off after the timeout
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d7d44d83c4
commit
f7c1f24284
1 changed files with 6 additions and 5 deletions
|
@ -102,8 +102,9 @@ bool KPasswdStoreImpl::isOpen() const
|
||||||
bool KPasswdStoreImpl::openStore(const qlonglong windowid)
|
bool KPasswdStoreImpl::openStore(const qlonglong windowid)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_OPENSSL)
|
#if defined(HAVE_OPENSSL)
|
||||||
if (m_cacheonly && m_passwdtimer.elapsed() < m_timeout) {
|
if (cacheOnly()) {
|
||||||
kDebug() << "cache store" << m_storeid;
|
kDebug() << "cache store" << m_storeid;
|
||||||
|
m_passwdtimer.start();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,12 +178,12 @@ void KPasswdStoreImpl::setCacheOnly(const bool cacheonly)
|
||||||
|
|
||||||
bool KPasswdStoreImpl::cacheOnly() const
|
bool KPasswdStoreImpl::cacheOnly() const
|
||||||
{
|
{
|
||||||
return m_cacheonly;
|
return (m_cacheonly && m_passwdtimer.elapsed() < m_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString KPasswdStoreImpl::getPasswd(const QByteArray &key, const qlonglong windowid)
|
QString KPasswdStoreImpl::getPasswd(const QByteArray &key, const qlonglong windowid)
|
||||||
{
|
{
|
||||||
if (m_cacheonly) {
|
if (cacheOnly()) {
|
||||||
kDebug() << "returning password from cache" << m_storeid << key;
|
kDebug() << "returning password from cache" << m_storeid << key;
|
||||||
return m_cachemap.value(key, QString());
|
return m_cachemap.value(key, QString());
|
||||||
}
|
}
|
||||||
|
@ -205,7 +206,7 @@ QString KPasswdStoreImpl::getPasswd(const QByteArray &key, const qlonglong windo
|
||||||
|
|
||||||
bool KPasswdStoreImpl::storePasswd(const QByteArray &key, const QString &passwd, const qlonglong windowid)
|
bool KPasswdStoreImpl::storePasswd(const QByteArray &key, const QString &passwd, const qlonglong windowid)
|
||||||
{
|
{
|
||||||
if (m_cacheonly) {
|
if (cacheOnly()) {
|
||||||
kDebug() << "storing password temporary" << key;
|
kDebug() << "storing password temporary" << key;
|
||||||
m_cachemap.insert(key, passwd);
|
m_cachemap.insert(key, passwd);
|
||||||
return true;
|
return true;
|
||||||
|
@ -234,7 +235,7 @@ bool KPasswdStoreImpl::storePasswd(const QByteArray &key, const QString &passwd,
|
||||||
|
|
||||||
bool KPasswdStoreImpl::ensurePasswd(const qlonglong windowid, const bool showerror, bool *cancel)
|
bool KPasswdStoreImpl::ensurePasswd(const qlonglong windowid, const bool showerror, bool *cancel)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!cacheonly);
|
Q_ASSERT(!m_cacheonly);
|
||||||
|
|
||||||
#if defined(HAVE_OPENSSL)
|
#if defined(HAVE_OPENSSL)
|
||||||
if (!m_passwd.isEmpty() && m_passwdtimer.elapsed() >= m_timeout) {
|
if (!m_passwd.isEmpty() && m_passwdtimer.elapsed() >= m_timeout) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue