diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMMCPConnection.m | 2 | ||||
-rw-r--r-- | Source/SPSSHTunnel.m | 10 |
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]; |