OtrProxyChannel::Adaptee::Adaptee(OtrProxyChannel *pc,
        const QDBusConnection &dbusConnection,
        const Tp::TextChannelPtr &channel,
        const OTR::SessionContext &context,
        ProxyService *ps)
    : QObject(pc),
    adaptor(new Tp::Service::ChannelProxyInterfaceOTRAdaptor(dbusConnection, this, pc->dbusObject())),
    pc(pc),
    chan(channel),
    isConnected(false),
    otrSes(this, context, ps->managerOTR()),
    ps(ps),
    isGenerating(false),
    aboutToInit(false)
{
    qCDebug(KTP_PROXY) << "Created OTR session for context: "
        << "Account id: " << context.accountId
        << " Account name: " << context.accountName
        << " recipient name: " << context.recipientName
        << " protocol: " << context.protocol;
    connect(chan.data(), SIGNAL(invalidated(Tp::DBusProxy*,const QString&,const QString&)), SLOT(onChannelClosed()));
    connect(&otrSes, SIGNAL(trustLevelChanged(TrustLevel)), SLOT(onTrustLevelChanged(TrustLevel)));
    connect(&otrSes, SIGNAL(sessionRefreshed()), SIGNAL(sessionRefreshed()));
    connect(&otrSes, SIGNAL(authenticationRequested(const QString&)), SIGNAL(peerAuthenticationRequested(const QString&)));
    connect(&otrSes, SIGNAL(authenticationInProgress()), SIGNAL(peerAuthenticationInProgress()));
    connect(&otrSes, SIGNAL(authenticationConcluded(bool)), SIGNAL(peerAuthenticationConcluded(bool)));
    connect(&otrSes, SIGNAL(authenticationAborted()), SIGNAL(peerAuthenticationAborted()));
    connect(&otrSes, SIGNAL(authenticationError()), SIGNAL(peerAuthenticationError()));
    connect(&otrSes, SIGNAL(authenticationCheated()), SIGNAL(peerAuthenticationCheated()));

    sender = channel->connection()->selfHandle();
}
Example #2
0
void MainWindow::skipLoginScreen(const QString &username, const QString &password)
{
    connectWindow_->setAcountData(username, password);
    getServers_ = new GetServers(this);
    getServers_->setLoginData(username, password);
    connect(getServers_, SIGNAL(updateFinished(bool, QString, bool)), SLOT(onGetServersFinished(bool, QString, bool)));
    connect(getServers_, SIGNAL(authenticationError()), SLOT(onAuthenticationError()));
    getServers_->start();
}
	void Connection::IncorrectAuth (HalfPacket hp)
	{
		qDebug () << Q_FUNC_INFO;
		Str1251 string;
		FromMRIM (hp.Data_, string);
		qDebug () << string;

		Disconnect ();

		emit authenticationError (string);
	}
bool CalDavClient::initConfig()
{
    FUNCTION_CALL_TRACE;
    LOG_DEBUG("Initiating config...");

    mAccountId = 0;

    QString accountIdString = iProfile.key(Buteo::KEY_ACCOUNT_ID);
    QString serviceName = iProfile.key(KEY_ACCOUNT_SERVICE_NAME);
    QString remoteDatabasePath = iProfile.key(Buteo::KEY_REMOTE_DATABASE);

    bool accountIdOk = false;
    int accountId = accountIdString.toInt(&accountIdOk);
    if (!accountIdOk) {
        LOG_WARNING("account id not found in profile");
        return false;
    }
    if (serviceName.isEmpty()) {
        LOG_WARNING("service name not found in profile");
        return false;
    }
    if (remoteDatabasePath.isEmpty()) {
        LOG_WARNING("remote database path not found in profile");
        return false;
    }

    // caldav plugin relies on the path ending with a separator
    if (!remoteDatabasePath.endsWith('/')) {
        remoteDatabasePath += '/';
    }

    if (!mManager) {
        mManager = new Accounts::Manager(this);
    }

    mAuth = new AuthHandler(mManager, accountId, serviceName, remoteDatabasePath);
    if (!mAuth->init()) {
        return false;
    }
    connect(mAuth, SIGNAL(success()), this, SLOT(start()));
    connect(mAuth, SIGNAL(failed()), this, SLOT(authenticationError()));

    mSettings.setIgnoreSSLErrors(true);
    mSettings.setUrl(remoteDatabasePath);
    mSettings.setAccountId(accountId);

    mSyncDirection = iProfile.syncDirection();
    mConflictResPolicy = iProfile.conflictResolutionPolicy();

    mAccountId = accountId;
    return true;
}
void ServerAuthenticationManager::processAuthenticationMessage( VncServerClient* client,
																VariantArrayMessage& message )
{
	qDebug() << "ServerAuthenticationManager::processAuthenticationMessage():"
			 << "state" << client->authState()
			 << "type" << client->authType()
			 << "host" << client->hostAddress()
			 << "user" << client->username();

	switch( client->authType() )
	{
	// no authentication
	case RfbItalcAuth::None:
		client->setAuthState( VncServerClient::AuthFinishedSuccess );
		break;

		// host has to be in list of allowed hosts
	case RfbItalcAuth::HostWhiteList:
		client->setAuthState( performHostWhitelistAuth( client, message ) );
		break;

		// authentication via DSA-challenge/-response
	case RfbItalcAuth::DSA:
		client->setAuthState( performKeyAuthentication( client, message ) );
		break;

	case RfbItalcAuth::Logon:
		client->setAuthState( performLogonAuthentication( client, message ) );
		break;

	case RfbItalcAuth::Token:
		client->setAuthState( performTokenAuthentication( client, message ) );
		break;

	default:
		break;
	}

	if( client->authState() == VncServerClient::AuthFinishedFail )
	{
		emit authenticationError( client->hostAddress(), client->username() );
	}
}
bool
GContactClient::initConfig ()
{

    FUNCTION_CALL_TRACE;

    LOG_DEBUG("Initiating config...");

    mAccountId = 0;
    QString scope = "";
    QStringList accountList = iProfile.keyValues(Buteo::KEY_ACCOUNT_ID);
    QStringList scopeList   = iProfile.keyValues(Buteo::KEY_REMOTE_DATABASE);
    if (!accountList.isEmpty()) {
        QString aId = accountList.first();
        if (aId != NULL) {
            mAccountId = aId.toInt();
        }
    } else {
        return false;
    }

    if (!scopeList.isEmpty()) {
        scope = scopeList.first();
    }
    mGoogleAuth = new GAuth (mAccountId, scope);
    if (!mGoogleAuth->init()) {
        return false;
    }

    mSyncTarget = QString("buteo-") + QString::number(mAccountId);

    connect(mGoogleAuth, SIGNAL(success()), this, SLOT(start()));
    connect(mGoogleAuth, SIGNAL(failed()), this, SLOT(authenticationError()));

    mSyncDirection = iProfile.syncDirection();

    mConflictResPolicy = iProfile.conflictResolutionPolicy();

    return true;
}