You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
3.3 KiB
119 lines
3.3 KiB
15 years ago
|
/*
|
||
|
This file is part of the KDE Password Server
|
||
|
|
||
|
Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
|
||
|
|
||
|
This library is free software; you can redistribute it and/or
|
||
|
modify it under the terms of the GNU General Public License
|
||
|
version 2 as published by the Free Software Foundation.
|
||
|
|
||
|
This software is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this library; see the file COPYING. If not, write to
|
||
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
//----------------------------------------------------------------------------
|
||
|
//
|
||
|
// KDE Password Server
|
||
|
// $Id$
|
||
|
|
||
|
#ifndef KPASSWDSERVER_H
|
||
|
#define KPASSWDSERVER_H
|
||
|
|
||
15 years ago
|
#include <tqdict.h>
|
||
|
#include <tqintdict.h>
|
||
15 years ago
|
|
||
|
#include <dcopclient.h>
|
||
12 years ago
|
#include <tdeio/authinfo.h>
|
||
15 years ago
|
#include <kded/kdedmodule.h>
|
||
|
|
||
|
namespace KWallet {
|
||
|
class Wallet;
|
||
|
}
|
||
|
|
||
|
class KPasswdServer : public KDEDModule
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
K_DCOP
|
||
|
public:
|
||
15 years ago
|
KPasswdServer(const TQCString &);
|
||
15 years ago
|
~KPasswdServer();
|
||
|
|
||
|
k_dcop:
|
||
|
// KDE4 merge
|
||
12 years ago
|
TDEIO::AuthInfo checkAuthInfo(TDEIO::AuthInfo, long, unsigned long);
|
||
|
TDEIO::AuthInfo checkAuthInfo(TDEIO::AuthInfo, long);
|
||
|
TDEIO::AuthInfo queryAuthInfo(TDEIO::AuthInfo, TQString, long, long, unsigned long);
|
||
|
TDEIO::AuthInfo queryAuthInfo(TDEIO::AuthInfo, TQString, long, long);
|
||
|
void addAuthInfo(TDEIO::AuthInfo, long);
|
||
15 years ago
|
|
||
|
public slots:
|
||
|
void processRequest();
|
||
|
// Remove all authentication info associated with windowId
|
||
|
void removeAuthForWindowId(long windowId);
|
||
|
|
||
|
protected:
|
||
|
struct AuthInfo;
|
||
|
|
||
12 years ago
|
TQString createCacheKey( const TDEIO::AuthInfo &info );
|
||
|
const AuthInfo *findAuthInfoItem(const TQString &key, const TDEIO::AuthInfo &info);
|
||
|
void removeAuthInfoItem(const TQString &key, const TDEIO::AuthInfo &info);
|
||
|
void addAuthInfoItem(const TQString &key, const TDEIO::AuthInfo &info, long windowId, long seqNr, bool canceled);
|
||
|
TDEIO::AuthInfo copyAuthInfo(const AuthInfo *);
|
||
15 years ago
|
void updateAuthExpire(const TQString &key, const AuthInfo *, long windowId, bool keep);
|
||
14 years ago
|
int findWalletEntry( const TQMap<TQString,TQString>& map, const TQString& username );
|
||
15 years ago
|
bool openWallet( WId windowId );
|
||
|
|
||
|
struct AuthInfo {
|
||
|
AuthInfo() { expire = expNever; isCanceled = false; seqNr = 0; }
|
||
|
|
||
|
KURL url;
|
||
15 years ago
|
TQString directory;
|
||
|
TQString username;
|
||
|
TQString password;
|
||
|
TQString realmValue;
|
||
|
TQString digestInfo;
|
||
15 years ago
|
|
||
|
enum { expNever, expWindowClose, expTime } expire;
|
||
15 years ago
|
TQValueList<long> windowList;
|
||
15 years ago
|
unsigned long expireTime;
|
||
|
long seqNr;
|
||
|
|
||
|
bool isCanceled;
|
||
|
};
|
||
|
|
||
15 years ago
|
class AuthInfoList : public TQPtrList<AuthInfo>
|
||
15 years ago
|
{
|
||
|
public:
|
||
|
AuthInfoList() { setAutoDelete(true); }
|
||
15 years ago
|
int compareItems(TQPtrCollection::Item n1, TQPtrCollection::Item n2);
|
||
15 years ago
|
};
|
||
|
|
||
15 years ago
|
TQDict< AuthInfoList > m_authDict;
|
||
15 years ago
|
|
||
|
struct Request {
|
||
|
DCOPClient *client;
|
||
|
DCOPClientTransaction *transaction;
|
||
15 years ago
|
TQString key;
|
||
12 years ago
|
TDEIO::AuthInfo info;
|
||
15 years ago
|
TQString errorMsg;
|
||
15 years ago
|
long windowId;
|
||
|
long seqNr;
|
||
|
bool prompt;
|
||
|
};
|
||
|
|
||
15 years ago
|
TQPtrList< Request > m_authPending;
|
||
|
TQPtrList< Request > m_authWait;
|
||
|
TQIntDict<TQStringList> mWindowIdList;
|
||
15 years ago
|
DCOPClient *m_dcopClient;
|
||
|
KWallet::Wallet* m_wallet;
|
||
|
long m_seqNr;
|
||
|
};
|
||
|
|
||
|
#endif
|