aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-06-03 00:05:36 +0000
committerrowanbeentje <rowan@beent.je>2009-06-03 00:05:36 +0000
commit7f8a32e9d118c6f7d84d988a6f2462a8a2c9b085 (patch)
tree1a812cd0a02000a56652be12537cd0b2f6fb05b9
parent1b339bc5b4c5e405855c0ef9bccc819b3c68be67 (diff)
downloadsequelpro-7f8a32e9d118c6f7d84d988a6f2462a8a2c9b085.tar.gz
sequelpro-7f8a32e9d118c6f7d84d988a6f2462a8a2c9b085.tar.bz2
sequelpro-7f8a32e9d118c6f7d84d988a6f2462a8a2c9b085.zip
- Fix SSH tunnels on PPC
- Improve general SSH tunnel stability and automatic reconnection on failure - Improve handling of failed SSH tunnel passwords
-rw-r--r--Source/CMMCPConnection.m2
-rw-r--r--Source/SPSSHTunnel.m10
2 files changed, 11 insertions, 1 deletions
diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m
index b7fc230f..c5e14567 100644
--- a/Source/CMMCPConnection.m
+++ b/Source/CMMCPConnection.m
@@ -444,7 +444,9 @@ static void forcePingTimeout(int signalNumber);
// Restart the tunnel if it dies
if (mConnected && newState == SPSSH_STATE_IDLE && currentSSHTunnelState == SPSSH_STATE_CONNECTED) {
currentSSHTunnelState = newState;
+ [connectionTunnel setConnectionStateChangeSelector:nil delegate:nil];
[self reconnect];
+ return;
}
currentSSHTunnelState = newState;
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index 20c6b112..433ccad4 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -203,9 +203,10 @@
// [taskArguments addObject:@"-C"]; // TODO: compression?
[taskArguments addObject:@"-o ExitOnForwardFailure=yes"];
[taskArguments addObject:[NSString stringWithFormat:@"-o ConnectTimeout=%i", connectionTimeout]];
+ [taskArguments addObject:@"-o NumberOfPasswordPrompts=1"];
if (useKeepAlive && keepAliveInterval) {
[taskArguments addObject:@"-o TCPKeepAlive=no"];
- [taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%i", ceil(keepAliveInterval)]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%i", (int)ceil(keepAliveInterval)]];
[taskArguments addObject:@"-o ServerAliveCountMax=1"];
}
[taskArguments addObject:[NSString stringWithFormat:@"-p %i", sshPort]];
@@ -319,6 +320,13 @@
lastError = [[NSString alloc] initWithString:NSLocalizedString(@"The SSH Tunnel was closed 'by the remote host'. This may indicate a networking issue or a network timeout.", @"SSH tunnel was closed by remote host message")];
if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO];
}
+ if ([message rangeOfString:@"Permission denied (" ].location != NSNotFound) {
+ connectionState = SPSSH_STATE_IDLE;
+ [task terminate];
+ if (lastError) [lastError release];
+ lastError = [[NSString alloc] initWithString:NSLocalizedString(@"The SSH Tunnel could not authenticate with the remote host. Please check your password and ensure you still have access.", @"SSH tunnel authentication failed message")];
+ if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO];
+ }
if ([message rangeOfString:@"Operation timed out" ].location != NSNotFound) {
connectionState = SPSSH_STATE_IDLE;
[task terminate];