Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslsocket.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | class QSslSocketGlobalData | - | ||||||||||||
6 | { | - | ||||||||||||
7 | public: | - | ||||||||||||
8 | QSslSocketGlobalData() : config(new QSslConfigurationPrivate) {} | - | ||||||||||||
9 | - | |||||||||||||
10 | QMutex mutex; | - | ||||||||||||
11 | QList<QSslCipher> supportedCiphers; | - | ||||||||||||
12 | QVector<QSslEllipticCurve> supportedEllipticCurves; | - | ||||||||||||
13 | QExplicitlySharedDataPointer<QSslConfigurationPrivate> config; | - | ||||||||||||
14 | }; | - | ||||||||||||
15 | namespace { namespace Q_QGS_globalData { typedef QSslSocketGlobalData Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized) guard.store(QtGlobalStatic::Destroyed); } }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return &holder.value; } } } static QGlobalStatic<QSslSocketGlobalData, Q_QGS_globalData::innerFunction, Q_QGS_globalData::guard> globalData; | - | ||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | - | |||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | QSslSocket::QSslSocket(QObject *parent) | - | ||||||||||||
23 | : QTcpSocket(*new QSslSocketBackendPrivate, parent) | - | ||||||||||||
24 | { | - | ||||||||||||
25 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
26 | - | |||||||||||||
27 | - | |||||||||||||
28 | - | |||||||||||||
29 | d->q_ptr = this; | - | ||||||||||||
30 | d->init(); | - | ||||||||||||
31 | } | - | ||||||||||||
32 | - | |||||||||||||
33 | - | |||||||||||||
34 | - | |||||||||||||
35 | - | |||||||||||||
36 | QSslSocket::~QSslSocket() | - | ||||||||||||
37 | { | - | ||||||||||||
38 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
39 | - | |||||||||||||
40 | - | |||||||||||||
41 | - | |||||||||||||
42 | delete d->plainSocket; | - | ||||||||||||
43 | d->plainSocket = 0; | - | ||||||||||||
44 | } | - | ||||||||||||
45 | void QSslSocket::resume() | - | ||||||||||||
46 | { | - | ||||||||||||
47 | - | |||||||||||||
48 | QMetaObject::invokeMethod(this, "_q_resumeImplementation", Qt::QueuedConnection); | - | ||||||||||||
49 | } | - | ||||||||||||
50 | void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode, NetworkLayerProtocol protocol) | - | ||||||||||||
51 | { | - | ||||||||||||
52 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
53 | if (d->state == ConnectedState || d->state == ConnectingState) { | - | ||||||||||||
54 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger( | - | ||||||||||||
55 | __FILE__ | - | ||||||||||||
56 | , | - | ||||||||||||
57 | 434440 | - | ||||||||||||
58 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") | - | ||||||||||||
59 | ; | - | ||||||||||||
60 | return; | - | ||||||||||||
61 | } | - | ||||||||||||
62 | - | |||||||||||||
63 | d->init(); | - | ||||||||||||
64 | d->autoStartHandshake = true; | - | ||||||||||||
65 | d->initialized = true; | - | ||||||||||||
66 | - | |||||||||||||
67 | - | |||||||||||||
68 | - | |||||||||||||
69 | connectToHost(hostName, port, mode, protocol); | - | ||||||||||||
70 | } | - | ||||||||||||
71 | void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, | - | ||||||||||||
72 | const QString &sslPeerName, OpenMode mode, | - | ||||||||||||
73 | NetworkLayerProtocol protocol) | - | ||||||||||||
74 | { | - | ||||||||||||
75 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
76 | if (d->state == ConnectedState || d->state == ConnectingState) { | - | ||||||||||||
77 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger( | - | ||||||||||||
78 | __FILE__ | - | ||||||||||||
79 | , | - | ||||||||||||
80 | 465471 | - | ||||||||||||
81 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::connectToHostEncrypted() called when already connecting/connected") | - | ||||||||||||
82 | ; | - | ||||||||||||
83 | return; | - | ||||||||||||
84 | } | - | ||||||||||||
85 | - | |||||||||||||
86 | d->init(); | - | ||||||||||||
87 | d->autoStartHandshake = true; | - | ||||||||||||
88 | d->initialized = true; | - | ||||||||||||
89 | d->verificationPeerName = sslPeerName; | - | ||||||||||||
90 | - | |||||||||||||
91 | - | |||||||||||||
92 | - | |||||||||||||
93 | connectToHost(hostName, port, mode, protocol); | - | ||||||||||||
94 | } | - | ||||||||||||
95 | bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state, OpenMode openMode) | - | ||||||||||||
96 | { | - | ||||||||||||
97 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
98 | - | |||||||||||||
99 | - | |||||||||||||
100 | - | |||||||||||||
101 | - | |||||||||||||
102 | if (!d->plainSocket
| 0-69 | ||||||||||||
103 | d->createPlainSocket(openMode); executed 69 times by 3 tests: d->createPlainSocket(openMode); Executed by:
| 69 | ||||||||||||
104 | bool retVal = d->plainSocket->setSocketDescriptor(socketDescriptor, state, openMode); | - | ||||||||||||
105 | d->cachedSocketDescriptor = d->plainSocket->socketDescriptor(); | - | ||||||||||||
106 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||
107 | setSocketState(state); | - | ||||||||||||
108 | setOpenMode(openMode); | - | ||||||||||||
109 | setLocalPort(d->plainSocket->localPort()); | - | ||||||||||||
110 | setLocalAddress(d->plainSocket->localAddress()); | - | ||||||||||||
111 | setPeerPort(d->plainSocket->peerPort()); | - | ||||||||||||
112 | setPeerAddress(d->plainSocket->peerAddress()); | - | ||||||||||||
113 | setPeerName(d->plainSocket->peerName()); | - | ||||||||||||
114 | d->readChannelCount = d->plainSocket->readChannelCount(); | - | ||||||||||||
115 | d->writeChannelCount = d->plainSocket->writeChannelCount(); | - | ||||||||||||
116 | return executed 69 times by 3 tests: retVal;return retVal; Executed by:
executed 69 times by 3 tests: return retVal; Executed by:
| 69 | ||||||||||||
117 | } | - | ||||||||||||
118 | - | |||||||||||||
119 | - | |||||||||||||
120 | - | |||||||||||||
121 | - | |||||||||||||
122 | - | |||||||||||||
123 | - | |||||||||||||
124 | - | |||||||||||||
125 | void QSslSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) | - | ||||||||||||
126 | { | - | ||||||||||||
127 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
128 | if (d->plainSocket) | - | ||||||||||||
129 | d->plainSocket->setSocketOption(option, value); | - | ||||||||||||
130 | } | - | ||||||||||||
131 | - | |||||||||||||
132 | - | |||||||||||||
133 | - | |||||||||||||
134 | - | |||||||||||||
135 | - | |||||||||||||
136 | - | |||||||||||||
137 | - | |||||||||||||
138 | QVariant QSslSocket::socketOption(QAbstractSocket::SocketOption option) | - | ||||||||||||
139 | { | - | ||||||||||||
140 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
141 | if (d->plainSocket) | - | ||||||||||||
142 | return d->plainSocket->socketOption(option); | - | ||||||||||||
143 | else | - | ||||||||||||
144 | return QVariant(); | - | ||||||||||||
145 | } | - | ||||||||||||
146 | QSslSocket::SslMode QSslSocket::mode() const | - | ||||||||||||
147 | { | - | ||||||||||||
148 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
149 | return d->mode; | - | ||||||||||||
150 | } | - | ||||||||||||
151 | bool QSslSocket::isEncrypted() const | - | ||||||||||||
152 | { | - | ||||||||||||
153 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
154 | return d->connectionEncrypted; | - | ||||||||||||
155 | } | - | ||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | - | |||||||||||||
159 | - | |||||||||||||
160 | - | |||||||||||||
161 | - | |||||||||||||
162 | QSsl::SslProtocol QSslSocket::protocol() const | - | ||||||||||||
163 | { | - | ||||||||||||
164 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
165 | return d->configuration.protocol; | - | ||||||||||||
166 | } | - | ||||||||||||
167 | - | |||||||||||||
168 | - | |||||||||||||
169 | - | |||||||||||||
170 | - | |||||||||||||
171 | - | |||||||||||||
172 | - | |||||||||||||
173 | void QSslSocket::setProtocol(QSsl::SslProtocol protocol) | - | ||||||||||||
174 | { | - | ||||||||||||
175 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
176 | d->configuration.protocol = protocol; | - | ||||||||||||
177 | } | - | ||||||||||||
178 | QSslSocket::PeerVerifyMode QSslSocket::peerVerifyMode() const | - | ||||||||||||
179 | { | - | ||||||||||||
180 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
181 | return d->configuration.peerVerifyMode; | - | ||||||||||||
182 | } | - | ||||||||||||
183 | void QSslSocket::setPeerVerifyMode(QSslSocket::PeerVerifyMode mode) | - | ||||||||||||
184 | { | - | ||||||||||||
185 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
186 | d->configuration.peerVerifyMode = mode; | - | ||||||||||||
187 | } | - | ||||||||||||
188 | int QSslSocket::peerVerifyDepth() const | - | ||||||||||||
189 | { | - | ||||||||||||
190 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
191 | return d->configuration.peerVerifyDepth; | - | ||||||||||||
192 | } | - | ||||||||||||
193 | void QSslSocket::setPeerVerifyDepth(int depth) | - | ||||||||||||
194 | { | - | ||||||||||||
195 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
196 | if (depth < 0) { | - | ||||||||||||
197 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger(__FILE__, 679687, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::setPeerVerifyDepth: cannot set negative depth of %d", depth); | - | ||||||||||||
198 | return; | - | ||||||||||||
199 | } | - | ||||||||||||
200 | d->configuration.peerVerifyDepth = depth; | - | ||||||||||||
201 | } | - | ||||||||||||
202 | QString QSslSocket::peerVerifyName() const | - | ||||||||||||
203 | { | - | ||||||||||||
204 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
205 | return d->verificationPeerName; | - | ||||||||||||
206 | } | - | ||||||||||||
207 | void QSslSocket::setPeerVerifyName(const QString &hostName) | - | ||||||||||||
208 | { | - | ||||||||||||
209 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
210 | d->verificationPeerName = hostName; | - | ||||||||||||
211 | } | - | ||||||||||||
212 | - | |||||||||||||
213 | - | |||||||||||||
214 | - | |||||||||||||
215 | - | |||||||||||||
216 | - | |||||||||||||
217 | - | |||||||||||||
218 | - | |||||||||||||
219 | qint64 QSslSocket::bytesAvailable() const | - | ||||||||||||
220 | { | - | ||||||||||||
221 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
222 | if (d->mode == UnencryptedMode) | - | ||||||||||||
223 | return QIODevice::bytesAvailable() + (d->plainSocket ? d->plainSocket->bytesAvailable() : 0); | - | ||||||||||||
224 | return QIODevice::bytesAvailable(); | - | ||||||||||||
225 | } | - | ||||||||||||
226 | - | |||||||||||||
227 | - | |||||||||||||
228 | - | |||||||||||||
229 | - | |||||||||||||
230 | - | |||||||||||||
231 | - | |||||||||||||
232 | - | |||||||||||||
233 | qint64 QSslSocket::bytesToWrite() const | - | ||||||||||||
234 | { | - | ||||||||||||
235 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
236 | if (d->mode == UnencryptedMode) | - | ||||||||||||
237 | return d->plainSocket ? d->plainSocket->bytesToWrite() : 0; | - | ||||||||||||
238 | return d->writeBuffer.size(); | - | ||||||||||||
239 | } | - | ||||||||||||
240 | qint64 QSslSocket::encryptedBytesAvailable() const | - | ||||||||||||
241 | { | - | ||||||||||||
242 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
243 | if (d->mode == UnencryptedMode) | - | ||||||||||||
244 | return 0; | - | ||||||||||||
245 | return d->plainSocket->bytesAvailable(); | - | ||||||||||||
246 | } | - | ||||||||||||
247 | - | |||||||||||||
248 | - | |||||||||||||
249 | - | |||||||||||||
250 | - | |||||||||||||
251 | - | |||||||||||||
252 | - | |||||||||||||
253 | - | |||||||||||||
254 | qint64 QSslSocket::encryptedBytesToWrite() const | - | ||||||||||||
255 | { | - | ||||||||||||
256 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
257 | if (d->mode == UnencryptedMode) | - | ||||||||||||
258 | return 0; | - | ||||||||||||
259 | return d->plainSocket->bytesToWrite(); | - | ||||||||||||
260 | } | - | ||||||||||||
261 | - | |||||||||||||
262 | - | |||||||||||||
263 | - | |||||||||||||
264 | - | |||||||||||||
265 | - | |||||||||||||
266 | - | |||||||||||||
267 | - | |||||||||||||
268 | bool QSslSocket::canReadLine() const | - | ||||||||||||
269 | { | - | ||||||||||||
270 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
271 | if (d->mode == UnencryptedMode) | - | ||||||||||||
272 | return QIODevice::canReadLine() || (d->plainSocket && d->plainSocket->canReadLine()); | - | ||||||||||||
273 | return QIODevice::canReadLine(); | - | ||||||||||||
274 | } | - | ||||||||||||
275 | - | |||||||||||||
276 | - | |||||||||||||
277 | - | |||||||||||||
278 | - | |||||||||||||
279 | void QSslSocket::close() | - | ||||||||||||
280 | { | - | ||||||||||||
281 | - | |||||||||||||
282 | - | |||||||||||||
283 | - | |||||||||||||
284 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
285 | if (encryptedBytesToWrite() || !d->writeBuffer.isEmpty()) | - | ||||||||||||
286 | flush(); | - | ||||||||||||
287 | if (d->plainSocket) | - | ||||||||||||
288 | d->plainSocket->close(); | - | ||||||||||||
289 | QTcpSocket::close(); | - | ||||||||||||
290 | - | |||||||||||||
291 | - | |||||||||||||
292 | d->buffer.clear(); | - | ||||||||||||
293 | d->writeBuffer.clear(); | - | ||||||||||||
294 | } | - | ||||||||||||
295 | - | |||||||||||||
296 | - | |||||||||||||
297 | - | |||||||||||||
298 | - | |||||||||||||
299 | bool QSslSocket::atEnd() const | - | ||||||||||||
300 | { | - | ||||||||||||
301 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
302 | if (d->mode == UnencryptedMode) | - | ||||||||||||
303 | return QIODevice::atEnd() && (!d->plainSocket || d->plainSocket->atEnd()); | - | ||||||||||||
304 | return QIODevice::atEnd(); | - | ||||||||||||
305 | } | - | ||||||||||||
306 | bool QSslSocket::flush() | - | ||||||||||||
307 | { | - | ||||||||||||
308 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
309 | - | |||||||||||||
310 | - | |||||||||||||
311 | - | |||||||||||||
312 | if (d->mode != UnencryptedMode) | - | ||||||||||||
313 | - | |||||||||||||
314 | d->transmit(); | - | ||||||||||||
315 | - | |||||||||||||
316 | return d->plainSocket ? d->plainSocket->flush() : false; | - | ||||||||||||
317 | } | - | ||||||||||||
318 | - | |||||||||||||
319 | - | |||||||||||||
320 | - | |||||||||||||
321 | - | |||||||||||||
322 | - | |||||||||||||
323 | - | |||||||||||||
324 | void QSslSocket::setReadBufferSize(qint64 size) | - | ||||||||||||
325 | { | - | ||||||||||||
326 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
327 | d->readBufferMaxSize = size; | - | ||||||||||||
328 | - | |||||||||||||
329 | if (d->plainSocket) | - | ||||||||||||
330 | d->plainSocket->setReadBufferSize(size); | - | ||||||||||||
331 | } | - | ||||||||||||
332 | void QSslSocket::abort() | - | ||||||||||||
333 | { | - | ||||||||||||
334 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | - | |||||||||||||
338 | if (d->plainSocket) | - | ||||||||||||
339 | d->plainSocket->abort(); | - | ||||||||||||
340 | close(); | - | ||||||||||||
341 | } | - | ||||||||||||
342 | QSslConfiguration QSslSocket::sslConfiguration() const | - | ||||||||||||
343 | { | - | ||||||||||||
344 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
345 | - | |||||||||||||
346 | - | |||||||||||||
347 | QSslConfigurationPrivate *copy = new QSslConfigurationPrivate(d->configuration); | - | ||||||||||||
348 | copy->ref.store(0); | - | ||||||||||||
349 | copy->sessionCipher = d->sessionCipher(); | - | ||||||||||||
350 | copy->sessionProtocol = d->sessionProtocol(); | - | ||||||||||||
351 | - | |||||||||||||
352 | return QSslConfiguration(copy); | - | ||||||||||||
353 | } | - | ||||||||||||
354 | void QSslSocket::setSslConfiguration(const QSslConfiguration &configuration) | - | ||||||||||||
355 | { | - | ||||||||||||
356 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
357 | d->configuration.localCertificateChain = configuration.localCertificateChain(); | - | ||||||||||||
358 | d->configuration.privateKey = configuration.privateKey(); | - | ||||||||||||
359 | d->configuration.ciphers = configuration.ciphers(); | - | ||||||||||||
360 | d->configuration.ellipticCurves = configuration.ellipticCurves(); | - | ||||||||||||
361 | d->configuration.caCertificates = configuration.caCertificates(); | - | ||||||||||||
362 | d->configuration.peerVerifyDepth = configuration.peerVerifyDepth(); | - | ||||||||||||
363 | d->configuration.peerVerifyMode = configuration.peerVerifyMode(); | - | ||||||||||||
364 | d->configuration.protocol = configuration.protocol(); | - | ||||||||||||
365 | d->configuration.sslOptions = configuration.d->sslOptions; | - | ||||||||||||
366 | d->configuration.sslSession = configuration.sessionTicket(); | - | ||||||||||||
367 | d->configuration.sslSessionTicketLifeTimeHint = configuration.sessionTicketLifeTimeHint(); | - | ||||||||||||
368 | d->configuration.nextAllowedProtocols = configuration.allowedNextProtocols(); | - | ||||||||||||
369 | d->configuration.nextNegotiatedProtocol = configuration.nextNegotiatedProtocol(); | - | ||||||||||||
370 | d->configuration.nextProtocolNegotiationStatus = configuration.nextProtocolNegotiationStatus(); | - | ||||||||||||
371 | - | |||||||||||||
372 | - | |||||||||||||
373 | - | |||||||||||||
374 | - | |||||||||||||
375 | if (!configuration.d->allowRootCertOnDemandLoading) | - | ||||||||||||
376 | d->allowRootCertOnDemandLoading = false; | - | ||||||||||||
377 | } | - | ||||||||||||
378 | void QSslSocket::setLocalCertificateChain(const QList<QSslCertificate> &localChain) | - | ||||||||||||
379 | { | - | ||||||||||||
380 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
381 | d->configuration.localCertificateChain = localChain; | - | ||||||||||||
382 | } | - | ||||||||||||
383 | QList<QSslCertificate> QSslSocket::localCertificateChain() const | - | ||||||||||||
384 | { | - | ||||||||||||
385 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
386 | return d->configuration.localCertificateChain; | - | ||||||||||||
387 | } | - | ||||||||||||
388 | void QSslSocket::setLocalCertificate(const QSslCertificate &certificate) | - | ||||||||||||
389 | { | - | ||||||||||||
390 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
391 | d->configuration.localCertificateChain = QList<QSslCertificate>(); | - | ||||||||||||
392 | d->configuration.localCertificateChain += certificate; | - | ||||||||||||
393 | } | - | ||||||||||||
394 | void QSslSocket::setLocalCertificate(const QString &path, | - | ||||||||||||
395 | QSsl::EncodingFormat format) | - | ||||||||||||
396 | { | - | ||||||||||||
397 | QFile file(path); | - | ||||||||||||
398 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) | - | ||||||||||||
399 | setLocalCertificate(QSslCertificate(file.readAll(), format)); | - | ||||||||||||
400 | - | |||||||||||||
401 | } | - | ||||||||||||
402 | - | |||||||||||||
403 | - | |||||||||||||
404 | - | |||||||||||||
405 | - | |||||||||||||
406 | - | |||||||||||||
407 | - | |||||||||||||
408 | - | |||||||||||||
409 | QSslCertificate QSslSocket::localCertificate() const | - | ||||||||||||
410 | { | - | ||||||||||||
411 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
412 | if (d->configuration.localCertificateChain.isEmpty()) | - | ||||||||||||
413 | return QSslCertificate(); | - | ||||||||||||
414 | return d->configuration.localCertificateChain[0]; | - | ||||||||||||
415 | } | - | ||||||||||||
416 | QSslCertificate QSslSocket::peerCertificate() const | - | ||||||||||||
417 | { | - | ||||||||||||
418 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
419 | return d->configuration.peerCertificate; | - | ||||||||||||
420 | } | - | ||||||||||||
421 | QList<QSslCertificate> QSslSocket::peerCertificateChain() const | - | ||||||||||||
422 | { | - | ||||||||||||
423 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
424 | return d->configuration.peerCertificateChain; | - | ||||||||||||
425 | } | - | ||||||||||||
426 | QSslCipher QSslSocket::sessionCipher() const | - | ||||||||||||
427 | { | - | ||||||||||||
428 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
429 | return d->sessionCipher(); | - | ||||||||||||
430 | } | - | ||||||||||||
431 | QSsl::SslProtocol QSslSocket::sessionProtocol() const | - | ||||||||||||
432 | { | - | ||||||||||||
433 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
434 | return d->sessionProtocol(); | - | ||||||||||||
435 | } | - | ||||||||||||
436 | void QSslSocket::setPrivateKey(const QSslKey &key) | - | ||||||||||||
437 | { | - | ||||||||||||
438 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
439 | d->configuration.privateKey = key; | - | ||||||||||||
440 | } | - | ||||||||||||
441 | void QSslSocket::setPrivateKey(const QString &fileName, QSsl::KeyAlgorithm algorithm, | - | ||||||||||||
442 | QSsl::EncodingFormat format, const QByteArray &passPhrase) | - | ||||||||||||
443 | { | - | ||||||||||||
444 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
445 | QFile file(fileName); | - | ||||||||||||
446 | if (file.open(QIODevice::ReadOnly)) { | - | ||||||||||||
447 | d->configuration.privateKey = QSslKey(file.readAll(), algorithm, | - | ||||||||||||
448 | format, QSsl::PrivateKey, passPhrase); | - | ||||||||||||
449 | } | - | ||||||||||||
450 | } | - | ||||||||||||
451 | - | |||||||||||||
452 | - | |||||||||||||
453 | - | |||||||||||||
454 | - | |||||||||||||
455 | - | |||||||||||||
456 | - | |||||||||||||
457 | QSslKey QSslSocket::privateKey() const | - | ||||||||||||
458 | { | - | ||||||||||||
459 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
460 | return d->configuration.privateKey; | - | ||||||||||||
461 | } | - | ||||||||||||
462 | QList<QSslCipher> QSslSocket::ciphers() const | - | ||||||||||||
463 | { | - | ||||||||||||
464 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
465 | return d->configuration.ciphers; | - | ||||||||||||
466 | } | - | ||||||||||||
467 | void QSslSocket::setCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||
468 | { | - | ||||||||||||
469 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
470 | d->configuration.ciphers = ciphers; | - | ||||||||||||
471 | } | - | ||||||||||||
472 | void QSslSocket::setCiphers(const QString &ciphers) | - | ||||||||||||
473 | { | - | ||||||||||||
474 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
475 | d->configuration.ciphers.clear(); | - | ||||||||||||
476 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts))>::type> _container_((const auto cipherNames = ciphers.split(QLatin1Char(':'), QString::SkipEmptyParts))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)); | - | ||||||||||||
477 | for (const QString &cipherName = *_container_.i; _container_.control; _container_.control = 0: cipherNames) { | - | ||||||||||||
478 | QSslCipher cipher(cipherName); | - | ||||||||||||
479 | if (!cipher.isNull()
| 11-30 | ||||||||||||
480 | d->configuration.ciphers << cipher; executed 11 times by 1 test: d->configuration.ciphers << cipher; Executed by:
| 11 | ||||||||||||
481 | } executed 41 times by 1 test: end of block Executed by:
| 41 | ||||||||||||
482 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||
483 | void QSslSocket::setDefaultCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||
484 | { | - | ||||||||||||
485 | QSslSocketPrivate::setDefaultCiphers(ciphers); | - | ||||||||||||
486 | } | - | ||||||||||||
487 | QList<QSslCipher> QSslSocket::defaultCiphers() | - | ||||||||||||
488 | { | - | ||||||||||||
489 | return QSslSocketPrivate::defaultCiphers(); | - | ||||||||||||
490 | } | - | ||||||||||||
491 | QList<QSslCipher> QSslSocket::supportedCiphers() | - | ||||||||||||
492 | { | - | ||||||||||||
493 | return QSslSocketPrivate::supportedCiphers(); | - | ||||||||||||
494 | } | - | ||||||||||||
495 | bool QSslSocket::addCaCertificates(const QString &path, QSsl::EncodingFormat format, | - | ||||||||||||
496 | QRegExp::PatternSyntax syntax) | - | ||||||||||||
497 | { | - | ||||||||||||
498 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
499 | QList<QSslCertificate> certs = QSslCertificate::fromPath(path, format, syntax); | - | ||||||||||||
500 | if (certs.isEmpty()) | - | ||||||||||||
501 | return false; | - | ||||||||||||
502 | - | |||||||||||||
503 | d->configuration.caCertificates += certs; | - | ||||||||||||
504 | return true; | - | ||||||||||||
505 | } | - | ||||||||||||
506 | void QSslSocket::addCaCertificate(const QSslCertificate &certificate) | - | ||||||||||||
507 | { | - | ||||||||||||
508 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
509 | d->configuration.caCertificates += certificate; | - | ||||||||||||
510 | } | - | ||||||||||||
511 | void QSslSocket::addCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||
512 | { | - | ||||||||||||
513 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
514 | d->configuration.caCertificates += certificates; | - | ||||||||||||
515 | } | - | ||||||||||||
516 | void QSslSocket::setCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||
517 | { | - | ||||||||||||
518 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
519 | d->configuration.caCertificates = certificates; | - | ||||||||||||
520 | d->allowRootCertOnDemandLoading = false; | - | ||||||||||||
521 | } | - | ||||||||||||
522 | QList<QSslCertificate> QSslSocket::caCertificates() const | - | ||||||||||||
523 | { | - | ||||||||||||
524 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
525 | return d->configuration.caCertificates; | - | ||||||||||||
526 | } | - | ||||||||||||
527 | bool QSslSocket::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat encoding, | - | ||||||||||||
528 | QRegExp::PatternSyntax syntax) | - | ||||||||||||
529 | { | - | ||||||||||||
530 | return QSslSocketPrivate::addDefaultCaCertificates(path, encoding, syntax); | - | ||||||||||||
531 | } | - | ||||||||||||
532 | void QSslSocket::addDefaultCaCertificate(const QSslCertificate &certificate) | - | ||||||||||||
533 | { | - | ||||||||||||
534 | QSslSocketPrivate::addDefaultCaCertificate(certificate); | - | ||||||||||||
535 | } | - | ||||||||||||
536 | void QSslSocket::addDefaultCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||
537 | { | - | ||||||||||||
538 | QSslSocketPrivate::addDefaultCaCertificates(certificates); | - | ||||||||||||
539 | } | - | ||||||||||||
540 | void QSslSocket::setDefaultCaCertificates(const QList<QSslCertificate> &certificates) | - | ||||||||||||
541 | { | - | ||||||||||||
542 | QSslSocketPrivate::setDefaultCaCertificates(certificates); | - | ||||||||||||
543 | } | - | ||||||||||||
544 | QList<QSslCertificate> QSslSocket::defaultCaCertificates() | - | ||||||||||||
545 | { | - | ||||||||||||
546 | return QSslSocketPrivate::defaultCaCertificates(); | - | ||||||||||||
547 | } | - | ||||||||||||
548 | QList<QSslCertificate> QSslSocket::systemCaCertificates() | - | ||||||||||||
549 | { | - | ||||||||||||
550 | - | |||||||||||||
551 | return QSslSocketPrivate::systemCaCertificates(); | - | ||||||||||||
552 | } | - | ||||||||||||
553 | bool QSslSocket::waitForConnected(int msecs) | - | ||||||||||||
554 | { | - | ||||||||||||
555 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
556 | if (!d->plainSocket) | - | ||||||||||||
557 | return false; | - | ||||||||||||
558 | bool retVal = d->plainSocket->waitForConnected(msecs); | - | ||||||||||||
559 | if (!retVal) { | - | ||||||||||||
560 | setSocketState(d->plainSocket->state()); | - | ||||||||||||
561 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||
562 | } | - | ||||||||||||
563 | return retVal; | - | ||||||||||||
564 | } | - | ||||||||||||
565 | bool QSslSocket::waitForEncrypted(int msecs) | - | ||||||||||||
566 | { | - | ||||||||||||
567 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
568 | if (!d->plainSocket || d->connectionEncrypted) | - | ||||||||||||
569 | return false; | - | ||||||||||||
570 | if (d->mode == UnencryptedMode && !d->autoStartHandshake) | - | ||||||||||||
571 | return false; | - | ||||||||||||
572 | - | |||||||||||||
573 | QElapsedTimer stopWatch; | - | ||||||||||||
574 | stopWatch.start(); | - | ||||||||||||
575 | - | |||||||||||||
576 | if (d->plainSocket->state() != QAbstractSocket::ConnectedState) { | - | ||||||||||||
577 | - | |||||||||||||
578 | if (!d->plainSocket->waitForConnected(msecs)) | - | ||||||||||||
579 | return false; | - | ||||||||||||
580 | } | - | ||||||||||||
581 | - | |||||||||||||
582 | while (!d->connectionEncrypted) { | - | ||||||||||||
583 | - | |||||||||||||
584 | if (d->mode == UnencryptedMode) | - | ||||||||||||
585 | startClientEncryption(); | - | ||||||||||||
586 | - | |||||||||||||
587 | - | |||||||||||||
588 | if (!d->plainSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) | - | ||||||||||||
589 | return false; | - | ||||||||||||
590 | } | - | ||||||||||||
591 | return d->connectionEncrypted; | - | ||||||||||||
592 | } | - | ||||||||||||
593 | - | |||||||||||||
594 | - | |||||||||||||
595 | - | |||||||||||||
596 | - | |||||||||||||
597 | bool QSslSocket::waitForReadyRead(int msecs) | - | ||||||||||||
598 | { | - | ||||||||||||
599 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
600 | if (!d->plainSocket) | - | ||||||||||||
601 | return false; | - | ||||||||||||
602 | if (d->mode == UnencryptedMode && !d->autoStartHandshake) | - | ||||||||||||
603 | return d->plainSocket->waitForReadyRead(msecs); | - | ||||||||||||
604 | - | |||||||||||||
605 | - | |||||||||||||
606 | - | |||||||||||||
607 | - | |||||||||||||
608 | - | |||||||||||||
609 | bool readyReadEmitted = false; | - | ||||||||||||
610 | bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; | - | ||||||||||||
611 | d->readyReadEmittedPointer = &readyReadEmitted; | - | ||||||||||||
612 | - | |||||||||||||
613 | QElapsedTimer stopWatch; | - | ||||||||||||
614 | stopWatch.start(); | - | ||||||||||||
615 | - | |||||||||||||
616 | if (!d->connectionEncrypted) { | - | ||||||||||||
617 | - | |||||||||||||
618 | if (!waitForEncrypted(msecs)) { | - | ||||||||||||
619 | d->readyReadEmittedPointer = previousReadyReadEmittedPointer; | - | ||||||||||||
620 | return false; | - | ||||||||||||
621 | } | - | ||||||||||||
622 | } | - | ||||||||||||
623 | - | |||||||||||||
624 | if (!d->writeBuffer.isEmpty()) { | - | ||||||||||||
625 | - | |||||||||||||
626 | d->transmit(); | - | ||||||||||||
627 | } | - | ||||||||||||
628 | - | |||||||||||||
629 | - | |||||||||||||
630 | - | |||||||||||||
631 | while (!readyReadEmitted && | - | ||||||||||||
632 | d->plainSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) { | - | ||||||||||||
633 | } | - | ||||||||||||
634 | - | |||||||||||||
635 | d->readyReadEmittedPointer = previousReadyReadEmittedPointer; | - | ||||||||||||
636 | return readyReadEmitted; | - | ||||||||||||
637 | } | - | ||||||||||||
638 | - | |||||||||||||
639 | - | |||||||||||||
640 | - | |||||||||||||
641 | - | |||||||||||||
642 | bool QSslSocket::waitForBytesWritten(int msecs) | - | ||||||||||||
643 | { | - | ||||||||||||
644 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
645 | if (!d->plainSocket) | - | ||||||||||||
646 | return false; | - | ||||||||||||
647 | if (d->mode == UnencryptedMode) | - | ||||||||||||
648 | return d->plainSocket->waitForBytesWritten(msecs); | - | ||||||||||||
649 | - | |||||||||||||
650 | QElapsedTimer stopWatch; | - | ||||||||||||
651 | stopWatch.start(); | - | ||||||||||||
652 | - | |||||||||||||
653 | if (!d->connectionEncrypted) { | - | ||||||||||||
654 | - | |||||||||||||
655 | if (!waitForEncrypted(msecs)) | - | ||||||||||||
656 | return false; | - | ||||||||||||
657 | } | - | ||||||||||||
658 | if (!d->writeBuffer.isEmpty()) { | - | ||||||||||||
659 | - | |||||||||||||
660 | d->transmit(); | - | ||||||||||||
661 | } | - | ||||||||||||
662 | - | |||||||||||||
663 | return d->plainSocket->waitForBytesWritten(qt_subtract_from_timeout(msecs, stopWatch.elapsed())); | - | ||||||||||||
664 | } | - | ||||||||||||
665 | bool QSslSocket::waitForDisconnected(int msecs) | - | ||||||||||||
666 | { | - | ||||||||||||
667 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
668 | - | |||||||||||||
669 | - | |||||||||||||
670 | if (state() == UnconnectedState) { | - | ||||||||||||
671 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger(__FILE__, 16691682, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::waitForDisconnected() is not allowed in UnconnectedState"); | - | ||||||||||||
672 | return false; | - | ||||||||||||
673 | } | - | ||||||||||||
674 | - | |||||||||||||
675 | if (!d->plainSocket) | - | ||||||||||||
676 | return false; | - | ||||||||||||
677 | if (d->mode == UnencryptedMode) | - | ||||||||||||
678 | return d->plainSocket->waitForDisconnected(msecs); | - | ||||||||||||
679 | - | |||||||||||||
680 | QElapsedTimer stopWatch; | - | ||||||||||||
681 | stopWatch.start(); | - | ||||||||||||
682 | - | |||||||||||||
683 | if (!d->connectionEncrypted) { | - | ||||||||||||
684 | - | |||||||||||||
685 | if (!waitForEncrypted(msecs)) | - | ||||||||||||
686 | return false; | - | ||||||||||||
687 | } | - | ||||||||||||
688 | bool retVal = d->plainSocket->waitForDisconnected(qt_subtract_from_timeout(msecs, stopWatch.elapsed())); | - | ||||||||||||
689 | if (!retVal) { | - | ||||||||||||
690 | setSocketState(d->plainSocket->state()); | - | ||||||||||||
691 | d->setError(d->plainSocket->error(), d->plainSocket->errorString()); | - | ||||||||||||
692 | } | - | ||||||||||||
693 | return retVal; | - | ||||||||||||
694 | } | - | ||||||||||||
695 | QList<QSslError> QSslSocket::sslErrors() const | - | ||||||||||||
696 | { | - | ||||||||||||
697 | const QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
698 | return d->sslErrors; | - | ||||||||||||
699 | } | - | ||||||||||||
700 | - | |||||||||||||
701 | - | |||||||||||||
702 | - | |||||||||||||
703 | - | |||||||||||||
704 | - | |||||||||||||
705 | - | |||||||||||||
706 | bool QSslSocket::supportsSsl() | - | ||||||||||||
707 | { | - | ||||||||||||
708 | return QSslSocketPrivate::supportsSsl(); | - | ||||||||||||
709 | } | - | ||||||||||||
710 | long QSslSocket::sslLibraryVersionNumber() | - | ||||||||||||
711 | { | - | ||||||||||||
712 | return QSslSocketPrivate::sslLibraryVersionNumber(); | - | ||||||||||||
713 | } | - | ||||||||||||
714 | - | |||||||||||||
715 | - | |||||||||||||
716 | - | |||||||||||||
717 | - | |||||||||||||
718 | - | |||||||||||||
719 | - | |||||||||||||
720 | - | |||||||||||||
721 | QString QSslSocket::sslLibraryVersionString() | - | ||||||||||||
722 | { | - | ||||||||||||
723 | return QSslSocketPrivate::sslLibraryVersionString(); | - | ||||||||||||
724 | } | - | ||||||||||||
725 | long QSslSocket::sslLibraryBuildVersionNumber() | - | ||||||||||||
726 | { | - | ||||||||||||
727 | return QSslSocketPrivate::sslLibraryBuildVersionNumber(); | - | ||||||||||||
728 | } | - | ||||||||||||
729 | QString QSslSocket::sslLibraryBuildVersionString() | - | ||||||||||||
730 | { | - | ||||||||||||
731 | return QSslSocketPrivate::sslLibraryBuildVersionString(); | - | ||||||||||||
732 | } | - | ||||||||||||
733 | void QSslSocket::startClientEncryption() | - | ||||||||||||
734 | { | - | ||||||||||||
735 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
736 | if (d->mode != UnencryptedMode) { | - | ||||||||||||
737 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger( | - | ||||||||||||
738 | __FILE__ | - | ||||||||||||
739 | , | - | ||||||||||||
740 | 17851798 | - | ||||||||||||
741 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake on non-plain connection") | - | ||||||||||||
742 | ; | - | ||||||||||||
743 | return; | - | ||||||||||||
744 | } | - | ||||||||||||
745 | if (state() != ConnectedState) { | - | ||||||||||||
746 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger( | - | ||||||||||||
747 | __FILE__ | - | ||||||||||||
748 | , | - | ||||||||||||
749 | 17901803 | - | ||||||||||||
750 | , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startClientEncryption: cannot start handshake when not connected") | - | ||||||||||||
751 | ; | - | ||||||||||||
752 | return; | - | ||||||||||||
753 | } | - | ||||||||||||
754 | - | |||||||||||||
755 | - | |||||||||||||
756 | - | |||||||||||||
757 | d->mode = SslClientMode; | - | ||||||||||||
758 | modeChanged(d->mode); | - | ||||||||||||
759 | d->startClientEncryption(); | - | ||||||||||||
760 | } | - | ||||||||||||
761 | void QSslSocket::startServerEncryption() | - | ||||||||||||
762 | { | - | ||||||||||||
763 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
764 | if (d->mode != UnencryptedMode) { | - | ||||||||||||
765 | for (bool qt_category_enabled = lcSsl().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) QMessageLogger(__FILE__, 18251838, __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslSocket::startServerEncryption: cannot start handshake on non-plain connection"); | - | ||||||||||||
766 | return; | - | ||||||||||||
767 | } | - | ||||||||||||
768 | - | |||||||||||||
769 | - | |||||||||||||
770 | - | |||||||||||||
771 | d->mode = SslServerMode; | - | ||||||||||||
772 | modeChanged(d->mode); | - | ||||||||||||
773 | d->startServerEncryption(); | - | ||||||||||||
774 | } | - | ||||||||||||
775 | void QSslSocket::ignoreSslErrors() | - | ||||||||||||
776 | { | - | ||||||||||||
777 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
778 | d->ignoreAllSslErrors = true; | - | ||||||||||||
779 | } | - | ||||||||||||
780 | void QSslSocket::ignoreSslErrors(const QList<QSslError> &errors) | - | ||||||||||||
781 | { | - | ||||||||||||
782 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
783 | d->ignoreErrorsList = errors; | - | ||||||||||||
784 | } | - | ||||||||||||
785 | - | |||||||||||||
786 | - | |||||||||||||
787 | - | |||||||||||||
788 | - | |||||||||||||
789 | void QSslSocket::connectToHost(const QString &hostName, quint16 port, OpenMode openMode, NetworkLayerProtocol protocol) | - | ||||||||||||
790 | { | - | ||||||||||||
791 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
792 | d->preferredNetworkLayerProtocol = protocol; | - | ||||||||||||
793 | if (!d->initialized
| 311-410 | ||||||||||||
794 | d->init(); executed 311 times by 3 tests: d->init(); Executed by:
| 311 | ||||||||||||
795 | d->initialized = false; | - | ||||||||||||
796 | - | |||||||||||||
797 | - | |||||||||||||
798 | - | |||||||||||||
799 | - | |||||||||||||
800 | - | |||||||||||||
801 | if (!d->plainSocket
| 128-593 | ||||||||||||
802 | - | |||||||||||||
803 | - | |||||||||||||
804 | - | |||||||||||||
805 | d->createPlainSocket(openMode); | - | ||||||||||||
806 | } executed 593 times by 8 tests: end of block Executed by:
| 593 | ||||||||||||
807 | - | |||||||||||||
808 | d->plainSocket->setProxy(proxy()); | - | ||||||||||||
809 | - | |||||||||||||
810 | QIODevice::open(openMode); | - | ||||||||||||
811 | d->readChannelCount = d->writeChannelCount = 0; | - | ||||||||||||
812 | d->plainSocket->connectToHost(hostName, port, openMode, d->preferredNetworkLayerProtocol); | - | ||||||||||||
813 | d->cachedSocketDescriptor = d->plainSocket->socketDescriptor(); | - | ||||||||||||
814 | } executed 721 times by 8 tests: end of block Executed by:
| 721 | ||||||||||||
815 | - | |||||||||||||
816 | - | |||||||||||||
817 | - | |||||||||||||
818 | - | |||||||||||||
819 | void QSslSocket::disconnectFromHost() | - | ||||||||||||
820 | { | - | ||||||||||||
821 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
822 | - | |||||||||||||
823 | - | |||||||||||||
824 | - | |||||||||||||
825 | if (!d->plainSocket) | - | ||||||||||||
826 | return; | - | ||||||||||||
827 | if (d->state == UnconnectedState) | - | ||||||||||||
828 | return; | - | ||||||||||||
829 | if (d->mode == UnencryptedMode && !d->autoStartHandshake) { | - | ||||||||||||
830 | d->plainSocket->disconnectFromHost(); | - | ||||||||||||
831 | return; | - | ||||||||||||
832 | } | - | ||||||||||||
833 | if (d->state <= ConnectingState) { | - | ||||||||||||
834 | d->pendingClose = true; | - | ||||||||||||
835 | return; | - | ||||||||||||
836 | } | - | ||||||||||||
837 | - | |||||||||||||
838 | - | |||||||||||||
839 | if (d->state != ClosingState) { | - | ||||||||||||
840 | d->state = ClosingState; | - | ||||||||||||
841 | stateChanged(d->state); | - | ||||||||||||
842 | } | - | ||||||||||||
843 | - | |||||||||||||
844 | if (!d->writeBuffer.isEmpty()) { | - | ||||||||||||
845 | d->pendingClose = true; | - | ||||||||||||
846 | return; | - | ||||||||||||
847 | } | - | ||||||||||||
848 | - | |||||||||||||
849 | if (d->mode == UnencryptedMode) { | - | ||||||||||||
850 | d->plainSocket->disconnectFromHost(); | - | ||||||||||||
851 | } else { | - | ||||||||||||
852 | d->disconnectFromHost(); | - | ||||||||||||
853 | } | - | ||||||||||||
854 | } | - | ||||||||||||
855 | - | |||||||||||||
856 | - | |||||||||||||
857 | - | |||||||||||||
858 | - | |||||||||||||
859 | qint64 QSslSocket::readData(char *data, qint64 maxlen) | - | ||||||||||||
860 | { | - | ||||||||||||
861 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
862 | qint64 readBytes = 0; | - | ||||||||||||
863 | - | |||||||||||||
864 | if (d->mode == UnencryptedMode && !d->autoStartHandshake) { | - | ||||||||||||
865 | readBytes = d->plainSocket->read(data, maxlen); | - | ||||||||||||
866 | - | |||||||||||||
867 | - | |||||||||||||
868 | - | |||||||||||||
869 | - | |||||||||||||
870 | } else { | - | ||||||||||||
871 | - | |||||||||||||
872 | if (d->plainSocket->bytesAvailable()) | - | ||||||||||||
873 | QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection); | - | ||||||||||||
874 | } | - | ||||||||||||
875 | - | |||||||||||||
876 | return readBytes; | - | ||||||||||||
877 | } | - | ||||||||||||
878 | - | |||||||||||||
879 | - | |||||||||||||
880 | - | |||||||||||||
881 | - | |||||||||||||
882 | qint64 QSslSocket::writeData(const char *data, qint64 len) | - | ||||||||||||
883 | { | - | ||||||||||||
884 | QSslSocketPrivate * const d = d_func(); | - | ||||||||||||
885 | - | |||||||||||||
886 | - | |||||||||||||
887 | - | |||||||||||||
888 | if (d->mode == UnencryptedMode
| 7-5396 | ||||||||||||
889 | return executed 295 times by 3 tests: d->plainSocket->write(data, len);return d->plainSocket->write(data, len); Executed by:
executed 295 times by 3 tests: return d->plainSocket->write(data, len); Executed by:
| 295 | ||||||||||||
890 | - | |||||||||||||
891 | char *writePtr =d->writeBuffer.reserve(len); | - | ||||||||||||
::memcpyappend(writePtr,data, len); | ||||||||||||||
892 | - | |||||||||||||
893 | - | |||||||||||||
894 | QMetaObject::invokeMethod(this, "_q_flushWriteBuffer", Qt::QueuedConnection); | - | ||||||||||||
895 | - | |||||||||||||
896 | return executed 5403 times by 5 tests: len;return len; Executed by:
executed 5403 times by 5 tests: return len; Executed by:
| 5403 | ||||||||||||
897 | } | - | ||||||||||||
898 | - | |||||||||||||
899 | - | |||||||||||||
900 | - | |||||||||||||
901 | - | |||||||||||||
902 | QSslSocketPrivate::QSslSocketPrivate() | - | ||||||||||||
903 | : initialized(false) | - | ||||||||||||
904 | , mode(QSslSocket::UnencryptedMode) | - | ||||||||||||
905 | , autoStartHandshake(false) | - | ||||||||||||
906 | , connectionEncrypted(false) | - | ||||||||||||
907 | , shutdown(false) | - | ||||||||||||
908 | , ignoreAllSslErrors(false) | - | ||||||||||||
909 | , readyReadEmittedPointer(0) | - | ||||||||||||
910 | , allowRootCertOnDemandLoading(true) | - | ||||||||||||
911 | , plainSocket(0) | - | ||||||||||||
912 | , paused(false) | - | ||||||||||||
913 | { | - | ||||||||||||
914 | QSslConfigurationPrivate::deepCopyDefaultConfiguration(&configuration); | - | ||||||||||||
915 | } | - | ||||||||||||
916 | - | |||||||||||||
917 | - | |||||||||||||
918 | - | |||||||||||||
919 | - | |||||||||||||
920 | QSslSocketPrivate::~QSslSocketPrivate() | - | ||||||||||||
921 | { | - | ||||||||||||
922 | } | - | ||||||||||||
923 | - | |||||||||||||
924 | - | |||||||||||||
925 | - | |||||||||||||
926 | - | |||||||||||||
927 | void QSslSocketPrivate::init() | - | ||||||||||||
928 | { | - | ||||||||||||
929 | mode = QSslSocket::UnencryptedMode; | - | ||||||||||||
930 | autoStartHandshake = false; | - | ||||||||||||
931 | connectionEncrypted = false; | - | ||||||||||||
932 | ignoreAllSslErrors = false; | - | ||||||||||||
933 | shutdown = false; | - | ||||||||||||
934 | pendingClose = false; | - | ||||||||||||
935 | - | |||||||||||||
936 | - | |||||||||||||
937 | - | |||||||||||||
938 | - | |||||||||||||
939 | - | |||||||||||||
940 | buffer.clear(); | - | ||||||||||||
941 | writeBuffer.clear(); | - | ||||||||||||
942 | configuration.peerCertificate.clear(); | - | ||||||||||||
943 | configuration.peerCertificateChain.clear(); | - | ||||||||||||
944 | } | - | ||||||||||||
945 | - | |||||||||||||
946 | - | |||||||||||||
947 | - | |||||||||||||
948 | - | |||||||||||||
949 | QList<QSslCipher> QSslSocketPrivate::defaultCiphers() | - | ||||||||||||
950 | { | - | ||||||||||||
951 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
952 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
953 | return globalData()->config->ciphers; | - | ||||||||||||
954 | } | - | ||||||||||||
955 | - | |||||||||||||
956 | - | |||||||||||||
957 | - | |||||||||||||
958 | - | |||||||||||||
959 | QList<QSslCipher> QSslSocketPrivate::supportedCiphers() | - | ||||||||||||
960 | { | - | ||||||||||||
961 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
962 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
963 | return globalData()->supportedCiphers; | - | ||||||||||||
964 | } | - | ||||||||||||
965 | - | |||||||||||||
966 | - | |||||||||||||
967 | - | |||||||||||||
968 | - | |||||||||||||
969 | void QSslSocketPrivate::setDefaultCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||
970 | { | - | ||||||||||||
971 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
972 | globalData()->config.detach(); | - | ||||||||||||
973 | globalData()->config->ciphers = ciphers; | - | ||||||||||||
974 | } | - | ||||||||||||
975 | - | |||||||||||||
976 | - | |||||||||||||
977 | - | |||||||||||||
978 | - | |||||||||||||
979 | void QSslSocketPrivate::setDefaultSupportedCiphers(const QList<QSslCipher> &ciphers) | - | ||||||||||||
980 | { | - | ||||||||||||
981 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
982 | globalData()->config.detach(); | - | ||||||||||||
983 | globalData()->supportedCiphers = ciphers; | - | ||||||||||||
984 | } | - | ||||||||||||
985 | - | |||||||||||||
986 | - | |||||||||||||
987 | - | |||||||||||||
988 | - | |||||||||||||
989 | QVector<QSslEllipticCurve> QSslSocketPrivate::supportedEllipticCurves() | - | ||||||||||||
990 | { | - | ||||||||||||
991 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
992 | const QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
993 | return globalData()->supportedEllipticCurves; | - | ||||||||||||
994 | } | - | ||||||||||||
995 | - | |||||||||||||
996 | - | |||||||||||||
997 | - | |||||||||||||
998 | - | |||||||||||||
999 | void QSslSocketPrivate::setDefaultSupportedEllipticCurves(const QVector<QSslEllipticCurve> &curves) | - | ||||||||||||
1000 | { | - | ||||||||||||
1001 | const QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1002 | globalData()->config.detach(); | - | ||||||||||||
1003 | globalData()->supportedEllipticCurves = curves; | - | ||||||||||||
1004 | } | - | ||||||||||||
1005 | - | |||||||||||||
1006 | - | |||||||||||||
1007 | - | |||||||||||||
1008 | - | |||||||||||||
1009 | QList<QSslCertificate> QSslSocketPrivate::defaultCaCertificates() | - | ||||||||||||
1010 | { | - | ||||||||||||
1011 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1012 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1013 | return globalData()->config->caCertificates; | - | ||||||||||||
1014 | } | - | ||||||||||||
1015 | - | |||||||||||||
1016 | - | |||||||||||||
1017 | - | |||||||||||||
1018 | - | |||||||||||||
1019 | void QSslSocketPrivate::setDefaultCaCertificates(const QList<QSslCertificate> &certs) | - | ||||||||||||
1020 | { | - | ||||||||||||
1021 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1022 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1023 | globalData()->config.detach(); | - | ||||||||||||
1024 | globalData()->config->caCertificates = certs; | - | ||||||||||||
1025 | - | |||||||||||||
1026 | - | |||||||||||||
1027 | s_loadRootCertsOnDemand = false; | - | ||||||||||||
1028 | } | - | ||||||||||||
1029 | - | |||||||||||||
1030 | - | |||||||||||||
1031 | - | |||||||||||||
1032 | - | |||||||||||||
1033 | bool QSslSocketPrivate::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat format, | - | ||||||||||||
1034 | QRegExp::PatternSyntax syntax) | - | ||||||||||||
1035 | { | - | ||||||||||||
1036 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1037 | QList<QSslCertificate> certs = QSslCertificate::fromPath(path, format, syntax); | - | ||||||||||||
1038 | if (certs.isEmpty()) | - | ||||||||||||
1039 | return false; | - | ||||||||||||
1040 | - | |||||||||||||
1041 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1042 | globalData()->config.detach(); | - | ||||||||||||
1043 | globalData()->config->caCertificates += certs; | - | ||||||||||||
1044 | return true; | - | ||||||||||||
1045 | } | - | ||||||||||||
1046 | - | |||||||||||||
1047 | - | |||||||||||||
1048 | - | |||||||||||||
1049 | - | |||||||||||||
1050 | void QSslSocketPrivate::addDefaultCaCertificate(const QSslCertificate &cert) | - | ||||||||||||
1051 | { | - | ||||||||||||
1052 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1053 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1054 | globalData()->config.detach(); | - | ||||||||||||
1055 | globalData()->config->caCertificates += cert; | - | ||||||||||||
1056 | } | - | ||||||||||||
1057 | - | |||||||||||||
1058 | - | |||||||||||||
1059 | - | |||||||||||||
1060 | - | |||||||||||||
1061 | void QSslSocketPrivate::addDefaultCaCertificates(const QList<QSslCertificate> &certs) | - | ||||||||||||
1062 | { | - | ||||||||||||
1063 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1064 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1065 | globalData()->config.detach(); | - | ||||||||||||
1066 | globalData()->config->caCertificates += certs; | - | ||||||||||||
1067 | } | - | ||||||||||||
1068 | - | |||||||||||||
1069 | - | |||||||||||||
1070 | - | |||||||||||||
1071 | - | |||||||||||||
1072 | QSslConfiguration QSslConfigurationPrivate::defaultConfiguration() | - | ||||||||||||
1073 | { | - | ||||||||||||
1074 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1075 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1076 | return QSslConfiguration(globalData()->config.data()); | - | ||||||||||||
1077 | } | - | ||||||||||||
1078 | - | |||||||||||||
1079 | - | |||||||||||||
1080 | - | |||||||||||||
1081 | - | |||||||||||||
1082 | void QSslConfigurationPrivate::setDefaultConfiguration(const QSslConfiguration &configuration) | - | ||||||||||||
1083 | { | - | ||||||||||||
1084 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1085 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1086 | if (globalData()->config == configuration.d) | - | ||||||||||||
1087 | return; | - | ||||||||||||
1088 | - | |||||||||||||
1089 | globalData()->config = const_cast<QSslConfigurationPrivate*>(configuration.d.constData()); | - | ||||||||||||
1090 | } | - | ||||||||||||
1091 | - | |||||||||||||
1092 | - | |||||||||||||
1093 | - | |||||||||||||
1094 | - | |||||||||||||
1095 | void QSslConfigurationPrivate::deepCopyDefaultConfiguration(QSslConfigurationPrivate *ptr) | - | ||||||||||||
1096 | { | - | ||||||||||||
1097 | QSslSocketPrivate::ensureInitialized(); | - | ||||||||||||
1098 | QMutexLocker locker(&globalData()->mutex); | - | ||||||||||||
1099 | const QSslConfigurationPrivate *global = globalData()->config.constData(); | - | ||||||||||||
1100 | - | |||||||||||||
1101 | if (!global) | - | ||||||||||||
1102 | return; | - | ||||||||||||
1103 | - | |||||||||||||
1104 | ptr->ref.store(1); | - | ||||||||||||
1105 | ptr->peerCertificate = global->peerCertificate; | - | ||||||||||||
1106 | ptr->peerCertificateChain = global->peerCertificateChain; | - | ||||||||||||
1107 | ptr->localCertificateChain = global->localCertificateChain; | - | ||||||||||||
1108 | ptr->privateKey = global->privateKey; | - | ||||||||||||
1109 | ptr->sessionCipher = global->sessionCipher; | - | ||||||||||||
1110 | ptr->sessionProtocol = global->sessionProtocol; | - | ||||||||||||
1111 | ptr->ciphers = global->ciphers; | - | ||||||||||||
1112 | ptr->caCertificates = global->caCertificates; | - | ||||||||||||
1113 | ptr->protocol = global->protocol; | - | ||||||||||||
1114 | ptr->peerVerifyMode = global->peerVerifyMode; | - | ||||||||||||
1115 | ptr->peerVerifyDepth = global->peerVerifyDepth; | - | ||||||||||||
1116 | ptr->sslOptions = global->sslOptions; | - | ||||||||||||
1117 | ptr->ellipticCurves = global->ellipticCurves; | - | ||||||||||||
1118 | } | - | ||||||||||||
1119 | - | |||||||||||||
1120 | - | |||||||||||||
1121 | - | |||||||||||||
1122 | - | |||||||||||||
1123 | void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode) | - | ||||||||||||
1124 | { | - | ||||||||||||
1125 | QSslSocket * const q = q_func(); | - | ||||||||||||
1126 | q->setOpenMode(openMode); | - | ||||||||||||
1127 | q->setSocketState(QAbstractSocket::UnconnectedState); | - | ||||||||||||
1128 | q->setSocketError(QAbstractSocket::UnknownSocketError); | - | ||||||||||||
1129 | q->setLocalPort(0); | - | ||||||||||||
1130 | q->setLocalAddress(QHostAddress()); | - | ||||||||||||
1131 | q->setPeerPort(0); | - | ||||||||||||
1132 | q->setPeerAddress(QHostAddress()); | - | ||||||||||||
1133 | q->setPeerName(QString()); | - | ||||||||||||
1134 | - | |||||||||||||
1135 | plainSocket = new QTcpSocket(q); | - | ||||||||||||
1136 | - | |||||||||||||
1137 | - | |||||||||||||
1138 | plainSocket->setProperty("_q_networksession", q->property("_q_networksession")); | - | ||||||||||||
1139 | - | |||||||||||||
1140 | q->connect(plainSocket, qFlagLocation("2""connected()" "\0" __FILE__ ":" "2248""2261"), | - | ||||||||||||
1141 | q, qFlagLocation("1""_q_connectedSlot()" "\0" __FILE__ ":" "2249""2262"), | - | ||||||||||||
1142 | Qt::DirectConnection); | - | ||||||||||||
1143 | q->connect(plainSocket, qFlagLocation("2""hostFound()" "\0" __FILE__ ":" "2251""2264"), | - | ||||||||||||
1144 | q, qFlagLocation("1""_q_hostFoundSlot()" "\0" __FILE__ ":" "2252""2265"), | - | ||||||||||||
1145 | Qt::DirectConnection); | - | ||||||||||||
1146 | q->connect(plainSocket, qFlagLocation("2""disconnected()" "\0" __FILE__ ":" "2254""2267"), | - | ||||||||||||
1147 | q, qFlagLocation("1""_q_disconnectedSlot()" "\0" __FILE__ ":" "2255""2268"), | - | ||||||||||||
1148 | Qt::DirectConnection); | - | ||||||||||||
1149 | q->connect(plainSocket, qFlagLocation("2""stateChanged(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "2257""2270"), | - | ||||||||||||
1150 | q, qFlagLocation("1""_q_stateChangedSlot(QAbstractSocket::SocketState)" "\0" __FILE__ ":" "2258""2271"), | - | ||||||||||||
1151 | Qt::DirectConnection); | - | ||||||||||||
1152 | q->connect(plainSocket, qFlagLocation("2""error(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "2260""2273"), | - | ||||||||||||
1153 | q, qFlagLocation("1""_q_errorSlot(QAbstractSocket::SocketError)" "\0" __FILE__ ":" "2261""2274"), | - | ||||||||||||
1154 | Qt::DirectConnection); | - | ||||||||||||
1155 | q->connect(plainSocket, qFlagLocation("2""readyRead()" "\0" __FILE__ ":" "2263""2276"), | - | ||||||||||||
1156 | q, qFlagLocation("1""_q_readyReadSlot()" "\0" __FILE__ ":" "2264""2277"), | - | ||||||||||||
1157 | Qt::DirectConnection); | - | ||||||||||||
1158 | q->connect(plainSocket, qFlagLocation("2""channelReadyRead(int)" "\0" __FILE__ ":" "2279"), | - | ||||||||||||
1159 | q, qFlagLocation("1""_q_channelReadyReadSlot(int)" "\0" __FILE__ ":" "2280"), | - | ||||||||||||
1160 | Qt::DirectConnection); | - | ||||||||||||
1161 | q->connect(plainSocket, qFlagLocation("2""bytesWritten(qint64)" "\0" __FILE__ ":" "2266""2282"), | - | ||||||||||||
1162 | q, qFlagLocation("1""_q_bytesWrittenSlot(qint64)" "\0" __FILE__ ":" "2267""2283"), | - | ||||||||||||
1163 | Qt::DirectConnection); | - | ||||||||||||
1164 | q->connect(plainSocket, qFlagLocation("2""channelBytesWritten(int, qint64)" "\0" __FILE__ ":" "2285"), | - | ||||||||||||
1165 | q, qFlagLocation("1""_q_channelBytesWrittenSlot(int, qint64)" "\0" __FILE__ ":" "2286"), | - | ||||||||||||
1166 | Qt::DirectConnection); | - | ||||||||||||
1167 | - | |||||||||||||
1168 | q->connect(plainSocket, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "2270""2289"), | - | ||||||||||||
1169 | q, qFlagLocation("2""proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)" "\0" __FILE__ ":" "2271""2290")); | - | ||||||||||||
1170 | - | |||||||||||||
1171 | - | |||||||||||||
1172 | buffer.clear(); | - | ||||||||||||
1173 | writeBuffer.clear(); | - | ||||||||||||
1174 | connectionEncrypted = false; | - | ||||||||||||
1175 | configuration.peerCertificate.clear(); | - | ||||||||||||
1176 | configuration.peerCertificateChain.clear(); | - | ||||||||||||
1177 | mode = QSslSocket::UnencryptedMode; | - | ||||||||||||
1178 | q->setReadBufferSize(readBufferMaxSize); | - | ||||||||||||
1179 | } executed 677 times by 8 tests: end of block Executed by:
| 677 | ||||||||||||
1180 | - | |||||||||||||
1181 | void QSslSocketPrivate::pauseSocketNotifiers(QSslSocket *socket) | - | ||||||||||||
1182 | { | - | ||||||||||||
1183 | if (!socket->d_func()->plainSocket) | - | ||||||||||||
1184 | return; | - | ||||||||||||
1185 | QAbstractSocketPrivate::pauseSocketNotifiers(socket->d_func()->plainSocket); | - | ||||||||||||
1186 | } | - | ||||||||||||
1187 | - | |||||||||||||
1188 | void QSslSocketPrivate::resumeSocketNotifiers(QSslSocket *socket) | - | ||||||||||||
1189 | { | - | ||||||||||||
1190 | if (!socket->d_func()->plainSocket) | - | ||||||||||||
1191 | return; | - | ||||||||||||
1192 | QAbstractSocketPrivate::resumeSocketNotifiers(socket->d_func()->plainSocket); | - | ||||||||||||
1193 | } | - | ||||||||||||
1194 | - | |||||||||||||
1195 | bool QSslSocketPrivate::isPaused() const | - | ||||||||||||
1196 | { | - | ||||||||||||
1197 | return paused; | - | ||||||||||||
1198 | } | - | ||||||||||||
1199 | - | |||||||||||||
1200 | bool QSslSocketPrivate::bind(const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode) | - | ||||||||||||
1201 | { | - | ||||||||||||
1202 | - | |||||||||||||
1203 | if (!initialized
| 0-15 | ||||||||||||
1204 | init(); executed 15 times by 1 test: init(); Executed by:
| 15 | ||||||||||||
1205 | initialized = false; | - | ||||||||||||
1206 | - | |||||||||||||
1207 | - | |||||||||||||
1208 | - | |||||||||||||
1209 | - | |||||||||||||
1210 | if (!plainSocket
| 0-15 | ||||||||||||
1211 | - | |||||||||||||
1212 | - | |||||||||||||
1213 | - | |||||||||||||
1214 | createPlainSocket(QIODevice::ReadWrite); | - | ||||||||||||
1215 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||
1216 | bool ret = plainSocket->bind(address, port, mode); | - | ||||||||||||
1217 | localPort = plainSocket->localPort(); | - | ||||||||||||
1218 | localAddress = plainSocket->localAddress(); | - | ||||||||||||
1219 | cachedSocketDescriptor = plainSocket->socketDescriptor(); | - | ||||||||||||
1220 | readChannelCount = writeChannelCount = 0; | - | ||||||||||||
1221 | return executed 15 times by 1 test: ret;return ret; Executed by:
executed 15 times by 1 test: return ret; Executed by:
| 15 | ||||||||||||
1222 | } | - | ||||||||||||
1223 | - | |||||||||||||
1224 | - | |||||||||||||
1225 | - | |||||||||||||
1226 | - | |||||||||||||
1227 | void QSslSocketPrivate::_q_connectedSlot() | - | ||||||||||||
1228 | { | - | ||||||||||||
1229 | QSslSocket * const q = q_func(); | - | ||||||||||||
1230 | q->setLocalPort(plainSocket->localPort()); | - | ||||||||||||
1231 | q->setLocalAddress(plainSocket->localAddress()); | - | ||||||||||||
1232 | q->setPeerPort(plainSocket->peerPort()); | - | ||||||||||||
1233 | q->setPeerAddress(plainSocket->peerAddress()); | - | ||||||||||||
1234 | q->setPeerName(plainSocket->peerName()); | - | ||||||||||||
1235 | cachedSocketDescriptor = plainSocket->socketDescriptor(); | - | ||||||||||||
1236 | readChannelCount = plainSocket->readChannelCount(); | - | ||||||||||||
1237 | writeChannelCount = plainSocket->writeChannelCount(); | - | ||||||||||||
1238 | if (autoStartHandshake
| 267-376 | ||||||||||||
1239 | q->startClientEncryption(); executed 376 times by 6 tests: q->startClientEncryption(); Executed by:
| 376 | ||||||||||||
1240 | - | |||||||||||||
1241 | q->connected(); | - | ||||||||||||
1242 | - | |||||||||||||
1243 | if (pendingClose
| 0-634 | ||||||||||||
1244 | pendingClose = false; | - | ||||||||||||
1245 | q->disconnectFromHost(); | - | ||||||||||||
1246 | } never executed: end of block | 0 | ||||||||||||
1247 | } executed 643 times by 8 tests: end of block Executed by:
| 643 | ||||||||||||
1248 | - | |||||||||||||
1249 | - | |||||||||||||
1250 | - | |||||||||||||
1251 | - | |||||||||||||
1252 | void QSslSocketPrivate::_q_hostFoundSlot() | - | ||||||||||||
1253 | { | - | ||||||||||||
1254 | QSslSocket * const q = q_func(); | - | ||||||||||||
1255 | - | |||||||||||||
1256 | - | |||||||||||||
1257 | - | |||||||||||||
1258 | - | |||||||||||||
1259 | q->hostFound(); | - | ||||||||||||
1260 | } | - | ||||||||||||
1261 | - | |||||||||||||
1262 | - | |||||||||||||
1263 | - | |||||||||||||
1264 | - | |||||||||||||
1265 | void QSslSocketPrivate::_q_disconnectedSlot() | - | ||||||||||||
1266 | { | - | ||||||||||||
1267 | QSslSocket * const q = q_func(); | - | ||||||||||||
1268 | - | |||||||||||||
1269 | - | |||||||||||||
1270 | - | |||||||||||||
1271 | - | |||||||||||||
1272 | disconnected(); | - | ||||||||||||
1273 | q->disconnected(); | - | ||||||||||||
1274 | - | |||||||||||||
1275 | q->setLocalPort(0); | - | ||||||||||||
1276 | q->setLocalAddress(QHostAddress()); | - | ||||||||||||
1277 | q->setPeerPort(0); | - | ||||||||||||
1278 | q->setPeerAddress(QHostAddress()); | - | ||||||||||||
1279 | q->setPeerName(QString()); | - | ||||||||||||
1280 | cachedSocketDescriptor = -1; | - | ||||||||||||
1281 | } executed 707 times by 9 tests: end of block Executed by:
| 707 | ||||||||||||
1282 | - | |||||||||||||
1283 | - | |||||||||||||
1284 | - | |||||||||||||
1285 | - | |||||||||||||
1286 | void QSslSocketPrivate::_q_stateChangedSlot(QAbstractSocket::SocketState state) | - | ||||||||||||
1287 | { | - | ||||||||||||
1288 | QSslSocket * const q = q_func(); | - | ||||||||||||
1289 | - | |||||||||||||
1290 | - | |||||||||||||
1291 | - | |||||||||||||
1292 | q->setSocketState(state); | - | ||||||||||||
1293 | q->stateChanged(state); | - | ||||||||||||
1294 | } | - | ||||||||||||
1295 | - | |||||||||||||
1296 | - | |||||||||||||
1297 | - | |||||||||||||
1298 | - | |||||||||||||
1299 | void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error) | - | ||||||||||||
1300 | { | - | ||||||||||||
1301 | (void)error; | - | ||||||||||||
1302 | - | |||||||||||||
1303 | - | |||||||||||||
1304 | - | |||||||||||||
1305 | - | |||||||||||||
1306 | - | |||||||||||||
1307 | - | |||||||||||||
1308 | - | |||||||||||||
1309 | if (plainSocket->bytesAvailable()) { | - | ||||||||||||
1310 | qint64 tmpReadBufferMaxSize = readBufferMaxSize; | - | ||||||||||||
1311 | readBufferMaxSize = 0; | - | ||||||||||||
1312 | transmit(); | - | ||||||||||||
1313 | readBufferMaxSize = tmpReadBufferMaxSize; | - | ||||||||||||
1314 | } | - | ||||||||||||
1315 | - | |||||||||||||
1316 | setErrorAndEmit(plainSocket->error(), plainSocket->errorString()); | - | ||||||||||||
1317 | } | - | ||||||||||||
1318 | - | |||||||||||||
1319 | - | |||||||||||||
1320 | - | |||||||||||||
1321 | - | |||||||||||||
1322 | void QSslSocketPrivate::_q_readyReadSlot() | - | ||||||||||||
1323 | { | - | ||||||||||||
1324 | QSslSocket * const q = q_func(); | - | ||||||||||||
1325 | - | |||||||||||||
1326 | - | |||||||||||||
1327 | - | |||||||||||||
1328 | if (mode == QSslSocket::UnencryptedMode) { | - | ||||||||||||
1329 | if (readyReadEmittedPointer) | - | ||||||||||||
1330 | *readyReadEmittedPointer = true; | - | ||||||||||||
1331 | q->readyRead(); | - | ||||||||||||
1332 | return; | - | ||||||||||||
1333 | } | - | ||||||||||||
1334 | - | |||||||||||||
1335 | transmit(); | - | ||||||||||||
1336 | } | - | ||||||||||||
1337 | - | |||||||||||||
1338 | - | |||||||||||||
1339 | - | |||||||||||||
1340 | - | |||||||||||||
1341 | void QSslSocketPrivate::_q_channelReadyReadSlot(int channel) | - | ||||||||||||
1342 | { | - | ||||||||||||
1343 | QSslSocket * const q = q_func(); | - | ||||||||||||
1344 | if (mode == QSslSocket::UnencryptedMode
| 2340-2686 | ||||||||||||
1345 | q->channelReadyRead(channel); executed 2340 times by 3 tests: q->channelReadyRead(channel); Executed by:
| 2340 | ||||||||||||
1346 | } executed 5026 times by 8 tests: end of block Executed by:
| 5026 | ||||||||||||
1347 | - | |||||||||||||
1348 | - | |||||||||||||
1349 | - | |||||||||||||
1350 | - | |||||||||||||
1351 | void QSslSocketPrivate::_q_bytesWrittenSlot(qint64 written) | - | ||||||||||||
1352 | { | - | ||||||||||||
1353 | QSslSocket * const q = q_func(); | - | ||||||||||||
1354 | - | |||||||||||||
1355 | - | |||||||||||||
1356 | - | |||||||||||||
1357 | - | |||||||||||||
1358 | if (mode == QSslSocket::UnencryptedMode) | - | ||||||||||||
1359 | q->bytesWritten(written); | - | ||||||||||||
1360 | else | - | ||||||||||||
1361 | q->encryptedBytesWritten(written); | - | ||||||||||||
1362 | if (state == QAbstractSocket::ClosingState && writeBuffer.isEmpty()) | - | ||||||||||||
1363 | q->disconnectFromHost(); | - | ||||||||||||
1364 | } | - | ||||||||||||
1365 | - | |||||||||||||
1366 | - | |||||||||||||
1367 | - | |||||||||||||
1368 | - | |||||||||||||
1369 | void QSslSocketPrivate::_q_channelBytesWrittenSlot(int channel, qint64 written) | - | ||||||||||||
1370 | { | - | ||||||||||||
1371 | QSslSocket * const q = q_func(); | - | ||||||||||||
1372 | if (mode == QSslSocket::UnencryptedMode
| 267-5194 | ||||||||||||
1373 | q->channelBytesWritten(channel, written); executed 267 times by 3 tests: q->channelBytesWritten(channel, written); Executed by:
| 267 | ||||||||||||
1374 | } executed 5461 times by 8 tests: end of block Executed by:
| 5461 | ||||||||||||
1375 | - | |||||||||||||
1376 | - | |||||||||||||
1377 | - | |||||||||||||
1378 | - | |||||||||||||
1379 | void QSslSocketPrivate::_q_flushWriteBuffer() | - | ||||||||||||
1380 | { | - | ||||||||||||
1381 | QSslSocket * const q = q_func(); | - | ||||||||||||
1382 | if (!writeBuffer.isEmpty()) | - | ||||||||||||
1383 | q->flush(); | - | ||||||||||||
1384 | } | - | ||||||||||||
1385 | - | |||||||||||||
1386 | - | |||||||||||||
1387 | - | |||||||||||||
1388 | - | |||||||||||||
1389 | void QSslSocketPrivate::_q_flushReadBuffer() | - | ||||||||||||
1390 | { | - | ||||||||||||
1391 | - | |||||||||||||
1392 | if (mode != QSslSocket::UnencryptedMode) | - | ||||||||||||
1393 | transmit(); | - | ||||||||||||
1394 | } | - | ||||||||||||
1395 | - | |||||||||||||
1396 | - | |||||||||||||
1397 | - | |||||||||||||
1398 | - | |||||||||||||
1399 | void QSslSocketPrivate::_q_resumeImplementation() | - | ||||||||||||
1400 | { | - | ||||||||||||
1401 | if (plainSocket
| 0-20 | ||||||||||||
1402 | plainSocket->resume(); executed 20 times by 1 test: plainSocket->resume(); Executed by:
| 20 | ||||||||||||
1403 | paused = false; | - | ||||||||||||
1404 | if (!connectionEncrypted
| 0-20 | ||||||||||||
1405 | if (verifyErrorsHaveBeenIgnored()
| 10 | ||||||||||||
1406 | continueHandshake(); | - | ||||||||||||
1407 | } executed 10 times by 1 test: else {end of block Executed by:
| 10 | ||||||||||||
1408 | setErrorAndEmit(QAbstractSocket::SslHandshakeFailedError, sslErrors.firstconstFirst().errorString()); | - | ||||||||||||
1409 | plainSocket->disconnectFromHost(); | - | ||||||||||||
1410 | return; executed 10 times by 1 test: return; Executed by:
| 10 | ||||||||||||
1411 | } | - | ||||||||||||
1412 | } | - | ||||||||||||
1413 | transmit(); | - | ||||||||||||
1414 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||
1415 | - | |||||||||||||
1416 | - | |||||||||||||
1417 | - | |||||||||||||
1418 | - | |||||||||||||
1419 | bool QSslSocketPrivate::verifyErrorsHaveBeenIgnored() | - | ||||||||||||
1420 | { | - | ||||||||||||
1421 | bool doEmitSslError; | - | ||||||||||||
1422 | if (!ignoreErrorsList.empty()) { | - | ||||||||||||
1423 | - | |||||||||||||
1424 | - | |||||||||||||
1425 | - | |||||||||||||
1426 | doEmitSslError = false; | - | ||||||||||||
1427 | for (int a = 0; a < sslErrors.count(); a++) { | - | ||||||||||||
1428 | if (!ignoreErrorsList.contains(sslErrors.at(a))) { | - | ||||||||||||
1429 | doEmitSslError = true; | - | ||||||||||||
1430 | break; | - | ||||||||||||
1431 | } | - | ||||||||||||
1432 | } | - | ||||||||||||
1433 | } else { | - | ||||||||||||
1434 | - | |||||||||||||
1435 | - | |||||||||||||
1436 | - | |||||||||||||
1437 | doEmitSslError = !ignoreAllSslErrors; | - | ||||||||||||
1438 | } | - | ||||||||||||
1439 | return !doEmitSslError; | - | ||||||||||||
1440 | } | - | ||||||||||||
1441 | - | |||||||||||||
1442 | - | |||||||||||||
1443 | - | |||||||||||||
1444 | - | |||||||||||||
1445 | qint64 QSslSocketPrivate::peek(char *data, qint64 maxSize) | - | ||||||||||||
1446 | { | - | ||||||||||||
1447 | if (mode == QSslSocket::UnencryptedMode
| 0-112 | ||||||||||||
1448 | - | |||||||||||||
1449 | - | |||||||||||||
1450 | qint64 r = buffer.peek(data, maxSize, transactionPos); | - | ||||||||||||
1451 | if (r == maxSize
| 5-107 | ||||||||||||
1452 | return executed 107 times by 2 tests: r;return r; Executed by:
executed 107 times by 2 tests: return r; Executed by:
| 107 | ||||||||||||
1453 | data += r; | - | ||||||||||||
1454 | - | |||||||||||||
1455 | if (plainSocket
| 0-5 | ||||||||||||
1456 | qint64 r2 = plainSocket->peek(data, maxSize - r); | - | ||||||||||||
1457 | if (r2 < 0
| 0-5 | ||||||||||||
1458 | return never executed: (r > 0 ? r : r2);return (r > 0 ? r : r2); never executed: return (r > 0 ? r : r2); | 0 | ||||||||||||
1459 | return executed 5 times by 2 tests: r + r2;return r + r2; Executed by:
executed 5 times by 2 tests: return r + r2; Executed by:
| 5 | ||||||||||||
1460 | } else { | - | ||||||||||||
1461 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||
1462 | } | - | ||||||||||||
1463 | } else { | - | ||||||||||||
1464 | - | |||||||||||||
1465 | return executed 95 times by 4 tests: QTcpSocketPrivate::peek(data, maxSize);return QTcpSocketPrivate::peek(data, maxSize); Executed by:
executed 95 times by 4 tests: return QTcpSocketPrivate::peek(data, maxSize); Executed by:
| 95 | ||||||||||||
1466 | } | - | ||||||||||||
1467 | } | - | ||||||||||||
1468 | - | |||||||||||||
1469 | - | |||||||||||||
1470 | - | |||||||||||||
1471 | - | |||||||||||||
1472 | QByteArray QSslSocketPrivate::peek(qint64 maxSize) | - | ||||||||||||
1473 | { | - | ||||||||||||
1474 | if (mode == QSslSocket::UnencryptedMode
| 0-10 | ||||||||||||
1475 | - | |||||||||||||
1476 | - | |||||||||||||
1477 | QByteArray ret; | - | ||||||||||||
1478 | ret.reserve(maxSize); | - | ||||||||||||
1479 | ret.resize(buffer.peek(ret.data(), maxSize, transactionPos)); | - | ||||||||||||
1480 | if (ret.length() == maxSize
| 1-9 | ||||||||||||
1481 | return executed 1 time by 1 test: ret;return ret; Executed by:
executed 1 time by 1 test: return ret; Executed by:
| 1 | ||||||||||||
1482 | - | |||||||||||||
1483 | if (plainSocket
| 4-5 | ||||||||||||
1484 | return executed 4 times by 1 test: ret + plainSocket->peek(maxSize - ret.length());return ret + plainSocket->peek(maxSize - ret.length()); Executed by:
executed 4 times by 1 test: return ret + plainSocket->peek(maxSize - ret.length()); Executed by:
| 4 | ||||||||||||
1485 | else | - | ||||||||||||
1486 | return executed 5 times by 1 test: QByteArray();return QByteArray(); Executed by:
executed 5 times by 1 test: return QByteArray(); Executed by:
| 5 | ||||||||||||
1487 | } else { | - | ||||||||||||
1488 | - | |||||||||||||
1489 | return executed 2 times by 1 test: QTcpSocketPrivate::peek(maxSize);return QTcpSocketPrivate::peek(maxSize); Executed by:
executed 2 times by 1 test: return QTcpSocketPrivate::peek(maxSize); Executed by:
| 2 | ||||||||||||
1490 | } | - | ||||||||||||
1491 | } | - | ||||||||||||
1492 | - | |||||||||||||
1493 | - | |||||||||||||
1494 | - | |||||||||||||
1495 | - | |||||||||||||
1496 | bool QSslSocketPrivate::rootCertOnDemandLoadingSupported() | - | ||||||||||||
1497 | { | - | ||||||||||||
1498 | return s_loadRootCertsOnDemand; | - | ||||||||||||
1499 | } | - | ||||||||||||
1500 | - | |||||||||||||
1501 | - | |||||||||||||
1502 | - | |||||||||||||
1503 | - | |||||||||||||
1504 | QList<QByteArray> QSslSocketPrivate::unixRootCertDirectories() | - | ||||||||||||
1505 | { | - | ||||||||||||
1506 | return QList<QByteArray>() << "/etc/ssl/certs/" | - | ||||||||||||
1507 | << "/usr/lib/ssl/certs/" | - | ||||||||||||
1508 | << "/usr/share/ssl/" | - | ||||||||||||
1509 | << "/usr/local/ssl/" | - | ||||||||||||
1510 | << "/var/ssl/certs/" | - | ||||||||||||
1511 | << "/usr/local/ssl/certs/" | - | ||||||||||||
1512 | << "/etc/openssl/certs/" | - | ||||||||||||
1513 | << "/opt/openssl/certs/" | - | ||||||||||||
1514 | << "/etc/ssl/"; | - | ||||||||||||
1515 | } | - | ||||||||||||
1516 | - | |||||||||||||
1517 | - | |||||||||||||
1518 | - | |||||||||||||
1519 | - | |||||||||||||
1520 | void QSslSocketPrivate::checkSettingSslContext(QSslSocket* socket, QSharedPointer<QSslContext> sslContext) | - | ||||||||||||
1521 | { | - | ||||||||||||
1522 | if (socket->d_func()->sslContextPointer.isNull()) | - | ||||||||||||
1523 | socket->d_func()->sslContextPointer = sslContext; | - | ||||||||||||
1524 | } | - | ||||||||||||
1525 | - | |||||||||||||
1526 | - | |||||||||||||
1527 | - | |||||||||||||
1528 | - | |||||||||||||
1529 | QSharedPointer<QSslContext> QSslSocketPrivate::sslContext(QSslSocket *socket) | - | ||||||||||||
1530 | { | - | ||||||||||||
1531 | return (socket) ? socket->d_func()->sslContextPointer : QSharedPointer<QSslContext>(); | - | ||||||||||||
1532 | } | - | ||||||||||||
1533 | - | |||||||||||||
1534 | bool QSslSocketPrivate::isMatchingHostname(const QSslCertificate &cert, const QString &peerName) | - | ||||||||||||
1535 | { | - | ||||||||||||
1536 | const QString lowerPeerName = peerName.toLower(); | - | ||||||||||||
1537 | const QStringList commonNameListcommonNames = cert.subjectInfo(QSslCertificate::CommonName); | - | ||||||||||||
1538 | - | |||||||||||||
1539 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(commonNameList)>::type> _container_((commonNameList)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QString &commonName = *_container_.i; _container_.control; _container_.control = 0: commonNames) { | - | ||||||||||||
1540 | if (isMatchingHostname(commonName.toLower(), peerName.toLower())) {lowerPeerName)
| 63-323 | ||||||||||||
1541 | return executed 323 times by 8 tests: true;return true; Executed by:
executed 323 times by 8 tests: return true; Executed by:
| 323 | ||||||||||||
1542 | }} executed 63 times by 3 tests: end of block Executed by:
| 63 | ||||||||||||
1543 | - | |||||||||||||
1544 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(cert.const auto subjectAlternativeNames ().values(QSsl::DnsEntry))>::type> _container_((= cert.subjectAlternativeNames().values(); | - | ||||||||||||
1545 | const auto altNames = subjectAlternativeNames.equal_range(QSsl::DnsEntry))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)); | - | ||||||||||||
1546 | for (const QString &altNameauto it = *_container_altNames.ifirst; _container_it != altNames
| 0-63 | ||||||||||||
1547 | if (isMatchingHostname(altName.it->toLower(), peerName.toLower())) {lowerPeerName)
| 0 | ||||||||||||
1548 | return never executed: true;}return true; never executed: return true; | 0 | ||||||||||||
1549 | } never executed: end of block | 0 | ||||||||||||
1550 | - | |||||||||||||
1551 | return executed 63 times by 3 tests: false;return false; Executed by:
executed 63 times by 3 tests: return false; Executed by:
| 63 | ||||||||||||
1552 | } | - | ||||||||||||
1553 | - | |||||||||||||
1554 | bool QSslSocketPrivate::isMatchingHostname(const QString &cn, const QString &hostname) | - | ||||||||||||
1555 | { | - | ||||||||||||
1556 | int wildcard = cn.indexOf(QLatin1Char('*')); | - | ||||||||||||
1557 | - | |||||||||||||
1558 | - | |||||||||||||
1559 | if (wildcard < 0) | - | ||||||||||||
1560 | return cn == hostname; | - | ||||||||||||
1561 | - | |||||||||||||
1562 | int firstCnDot = cn.indexOf(QLatin1Char('.')); | - | ||||||||||||
1563 | int secondCnDot = cn.indexOf(QLatin1Char('.'), firstCnDot+1); | - | ||||||||||||
1564 | - | |||||||||||||
1565 | - | |||||||||||||
1566 | if ((-1 == secondCnDot) || (secondCnDot+1 >= cn.length())) | - | ||||||||||||
1567 | return false; | - | ||||||||||||
1568 | - | |||||||||||||
1569 | - | |||||||||||||
1570 | if (wildcard+1 != firstCnDot) | - | ||||||||||||
1571 | return false; | - | ||||||||||||
1572 | - | |||||||||||||
1573 | - | |||||||||||||
1574 | if (cn.lastIndexOf(QLatin1Char('*')) != wildcard) | - | ||||||||||||
1575 | return false; | - | ||||||||||||
1576 | - | |||||||||||||
1577 | - | |||||||||||||
1578 | if (wildcard && (hostname.leftRef(wildcard) != cn.leftRef(wildcard))) | - | ||||||||||||
1579 | return false; | - | ||||||||||||
1580 | - | |||||||||||||
1581 | - | |||||||||||||
1582 | if (hostname.midRef(hostname.indexOf(QLatin1Char('.'))) != cn.midRef(firstCnDot)) | - | ||||||||||||
1583 | return false; | - | ||||||||||||
1584 | - | |||||||||||||
1585 | - | |||||||||||||
1586 | QHostAddress addr(hostname); | - | ||||||||||||
1587 | if (!addr.isNull()) | - | ||||||||||||
1588 | return false; | - | ||||||||||||
1589 | - | |||||||||||||
1590 | - | |||||||||||||
1591 | return true; | - | ||||||||||||
1592 | } | - | ||||||||||||
1593 | - | |||||||||||||
1594 | - | |||||||||||||
1595 | - | |||||||||||||
Switch to Source code | Preprocessed file |