Update to recent ObjFW changes.

This commit is contained in:
Jonathan Schleifer 2011-09-12 22:05:19 +02:00
parent 59a56bca2a
commit 2152c84f3a

View file

@ -82,9 +82,11 @@ static SSL_CTX *ctx;
SSL_set_connect_state(ssl); SSL_set_connect_state(ssl);
if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl, if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
[privateKeyFile cString], SSL_FILETYPE_PEM)) || [privateKeyFile cStringWithEncoding:
OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) ||
(certificateFile != nil && !SSL_use_certificate_file(ssl, (certificateFile != nil && !SSL_use_certificate_file(ssl,
[certificateFile cString], SSL_FILETYPE_PEM)) || [certificateFile cStringWithEncoding:
OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) ||
SSL_connect(ssl) != 1) { SSL_connect(ssl) != 1) {
close(sock); close(sock);
sock = INVALID_SOCKET; sock = INVALID_SOCKET;
@ -129,10 +131,11 @@ static SSL_CTX *ctx;
SSL_set_connect_state(ssl); SSL_set_connect_state(ssl);
if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl, if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl,
[privateKeyFile cString], SSL_FILETYPE_PEM)) || [privateKeyFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
(certificateFile != nil && !SSL_use_certificate_file(ssl, SSL_FILETYPE_PEM)) || (certificateFile != nil &&
[certificateFile cString], SSL_FILETYPE_PEM)) || !SSL_use_certificate_file(ssl, [certificateFile
SSL_connect(ssl) != 1) { cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
SSL_FILETYPE_PEM)) || SSL_connect(ssl) != 1) {
[super close]; [super close];
@throw [OFConnectionFailedException newWithClass: isa @throw [OFConnectionFailedException newWithClass: isa
socket: self socket: self
@ -158,10 +161,11 @@ static SSL_CTX *ctx;
SSL_set_accept_state(newSocket->ssl); SSL_set_accept_state(newSocket->ssl);
if (!SSL_use_PrivateKey_file(newSocket->ssl, [privateKeyFile cString], if (!SSL_use_PrivateKey_file(newSocket->ssl, [privateKeyFile
cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
SSL_FILETYPE_PEM) || !SSL_use_certificate_file(newSocket->ssl, SSL_FILETYPE_PEM) || !SSL_use_certificate_file(newSocket->ssl,
[certificateFile cString], SSL_FILETYPE_PEM) || [certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
SSL_accept(newSocket->ssl) != 1) { SSL_FILETYPE_PEM) || SSL_accept(newSocket->ssl) != 1) {
/* We only want to close the OFTCPSocket */ /* We only want to close the OFTCPSocket */
newSocket->isa = [OFTCPSocket class]; newSocket->isa = [OFTCPSocket class];
[newSocket close]; [newSocket close];