[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.4/kdenetwork/kopete/protocols/irc/libkirc
From: Tommi Rantala <tommi.rantala () cs ! helsinki ! fi>
Date: 2005-08-09 16:35:11
Message-ID: 1123605311.005135.13135.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 444308 by rantala:
CCBUG: 104048
Backport:
Fix crash when invalid SSL certificate not accepted.
M +13 -9 kircengine.cpp
M +29 -38 ksslsocket.cpp
M +4 -1 ksslsocket.h
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/libkirc/kircengine.cpp #444307:444308
@@ -1,10 +1,11 @@
/*
kirc.cpp - IRC Client
+ Copyright (c) 2005 by Tommi Rantala <tommi.rantala@cs.helsinki.fi>
Copyright (c) 2003-2004 by Michel Hermier <michel.hermier@wanadoo.fr>
Copyright (c) 2002 by Nick Betcher <nbetcher@kde.org>
- Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
+ Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
@@ -108,6 +109,10 @@
#ifdef KIRC_SSL_SUPPORT
m_sock = new KSSLSocket;
m_sock->setSocketFlags( KExtendedSocket::inetSocket );
+
+ connect(m_sock, SIGNAL(certificateAccepted()), SLOT(slotConnected()));
+ connect(m_sock, SIGNAL(certificateRejected()), SLOT(slotConnectionClosed()));
+ connect(m_sock, SIGNAL(sslFailure()), SLOT(slotConnectionClosed()));
}
else
#else
@@ -118,16 +123,13 @@
{
m_sock = new KExtendedSocket;
m_sock->setSocketFlags( KExtendedSocket::inputBufferedSocket | KExtendedSocket::inetSocket );
+
+ connect(m_sock, SIGNAL(connectionSuccess()), SLOT(slotConnected()));
+ connect(m_sock, SIGNAL(connectionFailed(int)), SLOT(error(int)));
}
- QObject::connect(m_sock, SIGNAL(closed(int)),
- this, SLOT(slotConnectionClosed()));
- QObject::connect(m_sock, SIGNAL(readyRead()),
- this, SLOT(slotReadyRead()));
- QObject::connect(m_sock, SIGNAL(connectionSuccess()),
- this, SLOT(slotConnected()));
- QObject::connect(m_sock, SIGNAL(connectionFailed(int)),
- this, SLOT(error(int)));
+ connect(m_sock, SIGNAL(closed(int)), SLOT(slotConnectionClosed()));
+ connect(m_sock, SIGNAL(readyRead()), SLOT(slotReadyRead()));
}
}
@@ -459,3 +461,5 @@
}
#include "kircengine.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/libkirc/ksslsocket.cpp #444307:444308
@@ -1,9 +1,10 @@
/*
ksslsocket.cpp - KDE SSL Socket
+ Copyright (c) 2005 by Tommi Rantala <tommi.rantala@cs.helsinki.fi>
Copyright (c) 2004 by Jason Keirstead <jason@keirstead.org>
- Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
+ Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
@@ -127,51 +128,41 @@
void KSSLSocket::slotConnected()
{
- if( KSSL::doesSSLWork() )
- {
- if( d->kssl )
- {
- kdDebug(14120) << k_funcinfo << "ReInitialize SSL connection..." << endl;
- d->kssl->reInitialize();
- }
- else
- {
- kdDebug(14120) << k_funcinfo << "Trying SSL connection..." << endl;
+ if (!KSSL::doesSSLWork()) {
+ kdError(14120) << k_funcinfo << "SSL not functional!" << endl;
- d->kssl = new KSSL();
- if( d->kssl->connect( sockfd ) == 1)
- {
- //Disconnect the KExtSocket notifier slot, we use our own
- QObject::disconnect( readNotifier(), SIGNAL(activated( int )),
- this, SLOT( socketActivityRead() ) );
-
- QObject::connect( readNotifier(), SIGNAL(activated( int )),
- this, SLOT( slotReadData() ) );
- }
- else
- {
- delete d->kssl;
- d->kssl = 0;
- }
- }
+ closeNow();
+ emit sslFailure();
+ return;
}
- if( d->kssl )
- {
- readNotifier()->setEnabled(true);
+ delete d->kssl;
+ d->kssl = new KSSL();
- if( verifyCertificate() != 1 )
- {
- closeNow();
- }
- }
- else
- {
- kdError(14120) << k_funcinfo << "SSL not functional!" << endl;
+ if (d->kssl->connect( sockfd ) != 1) {
+ kdError(14120) << k_funcinfo << "SSL connect() failed." << endl;
+ closeNow();
emit sslFailure();
+ return;
+ }
+
+ //Disconnect the KExtSocket notifier slot, we use our own
+ QObject::disconnect( readNotifier(), SIGNAL(activated( int )),
+ this, SLOT(socketActivityRead()) );
+
+ QObject::connect( readNotifier(), SIGNAL(activated( int )),
+ this, SLOT(slotReadData()) );
+
+ readNotifier()->setEnabled(true);
+
+ if (verifyCertificate() != 1) {
closeNow();
+ emit certificateRejected();
+ return;
}
+
+ emit certificateAccepted();
}
void KSSLSocket::slotDisconnected()
--- branches/KDE/3.4/kdenetwork/kopete/protocols/irc/libkirc/ksslsocket.h #444307:444308
@@ -5,9 +5,10 @@
/*
ksslsocket.h - KDE SSL Socket
+ Copyright (c) 2005 by Tommi Rantala <tommi.rantala@cs.helsinki.fi>
Copyright (c) 2004 by Jason Keirstead <jason@keirstead.org>
- Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
+ Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
@@ -42,6 +43,8 @@
signals:
void sslFailure();
+ void certificateAccepted();
+ void certificateRejected();
private slots:
void slotConnected();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic