From 92e7b9a652b0d1806d732079574aea7270b8a2c0 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 13 Sep 2010 22:26:54 +0000 Subject: - Implement support for MySQL over SSL for both TCP/IP and Socket connection modes. - Upgrade the MySQL binaries to version 5.1.50 (was 5.1.46) - Enable SSL support in the MySQL libraries (this leads to a large increase in library size, unfortunately) - Enable more optimisations in the MySQL libraries (especially --enable-assembler for faster in-library string processing and --with-mysqld-ldflags=-all-static) This completes support for Issue #27. --- Source/SPDatabaseDocument.m | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 648a7691..1a0ae6d6 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -267,10 +267,17 @@ [connectionController setHost:@""]; [connectionController setPort:@""]; [connectionController setSocket:@""]; + [connectionController setUseSSL:NSOffState]; + [connectionController setSslKeyFileLocationEnabled:NSOffState]; + [connectionController setSslKeyFileLocation:nil]; + [connectionController setSslCertificateFileLocationEnabled:NSOffState]; + [connectionController setSslCertificateFileLocation:nil]; + [connectionController setSslCACertFileLocationEnabled:NSOffState]; + [connectionController setSslCACertFileLocation:nil]; [connectionController setSshHost:@""]; [connectionController setSshUser:@""]; [connectionController setSshKeyLocationEnabled:NSOffState]; - [connectionController setSshKeyLocation:@""]; + [connectionController setSshKeyLocation:nil]; [connectionController setSshPort:@""]; [connectionController setDatabase:@""]; [connectionController setPassword:nil]; @@ -468,6 +475,22 @@ [connectionController setHost:[connection objectForKey:@"host"]]; if([connection objectForKey:@"port"]) [connectionController setPort:[NSString stringWithFormat:@"%ld", (long)[[connection objectForKey:@"port"] integerValue]]]; + + if([connection objectForKey:@"useSSL"]) + [connectionController setUseSSL:[[connection objectForKey:@"useSSL"] intValue]]; + if([connection objectForKey:@"sslKeyFileLocationEnabled"]) + [connectionController setSslKeyFileLocationEnabled:[[connection objectForKey:@"sslKeyFileLocationEnabled"] intValue]]; + if([connection objectForKey:@"sslKeyFileLocation"]) + [connectionController setSslKeyFileLocation:[connection objectForKey:@"sslKeyFileLocation"]]; + if([connection objectForKey:@"sslCertificateFileLocationEnabled"]) + [connectionController setSslCertificateFileLocationEnabled:[[connection objectForKey:@"sslCertificateFileLocationEnabled"] intValue]]; + if([connection objectForKey:@"sslCertificateFileLocation"]) + [connectionController setSslCertificateFileLocation:[connection objectForKey:@"sslCertificateFileLocation"]]; + if([connection objectForKey:@"sslCACertFileLocationEnabled"]) + [connectionController setSslCACertFileLocationEnabled:[[connection objectForKey:@"sslCACertFileLocationEnabled"] intValue]]; + if([connection objectForKey:@"sslCACertFileLocation"]) + [connectionController setSslCACertFileLocation:[connection objectForKey:@"sslCACertFileLocation"]]; + if([connection objectForKey:@"kcid"] && [(NSString *)[connection objectForKey:@"kcid"] length]) [self setKeychainID:[connection objectForKey:@"kcid"]]; @@ -530,6 +553,8 @@ [spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"auto_connect"]; + [connectionController updateSSLInterface:self]; + if([spf objectForKey:@"auto_connect"] && [[spf valueForKey:@"auto_connect"] boolValue]) { [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"auto_connect"]; [connectionController initiateConnection:self]; @@ -3292,6 +3317,14 @@ [connection setObject:[self host] forKey:@"host"]; [connection setObject:[self user] forKey:@"user"]; + [connection setObject:[NSNumber numberWithInt:[connectionController useSSL]] forKey:@"useSSL"]; + [connection setObject:[NSNumber numberWithInt:[connectionController sslKeyFileLocationEnabled]] forKey:@"sslKeyFileLocationEnabled"]; + [connection setObject:[connectionController sslKeyFileLocation] forKey:@"sslKeyFileLocation"]; + [connection setObject:[NSNumber numberWithInt:[connectionController sslCertificateFileLocationEnabled]] forKey:@"sslCertificateFileLocationEnabled"]; + [connection setObject:[connectionController sslCertificateFileLocation] forKey:@"sslCertificateFileLocation"]; + [connection setObject:[NSNumber numberWithInt:[connectionController sslCACertFileLocationEnabled]] forKey:@"sslCACertFileLocationEnabled"]; + [connection setObject:[connectionController sslCACertFileLocation] forKey:@"sslCACertFileLocation"]; + switch([connectionController type]) { case SPTCPIPConnection: aString = @"SPTCPIPConnection"; -- cgit v1.2.3