Esempio n. 1
0
const KPasswdServer::AuthInfo *KPasswdServer::findAuthInfoItem(const QString &key, const KIO::AuthInfo &info)
{
    AuthInfoList *authList = m_authDict.find(key);
    if(!authList)
        return 0;

    QString path2 = info.url.directory(false, false);
    for(AuthInfo *current = authList->first(); current;)
    {
        if((current->expire == AuthInfo::expTime) && (difftime(time(0), current->expireTime) > 0))
        {
            authList->remove();
            current = authList->current();
            continue;
        }

        if(info.verifyPath)
        {
            QString path1 = current->directory;
            if(path2.startsWith(path1) && (info.username.isEmpty() || info.username == current->username))
                return current;
        }
        else
        {
            if(current->realmValue == info.realmValue && (info.username.isEmpty() || info.username == current->username))
                return current; // TODO: Update directory info,
        }

        current = authList->next();
    }
    return 0;
}
Esempio n. 2
0
void KPasswdServer::removeAuthForWindowId(long windowId)
{
    QStringList *keysChanged = mWindowIdList.find(windowId);
    if(!keysChanged)
        return;

    for(QStringList::ConstIterator it = keysChanged->begin(); it != keysChanged->end(); ++it)
    {
        QString key = *it;
        AuthInfoList *authList = m_authDict.find(key);
        if(!authList)
            continue;

        AuthInfo *current = authList->first();
        for(; current;)
        {
            if(current->expire == AuthInfo::expWindowClose)
            {
                if(current->windowList.remove(windowId) && current->windowList.isEmpty())
                {
                    authList->remove();
                    current = authList->current();
                    continue;
                }
            }
            current = authList->next();
        }
    }
}
Esempio n. 3
0
void
KPasswdServer::removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info)
{
   AuthInfoList *authList = m_authDict.find(key);
   if (!authList)
      return;

   for(AuthInfo *current = authList->first();
       current; )
   {
       if (current->realmValue == info.realmValue)
       {
          authList->remove();
          current = authList->current();
       }
       else
       {
          current = authList->next();
       }
   }
   if (authList->isEmpty())
   {
       m_authDict.remove(key);
   }
}