KIO
Go to the documentation of this file.
24 #include <ksslconfig.h>
26 #include <QtCore/QRegExp>
27 #include <QtCore/QUrl>
33 class KSSLPeerInfoPrivate {
35 KSSLPeerInfoPrivate() {}
36 ~KSSLPeerInfoPrivate() { }
43 :d(new KSSLPeerInfoPrivate)
56 d->peerHost = realHost.trimmed();
57 while(d->peerHost.endsWith(
'.'))
58 d->peerHost.truncate(d->peerHost.length()-1);
60 d->peerHost = QString::fromLatin1(QUrl::toAce(d->peerHost));
66 QStringList cns = certinfo.getValue(
"CN").split(QRegExp(
"[ \n\r]"), QString::SkipEmptyParts);
69 for (QStringList::const_iterator cn = cns.constBegin(); cn != cns.constEnd(); ++cn) {
84 kDebug(7029) <<
"Matching CN=[" << cn <<
"] to ["
85 << d->peerHost <<
"]" << endl;
88 if (QRegExp(
"[^a-zA-Z0-9\\.\\*\\-]").indexIn(cn) >= 0) {
89 kDebug(7029) <<
"CN contains invalid characters! Failing.";
94 while(cn.endsWith(
'.'))
95 cn.truncate(cn.length()-1);
102 rx.setPattern(
"[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}");
103 if (rx.exactMatch(d->peerHost))
104 return d->peerHost == cn;
107 rx.setPattern(
"^\\[.*\\]$");
108 if (rx.exactMatch(d->peerHost))
109 return d->peerHost == cn;
111 if (cn.contains(
'*')) {
114 QStringList parts = cn.split(
'.', QString::SkipEmptyParts);
116 while (parts.count() > 2)
119 if (parts.count() != 2) {
123 if (parts[0].contains(
'*') || parts[1].contains(
'*')) {
130 if (QRegExp(cn, Qt::CaseInsensitive, QRegExp::Wildcard).exactMatch(d->peerHost) &&
131 cn.split(
'.', QString::SkipEmptyParts).count() ==
132 d->peerHost.split(
'.', QString::SkipEmptyParts).count())
136 if (cn.startsWith(QLatin1String(
"*."))) {
138 if (chopped == d->peerHost) {
147 if (cn == d->peerHost)
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Apr 16 2013 19:14:52 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.