ObjOpenSSL  Check-in [8a23146f8c]

Overview
Comment:Don't class-swizzle to call close on super.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8a23146f8c72db0483e92c6f813aec49b035790f4bf86609987c2b20f1c6ae67
User & Date: js on 2013-02-13 23:27:13
Other Links: manifest | tags
Context
2013-02-14
02:20
Add -Wdocumentation if supported by the compiler. check-in: 16a02009a3 user: js tags: trunk
2013-02-13
23:27
Don't class-swizzle to call close on super. check-in: 8a23146f8c user: js tags: trunk
23:15
Don't cache the description of exceptions. check-in: bc41772796 user: js tags: trunk
Changes

Modified src/SSLSocket.h from [ebcd9bc588] to [d1df87a4ff].

39
40
41
42
43
44
45
46
47


48
49
50
51
52
53
54
39
40
41
42
43
44
45


46
47
48
49
50
51
52
53
54







-
-
+
+







@property BOOL requestsClientCertificates;
#endif

- initWithSocket: (OFTCPSocket*)socket;
-  initWithSocket: (OFTCPSocket*)socket
   privateKeyFile: (OFString*)privateKeyFile
  certificateFile: (OFString*)certificateFile;
/* Change the return type */
- (SSLSocket*)accept;
- (void)SSL_super_close;
- (SSLSocket*)accept;	/* Changes the return type */
- (void)setPrivateKeyFile: (OFString*)file;
- (OFString*)privateKeyFile;
- (void)setCertificateFile: (OFString*)file;
- (OFString*)certificateFile;
- (void)setRequestsClientCertificates: (BOOL)enabled;
- (BOOL)requestsClientCertificates;
- (OFDataArray*)channelBindingDataWithType: (OFString*)type;

Modified src/SSLSocket.m from [acf401502b] to [5ed521dab9].

211
212
213
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239

240
241
242
243
244
245
246
247
248
249
250
251
252
253





254
255
256
257
258
259
260
211
212
213
214
215
216
217



218


219
220
221
222
223
224
225
226
227
228
229
230
231
232



233


234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257







-
-
-
+
-
-














-
-
-
+
-
-












+
+
+
+
+








- (SSLSocket*)accept
{
	SSLSocket *client = (SSLSocket*)[super accept];

	if ((client->_SSL = SSL_new(ctx)) == NULL ||
	    !SSL_set_fd(client->_SSL, client->_socket)) {
		/* We only want to close the OFTCPSocket */
		object_setClass(client, [OFTCPSocket class]);
		[client close];
		[client SSL_super_close];
		object_setClass(client, object_getClass(self));

		@throw [OFAcceptFailedException exceptionWithClass: [self class]
							    socket: self];
	}

	if (_requestsClientCertificates)
		SSL_set_verify(client->_SSL, SSL_VERIFY_PEER, NULL);

	SSL_set_accept_state(client->_SSL);

	if (!SSL_use_PrivateKey_file(client->_SSL, [_privateKeyFile
	    cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM) || !SSL_use_certificate_file(client->_SSL,
	    [_certificateFile cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
	    SSL_FILETYPE_PEM) || SSL_accept(client->_SSL) != 1) {
		/* We only want to close the OFTCPSocket */
		object_setClass(client, [OFTCPSocket class]);
		[client close];
		[client SSL_super_close];
		object_setClass(client, object_getClass(self));

		@throw [OFAcceptFailedException exceptionWithClass: [self class]
							    socket: self];
	}

	return client;
}

- (void)close
{
	if (_SSL != NULL)
		SSL_shutdown(_SSL);

	[super close];
}

- (void)SSL_super_close
{
	[super close];
}

- (size_t)lowlevelReadIntoBuffer: (void*)buffer
			  length: (size_t)length
{
	ssize_t ret;