KIO::AuthInfo KPasswdServer::queryAuthInfo(KIO::AuthInfo info, QString errorMsg, long windowId, long seqNr, unsigned long usertime) { kdDebug(130) << "KPasswdServer::queryAuthInfo: User= "******", Message= " << info.prompt << ", WindowId = " << windowId << endl; if(!info.password.isEmpty()) // should we really allow the caller to pre-fill the password? kdDebug(130) << "password was set by caller" << endl; if(usertime != 0) kapp->updateUserTimestamp(usertime); QString key = createCacheKey(info); Request *request = new Request; request->client = callingDcopClient(); request->transaction = request->client->beginTransaction(); request->key = key; request->info = info; request->windowId = windowId; request->seqNr = seqNr; if(errorMsg == "<NoAuthPrompt>") { request->errorMsg = QString::null; request->prompt = false; } else { request->errorMsg = errorMsg; request->prompt = true; } m_authPending.append(request); if(m_authPending.count() == 1) QTimer::singleShot(0, this, SLOT(processRequest())); return info; }
KIO::AuthInfo KPasswdServer::checkAuthInfo(KIO::AuthInfo info, long windowId, unsigned long usertime) { kdDebug(130) << "KPasswdServer::checkAuthInfo: User= "******", WindowId = " << windowId << endl; if( usertime != 0 ) kapp->updateUserTimestamp( usertime ); QString key = createCacheKey(info); Request *request = m_authPending.first(); QString path2 = info.url.directory(false, false); for(; request; request = m_authPending.next()) { if (request->key != key) continue; if (info.verifyPath) { QString path1 = request->info.url.directory(false, false); if (!path2.startsWith(path1)) continue; } request = new Request; request->client = callingDcopClient(); request->transaction = request->client->beginTransaction(); request->key = key; request->info = info; m_authWait.append(request); return info; } const AuthInfo *result = findAuthInfoItem(key, info); if (!result || result->isCanceled) { if (!result && (info.username.isEmpty() || info.password.isEmpty()) && !KWallet::Wallet::keyDoesNotExist(KWallet::Wallet::NetworkWallet(), KWallet::Wallet::PasswordFolder(), makeWalletKey(key, info.realmValue))) { QMap<QString, QString> knownLogins; if (openWallet(windowId)) { if (readFromWallet(m_wallet, key, info.realmValue, info.username, info.password, info.readOnly, knownLogins)) { info.setModified(true); return info; } } } info.setModified(false); return info; } updateAuthExpire(key, result, windowId, false); return copyAuthInfo(result); }
void KPasswdServer::addAuthInfo(KIO::AuthInfo info, long windowId) { kdDebug(130) << "KPasswdServer::addAuthInfo: User= "******", RealmValue= " << info.realmValue << ", WindowId = " << windowId << endl; QString key = createCacheKey(info); m_seqNr++; addAuthInfoItem(key, info, windowId, m_seqNr, false); }