ObjFW  Check-in [f2e96ebd9a]

Overview
Comment:OFGnuTLSTLSStream: Improve error codes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: f2e96ebd9a89f7300f652d6c98124c6db6e287ee0bac574c51acf069e18f864d
User & Date: js on 2024-11-18 00:51:17
Other Links: manifest | tags
Context
2024-11-18
00:51
OFGnuTLSTLSStream: Improve error codes Leaf check-in: f2e96ebd9a user: js tags: trunk
2024-11-16
14:17
OFSecureTransportTLSStream: Use more error codes check-in: 33dbefb035 user: js tags: trunk
Changes

Modified src/tls/OFGnuTLSTLSStream.m from [84d62d35d3] to [772ec409ee].

314
315
316
317
318
319
320
321









322
323
324
325

326
327
328
329
330
331
332
				return false;
			} else
				return true;
		}

		if (status == GNUTLS_E_SUCCESS)
			_handshakeDone = true;
		else









			exception = [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: _host
				      errorCode: OFTLSStreamErrorCodeUnknown];

	}

	if ([_delegate respondsToSelector:
	    @selector(stream:didPerformClientHandshakeWithHost:exception:)])
		[_delegate		       stream: self
		    didPerformClientHandshakeWithHost: _host
					    exception: exception];







|
>
>
>
>
>
>
>
>
>



|
>







314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
				return false;
			} else
				return true;
		}

		if (status == GNUTLS_E_SUCCESS)
			_handshakeDone = true;
		else {
			OFTLSStreamErrorCode errorCode =
			    OFTLSStreamErrorCodeUnknown;

			if (status == GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR)
				errorCode = certificateStatusToErrorCode(
				    gnutls_session_get_verify_cert_status(
				    _session));

			/* FIXME: Map to better errors */
			exception = [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: _host
				      errorCode: errorCode];
		}
	}

	if ([_delegate respondsToSelector:
	    @selector(stream:didPerformClientHandshakeWithHost:exception:)])
		[_delegate		       stream: self
		    didPerformClientHandshakeWithHost: _host
					    exception: exception];
357
358
359
360
361
362
363
364









365
366
367
368

369
370
371
372
373
374
375
376
377
378
379
380
381
					    runLoopMode: runLoopMode];
				return nil;
			}
		}

		if (status == GNUTLS_E_SUCCESS)
			_handshakeDone = true;
		else









			exception = [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: _host
				      errorCode: OFTLSStreamErrorCodeUnknown];

	}

	if ([_delegate respondsToSelector:
	    @selector(stream:didPerformClientHandshakeWithHost:exception:)])
		[_delegate		       stream: self
		    didPerformClientHandshakeWithHost: _host
					    exception: exception];

	[_delegate release];

	return nil;
}
@end







|
>
>
>
>
>
>
>
>
>



|
>













367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
					    runLoopMode: runLoopMode];
				return nil;
			}
		}

		if (status == GNUTLS_E_SUCCESS)
			_handshakeDone = true;
		else {
			OFTLSStreamErrorCode errorCode =
			    OFTLSStreamErrorCodeUnknown;

			if (status == GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR)
				errorCode = certificateStatusToErrorCode(
				    gnutls_session_get_verify_cert_status(
				    _session));

			/* FIXME: Map to better errors */
			exception = [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: _host
				      errorCode: errorCode];
		}
	}

	if ([_delegate respondsToSelector:
	    @selector(stream:didPerformClientHandshakeWithHost:exception:)])
		[_delegate		       stream: self
		    didPerformClientHandshakeWithHost: _host
					    exception: exception];

	[_delegate release];

	return nil;
}
@end