Skip to content

Instantly share code, notes, and snippets.

@sos4nt
Created October 6, 2010 21:26
Show Gist options
  • Save sos4nt/614121 to your computer and use it in GitHub Desktop.
Save sos4nt/614121 to your computer and use it in GitHub Desktop.
Index: Source/SPConnectionController.m
===================================================================
--- Source/SPConnectionController.m (revision 2726)
+++ Source/SPConnectionController.m (working copy)
@@ -326,7 +326,7 @@
[self setSshHost:[[self sshHost] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
// Set up the tunnel details
- sshTunnel = [[SPSSHTunnel alloc] initToHost:[self sshHost] port:([[self sshPort] length]?[[self sshPort] integerValue]:22) login:[self sshUser] tunnellingToPort:([[self port] length]?[[self port] integerValue]:3306) onHost:[self host]];
+ sshTunnel = [[SPSSHTunnel alloc] initToHost:[self sshHost] port:[[self sshPort] integerValue] login:[self sshUser] tunnellingToPort:([[self port] length]?[[self port] integerValue]:3306) onHost:[self host]];
[sshTunnel setParentWindow:[tableDocument parentWindow]];
// Add keychain or plaintext password as appropriate - note the checks in initiateConnection.
Index: Source/SPSSHTunnel.m
===================================================================
--- Source/SPSSHTunnel.m (revision 2726)
+++ Source/SPSSHTunnel.m (working copy)
@@ -42,7 +42,7 @@
*/
- (id) initToHost:(NSString *) theHost port:(NSInteger) thePort login:(NSString *) theLogin tunnellingToPort:(NSInteger) targetPort onHost:(NSString *) targetHost
{
- if (!theHost || !thePort || !targetPort || !targetHost) return nil;
+ if (!theHost || !targetPort || !targetHost) return nil;
self = [super init];
@@ -305,7 +305,9 @@
[taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%ld", (long)ceil(keepAliveInterval)]];
[taskArguments addObject:@"-o ServerAliveCountMax=1"];
}
- [taskArguments addObject:[NSString stringWithFormat:@"-p %ld", (long)sshPort]];
+ if (sshPort) {
+ [taskArguments addObject:[NSString stringWithFormat:@"-p %ld", (long)sshPort]];
+ }
if ([sshLogin length]) {
[taskArguments addObject:[NSString stringWithFormat:@"%@@%@", sshLogin, sshHost]];
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment