Index: src/SSLInvalidCertificateException.m ================================================================== --- src/SSLInvalidCertificateException.m +++ src/SSLInvalidCertificateException.m @@ -32,11 +32,11 @@ reason: reason_] autorelease]; } - initWithClass: (Class)class_ { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; } Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -129,11 +129,11 @@ if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) { close(sock); sock = INVALID_SOCKET; @throw [OFInitializationFailedException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } SSL_set_connect_state(ssl); if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl, @@ -144,11 +144,11 @@ OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) || SSL_connect(ssl) != 1) { close(sock); sock = INVALID_SOCKET; @throw [OFInitializationFailedException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } } @catch (id e) { [self release]; @throw e; } @@ -175,14 +175,15 @@ [super connectToHost: host port: port]; if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) { [super close]; - @throw [OFConnectionFailedException exceptionWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException + exceptionWithClass: [self class] + socket: self + host: host + port: port]; } SSL_set_connect_state(ssl); if ((privateKeyFile != nil && !SSL_use_PrivateKey_file(ssl, @@ -190,14 +191,15 @@ SSL_FILETYPE_PEM)) || (certificateFile != nil && !SSL_use_certificate_file(ssl, [certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM)) || SSL_connect(ssl) != 1) { [super close]; - @throw [OFConnectionFailedException exceptionWithClass: isa - socket: self - host: host - port: port]; + @throw [OFConnectionFailedException + exceptionWithClass: [self class] + socket: self + host: host + port: port]; } } - (SSLSocket*)accept { @@ -204,15 +206,15 @@ SSLSocket *newSocket = (SSLSocket*)[super accept]; if ((newSocket->ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(newSocket->ssl, newSocket->sock)) { /* We only want to close the OFTCPSocket */ - newSocket->isa = [OFTCPSocket class]; + object_setClass(newSocket, [OFTCPSocket class]); [newSocket close]; - newSocket->isa = isa; + object_setClass(newSocket, object_getClass(self)); - @throw [OFAcceptFailedException exceptionWithClass: isa + @throw [OFAcceptFailedException exceptionWithClass: [self class] socket: self]; } SSL_set_accept_state(newSocket->ssl); @@ -220,15 +222,15 @@ cStringWithEncoding: OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM) || !SSL_use_certificate_file(newSocket->ssl, [certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE], SSL_FILETYPE_PEM) || SSL_accept(newSocket->ssl) != 1) { /* We only want to close the OFTCPSocket */ - newSocket->isa = [OFTCPSocket class]; + object_setClass(newSocket, [OFTCPSocket class]); [newSocket close]; - newSocket->isa = isa; + object_setClass(newSocket, object_getClass(self)); - @throw [OFAcceptFailedException exceptionWithClass: isa + @throw [OFAcceptFailedException exceptionWithClass: [self class] socket: self]; } return newSocket; } @@ -245,20 +247,20 @@ length: (size_t)length { ssize_t ret; if (length > INT_MAX) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException exceptionWithClass: isa + @throw [OFNotConnectedException exceptionWithClass: [self class] socket: self]; if (atEndOfStream) { OFReadFailedException *e; - e = [OFReadFailedException exceptionWithClass: isa + e = [OFReadFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; #else @@ -267,11 +269,11 @@ @throw e; } if ((ret = SSL_read(ssl, buffer, (int)length)) < 0) - @throw [OFReadFailedException exceptionWithClass: isa + @throw [OFReadFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; if (ret == 0) atEndOfStream = YES; @@ -281,20 +283,20 @@ - (void)_writeBuffer: (const void*)buffer length: (size_t)length { if (length > INT_MAX) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; if (sock == INVALID_SOCKET) - @throw [OFNotConnectedException exceptionWithClass: isa + @throw [OFNotConnectedException exceptionWithClass: [self class] socket: self]; if (atEndOfStream) { OFWriteFailedException *e; - e = [OFWriteFailedException exceptionWithClass: isa + e = [OFWriteFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; #ifndef _WIN32 e->errNo = ENOTCONN; @@ -304,11 +306,11 @@ @throw e; } if (SSL_write(ssl, buffer, (int)length) < length) - @throw [OFWriteFailedException exceptionWithClass: isa + @throw [OFWriteFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; } - (size_t)pendingBytes @@ -344,12 +346,13 @@ size_t length; char buffer[64]; OFDataArray *data; if (![type isEqual: @"tls-unique"]) - @throw [OFInvalidArgumentException exceptionWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; if (SSL_session_reused(ssl) ^ !listening) { /* * We are either client or the session has been resumed * => we have sent the finished message @@ -384,11 +387,11 @@ if ((SSL_get_peer_certificate(ssl) == NULL) || ((ret = SSL_get_verify_result(ssl)) != X509_V_OK)) { const char *reason = X509_verify_cert_error_string(ret); @throw [SSLInvalidCertificateException - exceptionWithClass: isa + exceptionWithClass: [self class] reason: [OFString stringWithUTF8String: reason]]; } } @end Index: src/X509Certificate.m ================================================================== --- src/X509Certificate.m +++ src/X509Certificate.m @@ -51,11 +51,11 @@ const unsigned char *dataCArray = [data cArray]; crt = d2i_X509(NULL, &dataCArray, [data count]); [pool release]; if (crt == NULL) @throw [OFInitializationFailedException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } @catch (id e) { [self release]; @throw e; } @@ -68,11 +68,11 @@ @try { crt = X509_dup(cert); if (crt == NULL) @throw [OFInitializationFailedException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } @catch (id e) { [self release]; @throw e; } @@ -416,11 +416,12 @@ { OFString *ret; char *buffer; if (ASN1_STRING_to_UTF8((unsigned char**)&buffer, str) < 0) - @throw [OFInvalidEncodingException exceptionWithClass: isa]; + @throw [OFInvalidEncodingException + exceptionWithClass: [self class]]; @try { ret = [OFString stringWithUTF8String: buffer]; } @finally { OPENSSL_free(buffer);